From: VMware, Inc <> Date: Thu, 17 Dec 2009 21:41:14 +0000 (-0800) Subject: open-vm-tools: check for libproc.so, scrnsaver.h X-Git-Tag: 2009.12.16-217847~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b2303020773c13d42e09bb1ba55a88afa312a22;p=thirdparty%2Fopen-vm-tools.git open-vm-tools: check for libproc.so, scrnsaver.h . some newer distros apparently started to ship procps 3.2.8, so try to link against libproc.so and, only if that fails, try libproc-3.2.7.so. For other cases the user will have to manually intervene. . check for scrnsaver.h being there since our code includes it (and add a macro that simplifies doing that check for X11 libraries). Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac index 41fea3c79..f27adf882 100644 --- a/open-vm-tools/configure.ac +++ b/open-vm-tools/configure.ac @@ -29,6 +29,10 @@ # # The following libraries are currently tested: DNET, FUSE, GLIB2, GMODULE, # GOBJECT, GTHREAD, GTK, GTKMM, ICU, LIBPNG, PAM, PROCPS, URIPARSER, ZLIB +# +# For the procps library: you can provide the name of the procps library on +# your system by defining CUSTOM_PROCPS_NAME. By default the configure script +# will try both "-lproc" and "-lproc-3.2.7". ################################################################################ ### @@ -461,16 +465,14 @@ else # libraries. if test "$enable_unity" != "no"; then - # Unity needs the X11 Screen Saver extension library. It should be + # Unity needs the X11 Screen Saver extension library. It should be # in the same place as the X11 libraries, so no need for any fancy # path checking. - AC_CHECK_LIB( - [Xss], - [XScreenSaverQueryExtension], - [COMMON_XLIBS="-lXss $COMMON_XLIBS"], - [AC_MSG_ERROR( - [libXss not found. Please configure without Unity (using --disable-unity) or install the libXss devel package.])], - [$COMMON_XLIBS]) + AC_VMW_CHECK_X11_LIB( + [Xss], + [X11/extensions/scrnsaver.h], + [XScreenSaverQueryExtension], + [AC_MSG_ERROR([libXss or headers not found. Please configure without Unity (using --disable-unity) or install the libXss devel package.])]) # Check for the uriparser library and headers. The upstream uriparser # doesn't appear to ship with either a pkg-config file or a @@ -630,20 +632,48 @@ else fi if test "$with_procps" = "yes"; then - # XXX: Force CUSTOM_PROCPS_LIBS to have something so that AC_VMW_CHECK_LIB - # properly performs the library check. + if test -z "$CUSTOM_PROCPS_NAME"; then + CUSTOM_PROCPS_NAME=proc + fi + + # XXX: no pkg-config and no procps-config means we need to + # hard-code a sensible default. if test -z "$CUSTOM_PROCPS_LIBS"; then CUSTOM_PROCPS_LIBS="-L/lib" fi - AC_VMW_CHECK_LIB([proc-3.2.7], + + # Some distros provide libproc-${version}.so only, others provide the + # libproc.so symlink. Try both to see what sticks (but only try the 3.2.7 + # version - adding every possible version here would be a mess). + # + # Users can help by providing CUSTOM_PROCPS_NAME / CUSTOM_PROCPS_LIBS if + # necessary. + have_procps=no + + AC_VMW_CHECK_LIB([$CUSTOM_PROCPS_NAME], [PROCPS], [], [], [], [], [getstat], - [VMWARE_USER_LDADD="$VMWARE_USER_LDADD $PROCPS_LIBS"], - [AC_MSG_ERROR([libproc not found. Please configure without procps (using --without-procps) or install procps - http://procps.sourceforge.net])]) + [ + have_procps=yes; + VMWARE_USER_LDADD="$VMWARE_USER_LDADD $PROCPS_LIBS" + ], + []) + + if test "$have_procps" = "no"; then + AC_VMW_CHECK_LIB([proc-3.2.7], + [PROCPS], + [], + [], + [], + [], + [getstat], + [VMWARE_USER_LDADD="$VMWARE_USER_LDADD $PROCPS_LIBS"], + [AC_MSG_ERROR([libproc not found. Please configure without procps (using --without-procps) or install procps - http://procps.sourceforge.net])]) + fi fi if test "$with_procps" != "yes"; then diff --git a/open-vm-tools/m4/vmtools.m4 b/open-vm-tools/m4/vmtools.m4 index dfdced78a..49a1a564d 100644 --- a/open-vm-tools/m4/vmtools.m4 +++ b/open-vm-tools/m4/vmtools.m4 @@ -64,12 +64,13 @@ AC_DEFUN([AC_VMW_CHECK_LIB],[ ac_vmw_have_lib=0 ac_vmw_have_lib_func=0 ac_vmw_have_lib_header=0 + ac_vmw_custom_libs= # # First, try any user-defined CUSTOM_* flags. # if test -n "${CUSTOM_$2_CPPFLAGS}" || test -n "${CUSTOM_$2_LIBS}"; then - CUSTOM_$2_LIBS="${CUSTOM_$2_LIBS} -l$1" + ac_vmw_custom_libs="${CUSTOM_$2_LIBS} -l$1" if test -n "$6"; then ORIGINAL_CPPFLAGS="$CPPFLAGS" CPPFLAGS="${CUSTOM_$2_CPPFLAGS} $CPPFLAGS" @@ -96,12 +97,12 @@ AC_DEFUN([AC_VMW_CHECK_LIB],[ [$ac_vmw_function], [ac_vmw_have_lib_func=1], [], - [${CUSTOM_$2_LIBS}]) + [$ac_vmw_custom_libs]) fi if test $ac_vmw_have_lib_func -eq 1 && test $ac_vmw_have_lib_header -eq 1; then $2_CPPFLAGS="${CUSTOM_$2_CPPFLAGS}" - $2_LIBS="${CUSTOM_$2_LIBS}" + $2_LIBS="$ac_vmw_custom_libs" ac_vmw_have_lib=1 fi fi @@ -209,6 +210,44 @@ AC_DEFUN([AC_VMW_CHECK_LIBXX],[ ]) +# +# AC_VMW_CHECK_X11_LIB(library, header, function, action-if-not-found) +# +# Special handling for X11 library checking. This macro checks that both the +# library provides the given function, and that the header exists, making use +# of COMMON_XLIBS when linking. On success, it modifies COMMON_XLIBS to include +# the library. +# +# library ($1): library name (value passed to ld with -l) +# header ($2): header file to look for, may be empty. +# function ($3): function to look for in the library. +# action-if-not-found ($4): code to execute if failed to find the library. +# +# +AC_DEFUN([AC_VMW_CHECK_X11_LIB],[ + have_header=1 + if test -n "$2"; then + AC_CHECK_HEADER( + [X11/extensions/scrnsaver.h], + [], + [ + $have_header=0; + ${action-if-not-found} + ], + []) + fi + + if test $have_header = 1; then + AC_CHECK_LIB( + [$1], + [$3], + [COMMON_XLIBS="-l$1 $COMMON_XLIBS"], + [${action-if-not-found}], + [$COMMON_XLIBS]) + fi +]) + + # # AC_VMW_LIB_ERROR(library, disable) #