diff --git a/configure.ac b/configure.ac index 940e39c0f5b..077afdeb478 100644 --- a/configure.ac +++ b/configure.ac @@ -1007,11 +1007,17 @@ AC_SUBST([GETOPT_PATH]) dnl =============================================== dnl Libraries dnl =============================================== -AC_CHECK_LIB(socket, socket) dnl -lsocket -AC_CHECK_LIB(c, dlopen) dnl if dlopen is in libc... -AC_CHECK_LIB(dl, dlopen) dnl -ldl (for Linux) +AC_SEARCH_LIBS([socket], [socket]) + +save_LIBS="$LIBS" +DL_LIBS="" +LIBS="" +AC_SEARCH_LIBS([dlopen], [dl], + [test "$ac_cv_search_dlopen" = "none required" || DL_LIBS="$LIBS"]) +AC_SUBST(DL_LIBS) +LIBS="$save_LIBS" + AC_CHECK_LIB(rt, sched_getscheduler) dnl -lrt (for Tru64) -AC_CHECK_LIB(gnugetopt, getopt_long) dnl -lgnugetopt ( if available ) AC_CHECK_LIB(pam, pam_start) dnl -lpam (if available) PKG_CHECK_MODULES([UUID], [uuid], @@ -1032,15 +1038,6 @@ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.42.0], # Check whether high-resolution sleep function is available AC_CHECK_FUNCS([nanosleep usleep]) -# -# Where is dlopen? -# -AS_IF([test x"$ac_cv_lib_c_dlopen" = x"yes"], - [LIBADD_DL=""], - [test x"$ac_cv_lib_dl_dlopen" = x"yes"], - [LIBADD_DL=-ldl], - [LIBADD_DL=${lt_cv_dlopen_libs}]) - PKG_CHECK_MODULES(LIBXML2, [libxml-2.0 >= 2.9.2], [CPPFLAGS="${CPPFLAGS} ${LIBXML2_CFLAGS}" LIBS="${LIBS} ${LIBXML2_LIBS}"]) diff --git a/lib/common/Makefile.am b/lib/common/Makefile.am index 626c30c6099..e6142db3342 100644 --- a/lib/common/Makefile.am +++ b/lib/common/Makefile.am @@ -35,15 +35,13 @@ libcrmcommon_la_LDFLAGS = -version-info 47:1:13 libcrmcommon_la_CFLAGS = $(CFLAGS_HARDENED_LIB) libcrmcommon_la_LDFLAGS += $(LDFLAGS_HARDENED_LIB) -libcrmcommon_la_LIBADD = @LIBADD_DL@ - # If configured with --with-profiling or --with-coverage, BUILD_PROFILING will # be set and -fno-builtin will be added to the CFLAGS. However, libcrmcommon # uses the fabs() function which is normally supplied by gcc as one of its # builtins. Therefore we need to explicitly link against libm here or the # tests won't link. if BUILD_PROFILING -libcrmcommon_la_LIBADD += -lm +libcrmcommon_la_LIBADD = -lm endif ## Library sources (*must* use += format for bumplibs) diff --git a/lib/fencing/Makefile.am b/lib/fencing/Makefile.am index 512e908444c..7bd9f25c7a0 100644 --- a/lib/fencing/Makefile.am +++ b/lib/fencing/Makefile.am @@ -21,6 +21,7 @@ libstonithd_la_LDFLAGS += $(LDFLAGS_HARDENED_LIB) libstonithd_la_LIBADD = $(top_builddir)/lib/services/libcrmservice.la libstonithd_la_LIBADD += $(top_builddir)/lib/common/libcrmcommon.la +libstonithd_la_LIBADD += @DL_LIBS@ ## Library sources (*must* use += format for bumplibs) libstonithd_la_SOURCES = st_actions.c diff --git a/lib/pacemaker-fencing.pc.in b/lib/pacemaker-fencing.pc.in index 30191caed0a..39710d9dc8d 100644 --- a/lib/pacemaker-fencing.pc.in +++ b/lib/pacemaker-fencing.pc.in @@ -11,4 +11,4 @@ Requires.private: glib-2.0 libxml-2.0 Conflicts: Cflags: -I${includedir} Libs: -L${libdir} -l${sub} -Libs.private: +Libs.private: @DL_LIBS@ diff --git a/lib/pacemaker.pc.in b/lib/pacemaker.pc.in index adf7e416f04..be9a8d64497 100644 --- a/lib/pacemaker.pc.in +++ b/lib/pacemaker.pc.in @@ -29,4 +29,4 @@ Requires.private: glib-2.0 libxslt libxml-2.0 uuid gnutls Conflicts: Cflags: -I${includedir} Libs: -L${libdir} -l${sub} -Libs.private: @LIBADD_DL@ -lbz2 +Libs.private: -lbz2