Bring up to date with latest oconfigure.

This commit is contained in:
kristapsdz committed 2021-01-20 22:29:03 +00:00
1 parent 496843721b
commit 2667da7625
3 files changed
+126 -25

No files matched your search

+78 -11
View File
@@ -41,6 +41,18 @@ vwarnx(const char *fmt, va_list ap)
fprintf(stderr, "%s: ", getprogname());
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
}
void
vwarnc(int code, const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", getprogname());
if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
fprintf(stderr, "%s\n", strerror(code));
}
void
@@ -49,21 +61,69 @@ vwarn(const char *fmt, va_list ap)
int sverrno;
sverrno = errno;
vwarnx(fmt, ap);
if (fmt != NULL)
fputs(": ", stderr);
fprintf(stderr, "%s: ", getprogname());
if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
fprintf(stderr, "%s\n", strerror(sverrno));
}
void
verrc(int eval, int code, const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", getprogname());
if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
fprintf(stderr, "%s\n", strerror(code));
exit(eval);
}
void
verrx(int eval, const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", getprogname());
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
exit(eval);
}
void
verr(int eval, const char *fmt, va_list ap)
{
int sverrno;
sverrno = errno;
fprintf(stderr, "%s: ", getprogname());
if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
fprintf(stderr, "%s\n", strerror(sverrno));
exit(eval);
}
void
err(int eval, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vwarn(fmt, ap);
verr(eval, fmt, ap);
va_end(ap);
}
void
errc(int eval, int code, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
verrc(eval, code, fmt, ap);
va_end(ap);
exit(eval);
}
void
@@ -72,10 +132,8 @@ errx(int eval, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
vwarnx(fmt, ap);
verrx(eval, fmt, ap);
va_end(ap);
fputc('\n', stderr);
exit(eval);
}
void
@@ -88,6 +146,16 @@ warn(const char *fmt, ...)
va_end(ap);
}
void
warnc(int code, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vwarnc(code, fmt, ap);
va_end(ap);
}
void
warnx(const char *fmt, ...)
{
@@ -96,7 +164,6 @@ warnx(const char *fmt, ...)
va_start(ap, fmt);
vwarnx(fmt, ap);
va_end(ap);
fputc('\n', stderr);
}
#endif /* !HAVE_ERR */
#if !HAVE_B64_NTOP
@@ -2456,7 +2523,7 @@ setresuid(uid_t ruid, uid_t euid, uid_t suid)
return ret;
}
#endif /* !HAVE_SETRESUID */
#if !HAVE_SHA2_H
#if !HAVE_SHA2
/* $OpenBSD$ */
/*
@@ -3592,7 +3659,7 @@ SHA512Data(const u_char *data, size_t len, char *buf)
SHA512Update(&ctx, data, len);
return (SHA512End(&ctx, buf));
}
#endif /* !HAVE_SHA2_H */
#endif /* !HAVE_SHA2 */
#if !HAVE_STRLCAT
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
Vendored
+41 -12
View File
@@ -15,7 +15,7 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
OCONFIGURE_VERSION="0.2.6"
OCONFIGURE_VERSION="0.3.2"
#
# This script outputs two files: config.h and Makefile.configure.
@@ -54,19 +54,39 @@ set -e
exec 3> config.log
echo "config.log: writing..."
# GNU submake prints different output if invoked recursively, which
# messes up CC and CFLAGS detection. Pass --no-print-directory if
# we have a MAKELEVEL (GNU and FreeBSD make) and the argument is
# allowed.
MAKE_FLAGS=""
if [ -n "${MAKELEVEL}" ]; then
if [ "${MAKELEVEL}" -gt 0 ] ; then
MAKE_FLAGS="--no-print-directory"
echo "all:" | make ${MAKE_FLAGS} -sf - 2>/dev/null || MAKE_FLAGS=""
fi
fi
if [ -n "$MAKE_FLAGS" ]; then
echo "GNU submake detected: using --no-print-directory" 1>&2
echo "GNU submake detected: using --no-print-directory" 1>&3
fi
#----------------------------------------------------------------------
# Initialize all variables here such that nothing can leak in from the
# environment except for CC and CFLAGS, which we might have passed in.
#----------------------------------------------------------------------
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make -sf -`
CFLAGS=`printf "all:\\n\\t@echo \\\$(CFLAGS)\\n" | make -sf -`
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make ${MAKE_FLAGS} -sf -`
CFLAGS=`printf "all:\\n\\t@echo \\\$(CFLAGS)\\n" | make ${MAKE_FLAGS} -sf -`
CFLAGS="${CFLAGS} -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes"
CFLAGS="${CFLAGS} -Wwrite-strings -Wno-unused-parameter"
LDADD=
LDADD_B64_NTOP=
LDADD_CRYPT=
LDADD_MD5=
LDADD_SHA2=
LDADD_LIB_SOCKET=
LDADD_STATIC=
CPPFLAGS=
@@ -185,6 +205,7 @@ HAVE_SECCOMP_FILTER=
HAVE_SETRESGID=
HAVE_SETRESUID=
HAVE_SOCK_NONBLOCK=
HAVE_SHA2=
HAVE_SHA2_H=
HAVE_STRLCAT=
HAVE_STRLCPY=
@@ -251,18 +272,18 @@ singletest() {
extralib=""
cat 1>&3 << __HEREDOC__
${1}: testing...
${COMP} -DTEST_${2} ${3} -o test-${1} tests.c ${4}
${COMP} -DTEST_${2} ${3} -o test-${1} tests.c ${LDFLAGS} ${4}
__HEREDOC__
if ${COMP} -DTEST_${2} ${3} -o "test-${1}" tests.c ${4} 1>&3 2>&3; then
if ${COMP} -DTEST_${2} ${3} -o "test-${1}" tests.c ${LDFLAGS} ${4} 1>&3 2>&3; then
echo "${1}: ${CC} succeeded" 1>&3
else
if [ -n "${5}" ] ; then
echo "${1}: ${CC} failed with $? (retrying)" 1>&3
cat 1>&3 << __HEREDOC__
${1}: testing...
${COMP} -DTEST_${2} ${3} -o test-${1} tests.c ${5}
${COMP} -DTEST_${2} ${3} -o test-${1} tests.c ${LDFLAGS} ${5}
__HEREDOC__
if ${COMP} -DTEST_${2} ${3} -o "test-${1}" tests.c ${5} 1>&3 2>&3; then
if ${COMP} -DTEST_${2} ${3} -o "test-${1}" tests.c ${LDFLAGS} ${5} 1>&3 2>&3; then
echo "${1}: ${CC} succeeded" 1>&3
extralib="(with ${5})"
else
@@ -350,7 +371,7 @@ runtest sandbox_init SANDBOX_INIT "-Wno-deprecated" || true
runtest seccomp-filter SECCOMP_FILTER || true
runtest setresgid SETRESGID || true
runtest setresuid SETRESUID || true
runtest sha2_h SHA2_H || true
runtest sha2 SHA2 "" "" "-lmd" || true
runtest SOCK_NONBLOCK SOCK_NONBLOCK || true
runtest static STATIC "" "-static" || true
runtest strlcat STRLCAT || true
@@ -431,7 +452,7 @@ if [ ${HAVE_FTS} -eq 0 -o \
${HAVE_RECALLOCARRAY} -eq 0 -o \
${HAVE_SETRESGID} -eq 0 -o \
${HAVE_SETRESUID} -eq 0 -o \
${HAVE_SHA2_H} -eq 0 -o \
${HAVE_SHA2} -eq 0 -o \
${HAVE_STRLCAT} -eq 0 -o \
${HAVE_STRLCPY} -eq 0 -o \
${HAVE_STRNDUP} -eq 0 -o \
@@ -442,7 +463,7 @@ then
fi
if [ ${HAVE_MD5} -eq 0 -o \
${HAVE_SHA2_H} -eq 0 ]
${HAVE_SHA2} -eq 0 ]
then
echo "#include <stdint.h> /* C99 [u]int[nn]_t types */"
echo
@@ -509,7 +530,8 @@ cat << __HEREDOC__
#define HAVE_SECCOMP_FILTER ${HAVE_SECCOMP_FILTER}
#define HAVE_SETRESGID ${HAVE_SETRESGID}
#define HAVE_SETRESUID ${HAVE_SETRESUID}
#define HAVE_SHA2_H ${HAVE_SHA2_H}
#define HAVE_SHA2 ${HAVE_SHA2}
#define HAVE_SHA2_H ${HAVE_SHA2}
#define HAVE_SOCK_NONBLOCK ${HAVE_SOCK_NONBLOCK}
#define HAVE_STRLCAT ${HAVE_STRLCAT}
#define HAVE_STRLCPY ${HAVE_STRLCPY}
@@ -625,10 +647,16 @@ __HEREDOC__
* Compatibility functions for err(3).
*/
extern void err(int, const char *, ...);
extern void errc(int, int, const char *, ...);
extern void errx(int, const char *, ...);
extern void verr(int, const char *, va_list);
extern void verrc(int, int, const char *, va_list);
extern void verrx(int, const char *, va_list);
extern void warn(const char *, ...);
extern void warnx(const char *, ...);
extern void warnc(int, const char *, ...);
extern void vwarn(const char *, va_list);
extern void vwarnc(int, const char *, va_list);
extern void vwarnx(const char *, va_list);
__HEREDOC__
@@ -656,7 +684,7 @@ extern void MD5Final(uint8_t [MD5_DIGEST_LENGTH], MD5_CTX *);
__HEREDOC__
[ ${HAVE_SHA2_H} -eq 0 ] && \
[ ${HAVE_SHA2} -eq 0 ] && \
cat << __HEREDOC__
/*
* Compatibility for sha2(3).
@@ -2432,6 +2460,7 @@ LDADD_B64_NTOP = ${LDADD_B64_NTOP}
LDADD_CRYPT = ${LDADD_CRYPT}
LDADD_LIB_SOCKET = ${LDADD_LIB_SOCKET}
LDADD_MD5 = ${LDADD_MD5}
LDADD_SHA2 = ${LDADD_SHA2}
LDADD_STATIC = ${LDADD_STATIC}
LDFLAGS = ${LDFLAGS}
STATIC = ${STATIC}
+7 -2
View File
@@ -93,13 +93,17 @@ main(void)
*/
#include <err.h>
#include <errno.h>
int
main(void)
{
warnx("%d. warnx", 1);
warnc(ENOENT, "%d. warn", ENOENT);
warn("%d. warn", 2);
err(0, "%d. err", 3);
errx(0, "%d. err", 3);
errc(0, ENOENT, "%d. err", 3);
/* NOTREACHED */
return 1;
}
@@ -117,6 +121,7 @@ main(void)
}
#endif /* TEST_EXPLICIT_BZERO */
#if TEST_FTS
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fts.h>
@@ -415,7 +420,7 @@ main(void)
return setresuid(-1, -1, -1) == -1;
}
#endif /* TEST_SETRESUID */
#if TEST_SHA2_H
#if TEST_SHA2
#include <sys/types.h>
#include <sha2.h>
@@ -430,7 +435,7 @@ int main(void)
return 0;
}
#endif /* TEST_SHA2_H */
#endif /* TEST_SHA2 */
#if TEST_SOCK_NONBLOCK
/*
* Linux doesn't (always?) have this.