>From 9ad3c1032c3bac5f2e391c418324f26ee8abbe2d Mon Sep 17 00:00:00 2001 From: Eric Le Bihan Date: Thu, 11 Aug 2016 19:57:09 +0200 Subject: [PATCH] configure: rework posix_spawn() detection As uclibc-ng provides posix_spawn() in librt, rework the detection of this function in the ./configure script to handle this situation. --- configure | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/configure b/configure index e4a1866..5320e41 100755 --- a/configure +++ b/configure @@ -450,6 +450,37 @@ EOF echo ' ... no' fi + echo "Checking whether system has posix_spawn()..." + hasposixspawn=true + if $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -c -o tryposixspawn.o src/sysdeps/tryposixspawn.c 2>/dev/null ; then + if $CC_AUTO $CFLAGS_AUTO $LDFLAGS_AUTO -o /dev/null tryposixspawn.o 2>/dev/null ; then + rt_lib= + echo " ... yes" + elif $CC_AUTO $CFLAGS_AUTO $LDFLAGS_AUTO -o /dev/null tryposixspawn.o -lrt 2>/dev/null ; then + rt_lib=-lrt + echo " ... yes, with -lrt" + else + hasposixspawn=false + fi + rm -f tryposixspawn.o + else + hasposixspawn=false + fi + if $hasposixspawn ; then + rm -f tryposixspawn + if test "$rt_lib" = "-lrt" ; then + if ! grep -q "\-lrt" $sysdeps/rt.lib; then + echo "-lrt" > $sysdeps/rt.lib + fi + fi + echo 'posixspawn: yes' >> $sysdeps/sysdeps + echo "#define ${package_macro_name}_HASPOSIXSPAWN" >> $sysdeps/sysdeps.h + else + echo 'posixspawn: no' >> $sysdeps/sysdeps + echo "#undef ${package_macro_name}_HASPOSIXSPAWN" >> $sysdeps/sysdeps.h + echo ' ... no' + fi + echo "Checking system endianness..." $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -o tryendianness src/sysdeps/tryendianness.c endianness=$(./tryendianness) || fail "$0: unable to determine endianness" @@ -480,7 +511,6 @@ EOF choose cl openat OPENAT 'openat()' choose cl linkat LINKAT 'linkat()' choose clr pipe2 PIPE2 'pipe2()' - choose cl posixspawn POSIXSPAWN 'posix_spawn()' $rt_lib choose clr ppoll PPOLL 'ppoll()' choose cl revoke REVOKE 'revoke()' choose cl sendfile SENDFILE 'sendfile()' -- 2.4.11