build: extend SMB_LIBRARY() to optionally take default value.
authorMichael Adam <obnox@samba.org>
Mon, 7 Jul 2008 11:55:31 +0000 (13:55 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 14 Aug 2008 13:00:07 +0000 (15:00 +0200)
The default value defaults to "yes".
If no is specified, an optional third argument contains the
reason why building of the shared library is turned off by default.

Michael
(cherry picked from commit af971f79c7d736eb5b7ae8fcd4b2bf7ccf4834f3)

source/m4/aclocal.m4

index 25f9912befe9e55a3c3b8a703fa56cdf95f5cf1a..d63d12145581f1eae454bd1b05e1ffb8276b2220 100644 (file)
@@ -54,7 +54,7 @@ AC_DEFUN(SMB_SUBSYSTEM,
 ])
 
 
-dnl SMB_LIBRARY(name)
+dnl SMB_LIBRARY(name, default)
 dnl
 dnl configure build and use of an (internal) shared library
 dnl
@@ -81,6 +81,32 @@ AC_SUBST([INSTALL_]LIBUC)
 AC_SUBST([UNINSTALL_]LIBUC)
 
 AC_MSG_CHECKING([whether to build the LIBNAME shared library])
+m4_if([$2], [no], [
+dnl set the default to not build the shared lib
+AC_ARG_WITH(LIBNAME,
+AS_HELP_STRING([--with-]LIBNAME,
+       m4_if([$3], [],
+               [Build the LIBNAME shared library (default=no)],
+               [Build the LIBNAME shared library (default=no ($3))])),
+[
+case "$withval" in
+       yes)
+               build_lib=yes
+               ;;
+       *)
+               AC_MSG_RESULT(yes)
+               build_lib=no
+               ;;
+esac
+],
+[
+# if unspecified, default is not to build
+AC_MSG_RESULT(yes)
+build_lib=no
+]
+)
+],[
+dnl by default, try to build the shared lib
 AC_ARG_WITH(LIBNAME,
 AS_HELP_STRING([--with-]LIBNAME,
        [Build the LIBNAME shared library (default=yes if shared libs supported)]),
@@ -100,6 +126,7 @@ esac
 build_lib=yes
 ]
 )
+])
 
 if eval test x"$build_lib" = "xyes" ; then
        # only set the install targets if the user chose the library