From: Roy Marples Date: Sun, 23 Mar 2014 13:38:09 +0000 (+0000) Subject: glibc 2.17 has clock_gettime in libc directly, so test for it. X-Git-Tag: v6.4.0~130 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af231ff80c5b983091e5df49af90376652e06d97;p=thirdparty%2Fdhcpcd.git glibc 2.17 has clock_gettime in libc directly, so test for it. test for dlopen being in libc as well. --- diff --git a/configure b/configure index 726b48e7..5c84c605 100755 --- a/configure +++ b/configure @@ -340,7 +340,6 @@ linux*) fi echo "DHCPCD_SRCS+= if-linux.c if-linux-wireless.c" >>$CONFIG_MK echo "DHCPCD_SRCS+= platform-linux.c" >>$CONFIG_MK - echo "LDADD+= -lrt -ldl" >>$CONFIG_MK ;; kfreebsd*) echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK @@ -349,7 +348,6 @@ kfreebsd*) fi echo "DHCPCD_SRCS+= if-bsd.c platform-bsd.c" >>$CONFIG_MK echo "COMPAT_SRCS+= compat/linkaddr.c" >>$CONFIG_MK - echo "LDADD+= -lrt -ldl" >>$CONFIG_MK ;; *) if [ -z "$INET" -o "$INET" = yes ]; then @@ -401,6 +399,27 @@ fi rm -f _getifaddrs.c _getifaddrs $abort && exit 1 +printf "Testing for clock_gettime ... " +cat <_clock_gettime.c +#include +int main(void) { + struct timespec ts; + return clock_gettime(CLOCK_MONOTONIC, &ts); +} +EOF +if $XCC _clock_gettime.c -o _clock_gettime 2>/dev/null; then + echo "yes" +elif $XCC _clock_gettime.c -lrt -o _clock_gettime 2>/dev/null; then + echo "yes (-lrt)" + echo "LDADD+= -lrt" >>$CONFIG_MK +else + echo "no" + echo "libc support for clock_getttime is required - aborting" >&2 + abort=true +fi +rm -f _clock_gettime.c _clockgettime +$abort && exit 1 + if [ -z "$ARC4RANDOM" ]; then printf "Testing for arc4random ... " cat <_arc4random.c @@ -751,6 +770,27 @@ if [ "$DEV" = yes ]; then echo "DHCPCD_SRCS+= dev.c" >>$CONFIG_MK echo "CPPFLAGS+= -DPLUGIN_DEV" >>$CONFIG_MK echo "MKDIRS+= dev" >>$CONFIG_MK + + printf "Testing for dlopen ... " + cat <_dlopen.c +#include +#include +int main(void) { + dlopen(NULL, 0); + return 0; +} +EOF + if $XCC _dlopen.c -o _dlopen 2>/dev/null; then + echo "yes" + elif $XCC _dlopen.c -ldl -o _dlopen 2>/dev/null; then + echo "yes (-ldl)" + echo "LDADD+= -ldl" >>$CONFIG_MK + else + echo "no" + echo "libc for dlopen is required - aborting" + fi + rm -f _dlopen.c _dlopen + $abort && exit 1 fi # Transform for a make file