From f3eddc769b2703bc3706d2e67fe7006ad0f32286 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 19 Sep 1998 03:53:11 +0000 Subject: [PATCH] More Posix Thread detection. --- configure | 689 ++++++++++++++++++++++++++++++++++-------- configure.in | 98 +++++- include/portable.h.in | 15 + 3 files changed, 661 insertions(+), 141 deletions(-) diff --git a/configure b/configure index 89b6a0b1db..9f0e2fb0d1 100755 --- a/configure +++ b/configure @@ -1672,26 +1672,99 @@ echo "$ac_t""$cf_cv_pthread_version" 1>&6 { echo "configure: error: unknown pthread version" 1>&2; exit 1; } fi + echo $ac_n "checking for LinuxThreads""... $ac_c" 1>&6 +echo "configure:1677: checking for LinuxThreads" >&5 +if eval "test \"`echo '$''{'cf_cv_linux_threads'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` + if test "$res" -gt 0 ; then + cf_cv_linux_threads=yes + else + cf_cv_linux_threads=no + fi + +fi + +echo "$ac_t""$cf_cv_linux_threads" 1>&6 + + if test $cf_cv_linux_threads = yes ; then + LTHREAD_DEFS="$LTHREAD_DEFS -DHAVE_LINUX_THREADS" + fi + - echo $ac_n "checking compiler for -pthread option""... $ac_c" 1>&6 -echo "configure:1678: checking compiler for -pthread option" >&5 + echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 +echo "configure:1699: checking for pthread_create" >&5 +if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_pthread_create) || defined (__stub___pthread_create) +choke me +#else +pthread_create(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_pthread_create=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_pthread_create=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'pthread_create`\" = yes"; then + echo "$ac_t""yes" 1>&6 + pthread_link=yes +else + echo "$ac_t""no" 1>&6 +pthread_link=no +fi + + + if test $pthread_link = no ; then + echo $ac_n "checking for pthread_create with -pthread""... $ac_c" 1>&6 +echo "configure:1750: checking for pthread_create with -pthread" >&5 if eval "test \"`echo '$''{'cf_cv_pthread_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="-pthread $CPPFLAGS" - cat > conftest.$ac_ext < conftest.$ac_ext < int main() { - if(0) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); - + if(0) pthread_create((pthread_t*) 0, + (pthread_attr_t*) 0, 0, 0); + ; return 0; } EOF -if { (eval echo configure:1695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_pthread_flag=yes else @@ -1701,21 +1774,382 @@ else cf_cv_pthread_flag=no fi rm -f conftest* - CPPFLAGS=$save_CPPFLAGS - + CPPFLAGS=$save_CPPFLAGS + fi echo "$ac_t""$cf_cv_pthread_flag" 1>&6 - if test $cf_cv_pthread_flag = yes ; then - LTHREAD_LIBS="$LTHREAD_LIBS -pthread" + if test $cf_cv_pthread_flag = yes ; then + LTHREAD_LIBS="$LTHREAD_LIBS -pthread" + pthread_link=yes + fi fi - + + if test $pthread_link = no ; then + save_LIBS="$LIBS" + echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:1793: checking for pthread_create in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + pthread_link=yes + LTHREAD_LIBS="$LTHREAD_LIBS -lpthread" +else + echo "$ac_t""no" 1>&6 +fi + + LIBS="$save_LIBS" + fi + + if test $pthread_link = no ; then + save_LIBS="$LIBS" + echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 +echo "configure:1840: checking for pthread_create in -lc_r" >&5 +ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lc_r $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + pthread_link=yes + LTHREAD_LIBS="$LTHREAD_LIBS -lc_r" +else + echo "$ac_t""no" 1>&6 +fi + + LIBS="$save_LIBS" + fi + + if test $pthread_link = no ; then + save_LIBS="$LIBS" + echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:1887: checking for pthread_create in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread -lmach -lexc -lc $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + pthread_link=yes + LTHREAD_DEFS="$LTHREAD_DEFS -DDEC_THREADS" + LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc" +else + echo "$ac_t""no" 1>&6 +fi + + LIBS="$save_LIBS" + fi + else LTHREAD_DEFS="-DNO_THREADS" fi fi +# check for strtok_r +save_LIBS="$LIBS" +LIBS="$save_LIBS $LTHREAD_LIBS" +echo $ac_n "checking for strtok_r in -lpthread""... $ac_c" 1>&6 +echo "configure:1941: checking for strtok_r in -lpthread" >&5 +ac_lib_var=`echo pthread'_'strtok_r | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + +if test $ac_cv_lib_pthread_strtok_r = no ; then + echo $ac_n "checking for strtok_r in -lc_r""... $ac_c" 1>&6 +echo "configure:1990: checking for strtok_r in -lc_r" >&5 +ac_lib_var=`echo c_r'_'strtok_r | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lc_r $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo c_r | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + for ac_func in strtok_r pthread_init +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2039: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + if test $ac_cv_lib_c_r_strtok_r = yes ; then + LTHREAD_LIBS="$LTHREAD_LIBS -lc_r" + fi +else + for ac_func in strtok_r +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2098: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +fi + +LIBS="$save_LIBS" + ldbm_use="none" LDBM_DEFS= @@ -1725,12 +2159,12 @@ if test "$SLAPD_LDBM" = "yes" ; then if test $ldbm_prefer = any -o $ldbm_prefer = dbbtree \ -o $ldbm_prefer = dbhash ; then echo $ac_n "checking for dbopen""... $ac_c" 1>&6 -echo "configure:1729: checking for dbopen" >&5 +echo "configure:2163: checking for dbopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dbopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_dbopen=yes" else @@ -1774,7 +2208,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6 -echo "configure:1778: checking for dbopen in -ldb" >&5 +echo "configure:2212: checking for dbopen in -ldb" >&5 ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1782,7 +2216,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldb $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1830,13 +2264,13 @@ fi fi echo $ac_n "checking for db2""... $ac_c" 1>&6 -echo "configure:1834: checking for db2" >&5 +echo "configure:2268: checking for db2" >&5 if eval "test \"`echo '$''{'cf_cv_db2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1870,17 +2304,17 @@ echo "$ac_t""$cf_cv_db2" 1>&6 do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1874: checking for $ac_hdr" >&5 +echo "configure:2308: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1884: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2318: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1921,7 +2355,7 @@ done if test $ldbm_prefer = any -o $ldbm_prefer = gdbm ; then echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6 -echo "configure:1925: checking for gdbm_open in -lgdbm" >&5 +echo "configure:2359: checking for gdbm_open in -lgdbm" >&5 ac_lib_var=`echo gdbm'_'gdbm_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1929,7 +2363,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgdbm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1968,7 +2402,7 @@ fi fi if test $ldbm_prefer = any -o $ldbm_prefer = ndbm ; then echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6 -echo "configure:1972: checking for dbm_open in -ldbm" >&5 +echo "configure:2406: checking for dbm_open in -ldbm" >&5 ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1976,7 +2410,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldbm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2025,7 +2459,7 @@ fi if test "$SLAPD_TCP_WRAPPERS" = "yes" ; then echo $ac_n "checking for hosts_access in -lwrap""... $ac_c" 1>&6 -echo "configure:2029: checking for hosts_access in -lwrap" >&5 +echo "configure:2463: checking for hosts_access in -lwrap" >&5 ac_lib_var=`echo wrap'_'hosts_access | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2033,7 +2467,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lwrap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2076,12 +2510,12 @@ LIBTERMCAP="-ltermcap" # FreeBSD (and others) have crypt(3) in -lcrypt if test "$SLAPD_CRYPT" = "yes" ; then echo $ac_n "checking for crypt""... $ac_c" 1>&6 -echo "configure:2080: checking for crypt" >&5 +echo "configure:2514: checking for crypt" >&5 if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_crypt=yes" else @@ -2123,7 +2557,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:2127: checking for crypt in -lcrypt" >&5 +echo "configure:2561: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2131,7 +2565,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2179,12 +2613,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:2183: checking for $ac_hdr that defines DIR" >&5 +echo "configure:2617: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -2192,7 +2626,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:2196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2630: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -2217,7 +2651,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:2221: checking for opendir in -ldir" >&5 +echo "configure:2655: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2225,7 +2659,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2258,7 +2692,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:2262: checking for opendir in -lx" >&5 +echo "configure:2696: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2266,7 +2700,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2300,12 +2734,12 @@ fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2304: checking for ANSI C header files" >&5 +echo "configure:2738: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2313,7 +2747,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2330,7 +2764,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2348,7 +2782,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2369,7 +2803,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2380,7 +2814,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -2404,12 +2838,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:2408: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2842: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2425,7 +2859,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2461,17 +2895,17 @@ for ac_hdr in \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2465: checking for $ac_hdr" >&5 +echo "configure:2899: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2475: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2909: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2499,12 +2933,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:2503: checking for uid_t in sys/types.h" >&5 +echo "configure:2937: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -2533,7 +2967,7 @@ EOF fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:2537: checking type of array argument to getgroups" >&5 +echo "configure:2971: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2541,7 +2975,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -2580,7 +3014,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF @@ -2604,12 +3038,12 @@ EOF echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:2608: checking for mode_t" >&5 +echo "configure:3042: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2637,12 +3071,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2641: checking for off_t" >&5 +echo "configure:3075: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2670,12 +3104,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2674: checking for pid_t" >&5 +echo "configure:3108: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2703,12 +3137,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2707: checking return type of signal handlers" >&5 +echo "configure:3141: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2725,7 +3159,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2744,12 +3178,12 @@ EOF echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2748: checking for size_t" >&5 +echo "configure:3182: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2777,12 +3211,12 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:2781: checking for uid_t in sys/types.h" >&5 +echo "configure:3215: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -2811,12 +3245,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:2815: checking for st_blksize in struct stat" >&5 +echo "configure:3249: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2824,7 +3258,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:2828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3262: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -2845,12 +3279,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:2849: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3283: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2859,7 +3293,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:2863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3297: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -2880,12 +3314,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2884: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:3318: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2893,7 +3327,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3331: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2915,12 +3349,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2919: checking for working const" >&5 +echo "configure:3353: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2991,7 +3425,7 @@ fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2995: checking for 8-bit clean memcmp" >&5 +echo "configure:3429: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2999,7 +3433,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -3027,12 +3461,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3031: checking return type of signal handlers" >&5 +echo "configure:3465: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3049,7 +3483,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3487: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3068,12 +3502,12 @@ EOF echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:3072: checking for strftime" >&5 +echo "configure:3506: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else @@ -3118,7 +3552,7 @@ else echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:3122: checking for strftime in -lintl" >&5 +echo "configure:3556: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3126,7 +3560,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3164,12 +3598,12 @@ fi fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:3168: checking for vprintf" >&5 +echo "configure:3602: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -3216,12 +3650,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:3220: checking for _doprnt" >&5 +echo "configure:3654: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -3269,7 +3703,7 @@ fi fi echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 -echo "configure:3273: checking for wait3 that fills in rusage" >&5 +echo "configure:3707: checking for wait3 that fills in rusage" >&5 if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3277,7 +3711,7 @@ else ac_cv_func_wait3_rusage=no else cat > conftest.$ac_ext < #include @@ -3308,7 +3742,7 @@ main() { } } EOF -if { (eval echo configure:3312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_wait3_rusage=yes else @@ -3344,16 +3778,17 @@ for ac_func in \ strtod \ strtol \ strtoul \ + strsep \ memcpy \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3352: checking for $ac_func" >&5 +echo "configure:3787: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3401,15 +3836,15 @@ fi done -for ac_func in strdup +for ac_func in strsep strdup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3408: checking for $ac_func" >&5 +echo "configure:3843: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3462,13 +3897,13 @@ done # Check Configuration echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:3466: checking declaration of sys_errlist" >&5 +echo "configure:3901: checking declaration of sys_errlist" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3478,7 +3913,7 @@ int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:3482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3917: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_dcl_sys_errlist=yes else @@ -3499,20 +3934,20 @@ if test $cf_cv_dcl_sys_errlist = no ; then EOF echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6 -echo "configure:3503: checking existence of sys_errlist" >&5 +echo "configure:3938: checking existence of sys_errlist" >&5 if eval "test \"`echo '$''{'cf_cv_have_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:3516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_have_sys_errlist=yes else diff --git a/configure.in b/configure.in index 54cfba2800..f1dd41b909 100644 --- a/configure.in +++ b/configure.in @@ -239,28 +239,97 @@ else AC_MSG_ERROR(unknown pthread version) fi + AC_CACHE_CHECK([for LinuxThreads], cf_cv_linux_threads, [ + res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` + if test "$res" -gt 0 ; then + cf_cv_linux_threads=yes + else + cf_cv_linux_threads=no + fi + ]) + + if test $cf_cv_linux_threads = yes ; then +dnl AC_DEFINE(HAVE_LINUX_THREADS,1) + LTHREAD_DEFS="$LTHREAD_DEFS -DHAVE_LINUX_THREADS" + fi + dnl Now the hard part, how to link - AC_CACHE_CHECK([compiler for -pthread option], cf_cv_pthread_flag,[ - dnl save the CPPFLAGS - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="-pthread $CPPFLAGS" - AC_TRY_LINK([#include ],[ - if(0) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); - ], cf_cv_pthread_flag=yes, cf_cv_pthread_flag=no) - dnl restore the CPPFLAGS - CPPFLAGS=$save_CPPFLAGS - ]) + dnl A few platforms have pthread support in standard libraries + AC_CHECK_FUNC(pthread_create,pthread_link=yes,pthread_link=no) + + if test $pthread_link = no ; then + dnl try -pthread + AC_CACHE_CHECK([for pthread_create with -pthread], + cf_cv_pthread_flag, [ + dnl save the CPPFLAGS + save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="-pthread $CPPFLAGS" + AC_TRY_LINK([#include ],[ + if(0) pthread_create((pthread_t*) 0, + (pthread_attr_t*) 0, 0, 0); + ], cf_cv_pthread_flag=yes, cf_cv_pthread_flag=no) + dnl restore the CPPFLAGS + CPPFLAGS=$save_CPPFLAGS + ]) + + if test $cf_cv_pthread_flag = yes ; then + LTHREAD_LIBS="$LTHREAD_LIBS -pthread" + pthread_link=yes + fi + fi - if test $cf_cv_pthread_flag = yes ; then - LTHREAD_LIBS="$LTHREAD_LIBS -pthread" + if test $pthread_link = no ; then + dnl try -lpthread + save_LIBS="$LIBS" + AC_CHECK_LIB(pthread, pthread_create, [ + pthread_link=yes + LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"]) + LIBS="$save_LIBS" fi - + + if test $pthread_link = no ; then + dnl try -lc_r + save_LIBS="$LIBS" + AC_CHECK_LIB(c_r, pthread_create, [ + pthread_link=yes + LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"]) + LIBS="$save_LIBS" + fi + + if test $pthread_link = no ; then + dnl try DEC Threads + save_LIBS="$LIBS" + AC_CHECK_LIB(pthread, pthread_create, [ + pthread_link=yes + LTHREAD_DEFS="$LTHREAD_DEFS -DDEC_THREADS" + LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc"],, + [-lmach -lexc -lc]) + LIBS="$save_LIBS" + fi + else LTHREAD_DEFS="-DNO_THREADS" fi fi +# check for strtok_r +save_LIBS="$LIBS" +LIBS="$save_LIBS $LTHREAD_LIBS" +AC_CHECK_LIB(pthread,strtok_r) + +if test $ac_cv_lib_pthread_strtok_r = no ; then + AC_CHECK_LIB(c_r,strtok_r) + AC_CHECK_FUNCS(strtok_r pthread_init) + if test $ac_cv_lib_c_r_strtok_r = yes ; then + LTHREAD_LIBS="$LTHREAD_LIBS -lc_r" + fi +else + AC_CHECK_FUNCS(strtok_r) +fi + +LIBS="$save_LIBS" + ldbm_use="none" LDBM_DEFS= @@ -429,10 +498,11 @@ AC_CHECK_FUNCS( \ strtod \ strtol \ strtoul \ + strsep \ memcpy \ ) -AC_REPLACE_FUNCS(strdup) +AC_REPLACE_FUNCS(strsep strdup) dnl ---------------------------------------------------------------- # Check Configuration diff --git a/include/portable.h.in b/include/portable.h.in index d3ca50a3ec..323964157c 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -97,6 +97,9 @@ /* Define if you have the mktime function. */ #undef HAVE_MKTIME +/* Define if you have the pthread_init function. */ +#undef HAVE_PTHREAD_INIT + /* Define if you have the select function. */ #undef HAVE_SELECT @@ -112,12 +115,18 @@ /* Define if you have the strrchr function. */ #undef HAVE_STRRCHR +/* Define if you have the strsep function. */ +#undef HAVE_STRSEP + /* Define if you have the strstr function. */ #undef HAVE_STRSTR /* Define if you have the strtod function. */ #undef HAVE_STRTOD +/* Define if you have the strtok_r function. */ +#undef HAVE_STRTOK_R + /* Define if you have the strtol function. */ #undef HAVE_STRTOL @@ -178,6 +187,12 @@ /* Define if you have the header file. */ #undef HAVE_UNISTD_H +/* Define if you have the c_r library (-lc_r). */ +#undef HAVE_LIBC_R + +/* Define if you have the pthread library (-lpthread). */ +#undef HAVE_LIBPTHREAD + #ifdef HAVE_STDDEF_H # include #endif -- 2.39.5