From 149e03c72ae112a1091bca9012e2a59de156e949 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 6 Apr 2020 11:43:55 +0200 Subject: [PATCH] configure: Add -ldl to default libs if necessary. Signed-off-by: Alexandre Julliard --- configure | 50 +++++++++++++++++++++++++++++--------------------- configure.ac | 6 +----- include/config.h.in | 3 --- include/wine/port.h | 5 +++++ libs/wine/Makefile.in | 2 +- 5 files changed, 36 insertions(+), 30 deletions(-) diff --git a/configure b/configure index 018fb1bfd75..116825768c4 100755 --- a/configure +++ b/configure @@ -629,7 +629,6 @@ LDAP_LIBS LDAP_CFLAGS RT_LIBS POLL_LIBS -DL_LIBS TOOLSEXT MSVCRTFLAGS EXCESS_PRECISION_CFLAGS @@ -17789,7 +17788,6 @@ for ac_func in \ __res_get_state \ __res_getservers \ _spawnvp \ - dlopen \ epoll_create \ ffs \ finitef \ @@ -17847,15 +17845,12 @@ done CFLAGS="$ac_save_CFLAGS" -if test "$ac_cv_func_dlopen" = no -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17874,24 +17869,38 @@ return dlopen (); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h - DL_LIBS="-ldl" +done +if ${ac_cv_search_dlopen+:} false; then : +else + ac_cv_search_dlopen=no fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi + ac_wine_check_funcs_save_LIBS="$LIBS" LIBS="$LIBS $DL_LIBS" for ac_func in dladdr @@ -20006,7 +20015,6 @@ NETAPI_LIBS = $NETAPI_LIBS VKD3D_CFLAGS = $VKD3D_CFLAGS VKD3D_LIBS = $VKD3D_LIBS EXCESS_PRECISION_CFLAGS = $EXCESS_PRECISION_CFLAGS -DL_LIBS = $DL_LIBS POLL_LIBS = $POLL_LIBS RT_LIBS = $RT_LIBS LDAP_CFLAGS = $LDAP_CFLAGS diff --git a/configure.ac b/configure.ac index 9bae6a5dda1..76d5d5ed727 100644 --- a/configure.ac +++ b/configure.ac @@ -2132,7 +2132,6 @@ AC_CHECK_FUNCS(\ __res_get_state \ __res_getservers \ _spawnvp \ - dlopen \ epoll_create \ ffs \ finitef \ @@ -2180,10 +2179,7 @@ AC_CHECK_FUNCS(\ CFLAGS="$ac_save_CFLAGS" dnl Check for -ldl -if test "$ac_cv_func_dlopen" = no -then - AC_CHECK_LIB(dl,dlopen,[AC_DEFINE(HAVE_DLOPEN,1) AC_SUBST(DL_LIBS,"-ldl")]) -fi +AC_SEARCH_LIBS(dlopen, dl) WINE_CHECK_LIB_FUNCS(dladdr,[$DL_LIBS]) dnl Check for -lpoll for Mac OS X/Darwin diff --git a/include/config.h.in b/include/config.h.in index b6da8d8684c..db9c7a1e7d9 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -110,9 +110,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H -/* Define to 1 if you have the `dlopen' function. */ -#undef HAVE_DLOPEN - /* Define to 1 if you have the header file. */ #undef HAVE_EGL_EGL_H diff --git a/include/wine/port.h b/include/wine/port.h index feb0558655d..8514a4a43bf 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -55,6 +55,11 @@ #define mkdir(path,mode) mkdir(path) +static inline void *dlopen(const char *name, int flags) { return NULL; } +static inline void *dlsym(void *handle, const char *name) { return NULL; } +static inline int dlclose(void *handle) { return 0; } +static inline const char *dlerror(void) { return "No dlopen support on Windows"; } + #ifdef _MSC_VER #define ftruncate chsize diff --git a/libs/wine/Makefile.in b/libs/wine/Makefile.in index 66ecf13c671..fe2a2b45e58 100644 --- a/libs/wine/Makefile.in +++ b/libs/wine/Makefile.in @@ -1,4 +1,4 @@ -EXTRALIBS = $(DL_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(I386_LIBS) +EXTRALIBS = $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(I386_LIBS) C_SRCS = \ c_037.c \ -- 2.11.4.GIT