From 1089260f29fe9341a66a5be27670c8fcd81a2326 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 15 Aug 2006 11:41:59 +0200 Subject: [PATCH] configure: Only link against libpoll where really necessary. --- configure | 181 ++++++++++++++++++----------------- configure.ac | 8 +- dlls/kernel/Makefile.in | 2 +- dlls/ws2_32/Makefile.in | 1 + include/config.h.in | 6 +- programs/winedbg/Makefile.in | 1 + server/Makefile.in | 1 + 7 files changed, 106 insertions(+), 94 deletions(-) diff --git a/configure b/configure index 847cb4ffb7d..10c6b502501 100755 --- a/configure +++ b/configure @@ -756,6 +756,7 @@ SOCKETLIBS MAIN_BINARY EXTRA_BINARIES LDD +LIBPOLL LIBOBJS LTLIBOBJS' ac_subst_files='MAKE_RULES @@ -7777,93 +7778,6 @@ _ACEOF fi - -{ echo "$as_me:$LINENO: checking for poll in -lpoll" >&5 -echo $ECHO_N "checking for poll in -lpoll... $ECHO_C" >&6; } -if test "${ac_cv_lib_poll_poll+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpoll $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char poll (); -int -main () -{ -return poll (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_poll_poll=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_poll_poll=no -fi - -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_poll_poll" >&5 -echo "${ECHO_T}$ac_cv_lib_poll_poll" >&6; } -if test $ac_cv_lib_poll_poll = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBPOLL 1 -_ACEOF - - LIBS="-lpoll $LIBS" - -fi - { echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; } if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then @@ -19404,6 +19318,7 @@ fi + for ac_func in \ @@ -19447,6 +19362,7 @@ for ac_func in \ memmove \ mmap \ pclose \ + poll \ popen \ prctl \ pread \ @@ -19583,6 +19499,94 @@ fi done +if test "$ac_cv_func_poll" = no +then + { echo "$as_me:$LINENO: checking for poll in -lpoll" >&5 +echo $ECHO_N "checking for poll in -lpoll... $ECHO_C" >&6; } +if test "${ac_cv_lib_poll_poll+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpoll $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char poll (); +int +main () +{ +return poll (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_poll_poll=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_poll_poll=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_poll_poll" >&5 +echo "${ECHO_T}$ac_cv_lib_poll_poll" >&6; } +if test $ac_cv_lib_poll_poll = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_POLL 1 +_ACEOF + LIBPOLL="-lpoll" + +fi + +fi { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 @@ -25532,11 +25536,12 @@ SOCKETLIBS!$SOCKETLIBS$ac_delim MAIN_BINARY!$MAIN_BINARY$ac_delim EXTRA_BINARIES!$EXTRA_BINARIES$ac_delim LDD!$LDD$ac_delim +LIBPOLL!$LIBPOLL$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 77; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index 1c8477d4547..e530ff4fae6 100644 --- a/configure.ac +++ b/configure.ac @@ -144,8 +144,6 @@ dnl Check for -lresolv for Solaris AC_CHECK_FUNCS(inet_aton,,AC_CHECK_LIB(resolv,inet_aton)) dnl Check for -lxpg4 for FreeBSD AC_CHECK_LIB(xpg4,_xpg4_setrunelocale) -dnl Check for -lpoll for Mac OS X/Darwin -AC_CHECK_LIB(poll,poll) dnl Check for -lpthread AC_CHECK_LIB(pthread,pthread_create,AC_SUBST(LIBPTHREAD,"-lpthread")) @@ -1304,6 +1302,7 @@ AC_CHECK_FUNCS(\ memmove \ mmap \ pclose \ + poll \ popen \ prctl \ pread \ @@ -1332,6 +1331,11 @@ AC_CHECK_FUNCS(\ waitpid \ ) +dnl Check for -lpoll for Mac OS X/Darwin +if test "$ac_cv_func_poll" = no +then + AC_CHECK_LIB(poll,poll,[AC_DEFINE(HAVE_POLL,1) AC_SUBST(LIBPOLL,"-lpoll")]) +fi dnl **** Check for types **** diff --git a/dlls/kernel/Makefile.in b/dlls/kernel/Makefile.in index dd71a6ff972..b64c23ca220 100644 --- a/dlls/kernel/Makefile.in +++ b/dlls/kernel/Makefile.in @@ -6,7 +6,7 @@ VPATH = @srcdir@ MODULE = kernel32.dll IMPORTLIB = libkernel32.$(IMPLIBEXT) IMPORTS = ntdll -EXTRALIBS = @COREFOUNDATIONLIB@ +EXTRALIBS = @COREFOUNDATIONLIB@ @LIBPOLL@ BASEADDRESS = 0x7b800000 SPEC_SRCS16 = \ diff --git a/dlls/ws2_32/Makefile.in b/dlls/ws2_32/Makefile.in index 096243486c8..d3b58b6bdf1 100644 --- a/dlls/ws2_32/Makefile.in +++ b/dlls/ws2_32/Makefile.in @@ -7,6 +7,7 @@ MODULE = ws2_32.dll IMPORTLIB = libws2_32.$(IMPLIBEXT) IMPORTS = iphlpapi kernel32 ntdll DELAYIMPORTS = user32 +EXTRALIBS = @LIBPOLL@ C_SRCS = \ async.c \ diff --git a/include/config.h.in b/include/config.h.in index 5cb73843e2e..129baaf49c1 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -320,9 +320,6 @@ /* Define to 1 if you have the `ossaudio' library (-lossaudio). */ #undef HAVE_LIBOSSAUDIO -/* Define to 1 if you have the `poll' library (-lpoll). */ -#undef HAVE_LIBPOLL - /* Define to 1 if you have the `resolv' library (-lresolv). */ #undef HAVE_LIBRESOLV @@ -503,6 +500,9 @@ /* Define to 1 if the system has the type `pid_t'. */ #undef HAVE_PID_T +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + /* Define to 1 if you have the header file. */ #undef HAVE_POLL_H diff --git a/programs/winedbg/Makefile.in b/programs/winedbg/Makefile.in index 480f025b26e..79b71d3e5e7 100644 --- a/programs/winedbg/Makefile.in +++ b/programs/winedbg/Makefile.in @@ -6,6 +6,7 @@ MODULE = winedbg.exe APPMODE = -mconsole IMPORTS = psapi dbghelp advapi32 kernel32 ntdll DELAYIMPORTS = user32 +EXTRALIBS = @LIBPOLL@ C_SRCS = \ be_alpha.c \ diff --git a/server/Makefile.in b/server/Makefile.in index 4e35fcfc2e4..afa6539c6b4 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -4,6 +4,7 @@ TOPOBJDIR = .. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = none +EXTRALIBS = @LIBPOLL@ C_SRCS = \ atom.c \