r686: - Add SMB_EXT_LIB_FROM_PKGCONFIG()
authorJelmer Vernooij <jelmer@samba.org>
Thu, 13 May 2004 15:37:57 +0000 (15:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:53:42 +0000 (12:53 -0500)
- Build gregedit and registry_gconf again if the required libs are found (gconf and gtk)
(This used to be commit a63b704c36f2f5b52e932b6b2c99e7d664c9bdc7)

source4/aclocal.m4
source4/build/smb_build/public.m4
source4/lib/registry/config.m4

index 5d0d11cd5818fdaf0fbb49bcc998e57b3390bae9..4f42b50f84122d5d04f86a5fe983cc02b34f5832 100644 (file)
@@ -624,61 +624,5 @@ AC_DEFUN([AC_DISABLE_STATIC],
 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
 AC_ENABLE_STATIC(no)])
 
-
-dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
-dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
-dnl also defines GSTUFF_PKG_ERRORS on error
-AC_DEFUN(PKG_CHECK_MODULES, [
-  succeeded=no
-
-  if test -z "$PKG_CONFIG"; then
-    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-  fi
-
-  if test "$PKG_CONFIG" = "no" ; then
-     echo "*** The pkg-config script could not be found. Make sure it is"
-     echo "*** in your path, or set the PKG_CONFIG environment variable"
-     echo "*** to the full path to pkg-config."
-     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        AC_MSG_CHECKING(for $2)
-
-        if $PKG_CONFIG --exists "$2" ; then
-            AC_MSG_RESULT(yes)
-            succeeded=yes
-
-            AC_MSG_CHECKING($1_CFLAGS)
-            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
-            AC_MSG_RESULT($$1_CFLAGS)
-
-            AC_MSG_CHECKING($1_LIBS)
-            $1_LIBS=`$PKG_CONFIG --libs "$2"`
-            AC_MSG_RESULT($$1_LIBS)
-        else
-            $1_CFLAGS=""
-            $1_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but 
-            ## do set a variable so people can do so.
-            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
-            ifelse([$4], ,echo $$1_PKG_ERRORS,)
-        fi
-
-        AC_SUBST($1_CFLAGS)
-        AC_SUBST($1_LIBS)
-     else
-        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig"
-     fi
-  fi
-
-  if test $succeeded = yes; then
-     ifelse([$3], , :, [$3])
-  else
-     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
-  fi
-])
-
 sinclude(build/smb_build/public.m4)
 sinclude(build/smb_build/core.m4)
index 9bfcd549b84695c6f1dedb74c8198db16c720ff1..839c16f1a973479ba323a72d2ebc00631fa19c6a 100644 (file)
@@ -47,6 +47,11 @@ dnl          1:name,
 dnl            2:default_build
 dnl            )
 dnl
+dnl SMB_EXT_LIB_FROM_PKGCONFIG(
+dnl    1:name,
+dnl            2:pkg-config name
+dnl            )
+dnl
 dnl SMB_EXT_LIB(
 dnl            1:name,
 dnl            2:libs,
@@ -265,6 +270,49 @@ AC_DEFUN([SMB_EXT_LIB_ENABLE],
        [SMB_EXT_LIB_ENABLE_][$1]="$2"
 ])
 
+dnl SMB_EXT_LIB_FROM_PKGCONFIG(
+dnl            1:name,
+dnl            2:pkg-config name
+dnl )
+AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG], 
+[
+       dnl Figure out the correct variables and call SMB_EXT_LIB()
+
+    if test -z "$PKG_CONFIG"; then
+       AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+    fi
+
+    if test "$PKG_CONFIG" = "no" ; then
+       echo "*** The pkg-config script could not be found. Make sure it is"
+       echo "*** in your path, or set the PKG_CONFIG environment variable"
+       echo "*** to the full path to pkg-config."
+       echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+       else
+               if $PKG_CONFIG --atleast-pkgconfig-version 0.9.0; then
+               AC_MSG_CHECKING(for $2)
+
+               if $PKG_CONFIG --exists "$2" ; then
+               AC_MSG_RESULT(yes)
+
+                               SMB_EXT_LIB_ENABLE($1, YES)
+                               SMB_EXT_LIB($1, [`$PKG_CONFIG --libs-only-l $2`], 
+                                                     [`$PKG_CONFIG --cflags-only-other $2`],
+                                                         [`$PKG_CONFIG --cflags-only-I $2`],
+                                                         [`$PKG_CONFIG --libs-only-other $2`])
+
+                               # FIXME: Dirty hack
+                               CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $2`"
+               else
+                               AC_MSG_RESULT(no)
+               $PKG_CONFIG --errors-to-stdout --print-errors $2
+               fi
+       else
+               echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+               echo "*** See http://www.freedesktop.org/software/pkgconfig"
+       fi
+       fi
+])
+
 dnl SMB_EXT_LIB(
 dnl            1:name,
 dnl            2:libs,
index 7aafd2af71fae00943f33ab9a749eaf03bfc7311..da2c84d5c67e1e9200e42a6901d1c176ac2bb89f 100644 (file)
@@ -5,22 +5,28 @@ if test t$BLDSHARED = ttrue; then
 fi
 LIBWINREG=libwinregistry
 
-#disable registry_gconf for now
-PKG_CHECK_MODULES(GCONF, gconf-2.0, [ SMB_MODULE_DEFAULT(registry_gconf,NOT)
-                               CFLAGS="$CFLAGS $GCONF_CFLAGS";], [AC_MSG_WARN([GConf not found, not building registry_gconf])])
 AC_CONFIG_FILES(lib/registry/winregistry.pc)
 
-SMB_BINARY_ENABLE(gregedit,NO)
+SMB_BINARY_ENABLE(gregedit, NO)
+SMB_MODULE_DEFAULT(registry_gconf, NOT)
 
-#disable grpedit for now
-PKG_CHECK_MODULES(GTK, glib-2.0 gtk+-2.0, [ SMB_BINARY_ENABLE(gregedit,NO)
-                               CFLAGS="$CFLAGS $GTK_CFLAGS"; ], [ AC_MSG_WARN([Will be unable to build gregedit])])
+SMB_EXT_LIB_FROM_PKGCONFIG(gconf, gconf-2.0)
+
+if test t$SMB_EXT_LIB_ENABLE_gconf = tYES; then
+       SMB_MODULE_DEFAULT(registry_gconf, STATIC)
+fi
+
+SMB_EXT_LIB_FROM_PKGCONFIG(gtk, [glib-2.0 gtk+-2.0])
+
+if test t$SMB_EXT_LIB_ENABLE_gtk = tYES; then
+       SMB_BINARY_ENABLE(gregedit, YES)
+fi
 
 SMB_MODULE(registry_nt4, REGISTRY, STATIC, lib/registry/reg_backend_nt4/reg_backend_nt4.o)
 SMB_MODULE(registry_w95, REGISTRY, STATIC, lib/registry/reg_backend_w95/reg_backend_w95.o)
 SMB_MODULE(registry_dir, REGISTRY, STATIC, lib/registry/reg_backend_dir/reg_backend_dir.o)
 SMB_MODULE(registry_rpc, REGISTRY, STATIC, lib/registry/reg_backend_rpc/reg_backend_rpc.o,[],[],[LIBSMB])
-SMB_MODULE(registry_gconf, REGISTRY, NOT, lib/registry/reg_backend_gconf/reg_backend_gconf.o)
+SMB_MODULE(registry_gconf, REGISTRY, STATIC, lib/registry/reg_backend_gconf/reg_backend_gconf.o, [], [gconf])
 SMB_MODULE(registry_ldb, REGISTRY, NOT, lib/registry/reg_backend_ldb/reg_backend_ldb.o,[],[],[LIBLDB])
 SMB_SUBSYSTEM(REGISTRY,lib/registry/common/reg_interface.o,
        [lib/registry/common/reg_objects.o lib/registry/common/reg_util.o],
@@ -31,4 +37,5 @@ SMB_BINARY(regdiff, [REG], [BIN], lib/registry/tools/regdiff.o,[],[CONFIG LIBBAS
 SMB_BINARY(regpatch, [REG], [BIN], lib/registry/tools/regpatch.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY])
 SMB_BINARY(regshell, [REG], [BIN], lib/registry/tools/regshell.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY])
 SMB_BINARY(regtree, [REG], [BIN], lib/registry/tools/regtree.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY])
-SMB_BINARY(gregedit, [REG], [BIN], lib/registry/tools/gregedit.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY])
+SMB_BINARY(gregedit, [REG], [BIN], lib/registry/tools/gregedit.o,[gtk],[CONFIG LIBBASIC LIBCMDLINE REGISTRY])
+