]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
open-vm-tools: check for libproc.so, scrnsaver.h
authorVMware, Inc <>
Thu, 17 Dec 2009 21:41:14 +0000 (13:41 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 17 Dec 2009 21:41:14 +0000 (13:41 -0800)
. 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 <mvanzin@vmware.com>
open-vm-tools/configure.ac
open-vm-tools/m4/vmtools.m4

index 41fea3c79c316f6c2dabeb37fdc419ea55c47193..f27adf882bce7c8a35844d7c75275c8d88159ca4 100644 (file)
 #
 # 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
index dfdced78a393643731a19e9f10bb003f5f09ac21..49a1a564d5279a363f7df92300b6976a738875ce 100644 (file)
@@ -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)
 #