From ef4bed9cdec8fa257e3c18a416afaec372d3e44f Mon Sep 17 00:00:00 2001 From: Alexandros Couloumbis Date: Thu, 23 Feb 2017 13:17:39 +0200 Subject: [PATCH 1/2] add autogen.sh script --- autogen.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 autogen.sh diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..9fdcdce --- /dev/null +++ b/autogen.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +set -e + +case "$(uname)" in + Darwin) + LIBTOOLIZE=${LIBTOOLIZE:-glibtoolize} + ;; + *) + LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} + ;; +esac +AUTORECONF=${AUTORECONF:-autoreconf} +ACLOCAL=${ACLOCAL:-aclocal} +AUTOCONF=${AUTOCONF:-autoconf} +AUTOHEADER=${AUTOHEADER:-autoheader} +AUTOMAKE=${AUTOMAKE:-automake} + +# Check we have all tools installed +check_command() { + command -v "${1}" > /dev/null 2>&1 || { + >&2 echo "autogen.sh: could not find \`$1'. \`$1' is required to run autogen.sh." + exit 1 + } +} +check_command "$LIBTOOLIZE" +check_command "$AUTORECONF" +check_command "$ACLOCAL" +check_command "$AUTOCONF" +check_command "$AUTOHEADER" +check_command "$AUTOMAKE" + +# Absence of pkg-config or misconfiguration can make some odd error +# messages, we check if it is installed correctly. See: +# https://blogs.oracle.com/mandy/entry/autoconf_weirdness +# +# We cannot just check for pkg-config command, we need to check for +# PKG_* macros. The pkg-config command can be defined in ./configure, +# we cannot tell anything when not present. +check_pkg_config() { + grep -q '^AC_DEFUN.*PKG_CHECK_MODULES' aclocal.m4 || { + cat <&2 +autogen.sh: could not find PKG_CHECK_MODULES macro. + + Either pkg-config is not installed on your system or + \`pkg.m4' is missing or not found by aclocal. + + If \`pkg.m4' is installed at an unusual location, re-run + \`autogen.sh' by setting \`ACLOCAL_FLAGS': + + ACLOCAL_FLAGS="-I /share/aclocal" ./autogen.sh + +EOF + exit 1 + } +} + +echo "autogen.sh: reconfigure with autoreconf" +${AUTORECONF} -vif -I m4 || { + echo "autogen.sh: autoreconf has failed ($?), let's do it manually" + [ -f ./configure.ac ] || [ -f ./configure.in ] || continue + echo "autogen.sh: configure `basename $PWD`" + ${ACLOCAL} -I m4 ${ACLOCAL_FLAGS} + check_pkg_config + ${LIBTOOLIZE} --automake --copy --force + ${ACLOCAL} -I m4 ${ACLOCAL_FLAGS} + ${AUTOCONF} --force + ${AUTOHEADER} + ${AUTOMAKE} --add-missing --copy --force-missing +} + +echo "autogen.sh: for the next step, run './configure' [or './configure --help' to check available options]" + +exit 0 From 3a073cc16d808d4f11687eb68c04f696f8cee2e6 Mon Sep 17 00:00:00 2001 From: Alexandros Couloumbis Date: Thu, 23 Feb 2017 13:18:27 +0200 Subject: [PATCH 2/2] fix compatibility issues. code now correctly compiles under both glibc & musl-libc systems --- common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common.h b/common.h index 23f35ac..aedf1af 100644 --- a/common.h +++ b/common.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -176,10 +176,10 @@ struct ip6_ext { /* following lines are copy from unistd.h in Linux for avoidance warnings in compilation */ #if defined(HAVE_SETRESGID) && !defined(_GNU_SOURCE) -extern int setresgid (__uid_t __ruid, __uid_t __euid, __uid_t __suid); +extern int setresgid (uid_t __ruid, uid_t __euid, uid_t __suid); #endif #if defined(HAVE_SETRESUID) && !defined(_GNU_SOURCE) -extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid); +extern int setresuid (uid_t __ruid, uid_t __euid, uid_t __suid); #endif #endif /* _SFD_COMMON_H */