From d29c816b6195f9d1ef394830a6438123a0fb3afd Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 21 Feb 2008 12:55:52 +0100 Subject: configure: Abstract configuration of internal libs into an m4 macro. New subsystem libraries can now be added by specifying SMB_LIBRARY(name). Michael (This used to be commit 54d73769c49eb87ecb33e3229a01214972b53858) --- source3/configure.in | 170 ++++++++++++++------------------------------------- 1 file changed, 45 insertions(+), 125 deletions(-) (limited to 'source3/configure.in') diff --git a/source3/configure.in b/source3/configure.in index 6627ee6dc8..14110da52b 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -83,18 +83,6 @@ AC_SUBST(UNINSTALL_LIBADDNS) AC_SUBST(LIBADDNS_SHARED) AC_SUBST(LIBADDNS) -AC_SUBST(LIBTALLOC_STATIC_TARGET) -AC_SUBST(LIBTALLOC_SHARED_TARGET) -AC_SUBST(LIBTALLOC_SHARED) -AC_SUBST(LIBTALLOC_STATIC) -AC_SUBST(LIBTALLOC_LIBS) - -AC_SUBST(LIBTDB_STATIC_TARGET) -AC_SUBST(LIBTDB_SHARED_TARGET) -AC_SUBST(LIBTDB_SHARED) -AC_SUBST(LIBTDB_STATIC) -AC_SUBST(LIBTDB_LIBS) - AC_SUBST(INSTALL_LIBWBCLIENT) AC_SUBST(UNINSTALL_LIBWBCLIENT) AC_SUBST(LIBWBCLIENT_SHARED) @@ -113,12 +101,6 @@ AC_SUBST(UNINSTALL_LIBSMBSHAREMODES) AC_SUBST(LIBSMBSHAREMODES_SHARED) AC_SUBST(LIBSMBSHAREMODES) -AC_SUBST(LIBNETAPI_SHARED_TARGET) -AC_SUBST(LIBNETAPI_STATIC_TARGET) -AC_SUBST(LIBNETAPI_SHARED) -AC_SUBST(LIBNETAPI_STATIC) -AC_SUBST(LIBNETAPI_LIBS) - AC_SUBST(PRINT_LIBS) AC_SUBST(AUTH_LIBS) AC_SUBST(ACL_LIBS) @@ -4727,140 +4709,78 @@ AC_ARG_WITH([static-libs], done], [])], []) -################################################# -# should we build libtalloc? -LIBTALLOC_SHARED_TARGET=bin/libtalloc.$SHLIBEXT -LIBTALLOC_STATIC_TARGET=bin/libtalloc.a -LIBTALLOC_SHARED= -LIBTALLOC_STATIC= -LIBTALLOC_LIBS= - -AC_MSG_CHECKING(whether to build the libtalloc shared library) -AC_ARG_WITH(libtalloc, -[AS_HELP_STRING([--with-libtalloc], - [Build the libtalloc shared library (default=yes if shared libs supported)])], -[ -case "$withval" in - *) - AC_MSG_RESULT(no) - ;; - yes) - samba_cv_with_libtalloc=yes - ;; -esac -], -[ -# if unspecified, default is to build it if possible. -samba_cv_with_libtalloc=yes -] -) -if test x"$samba_cv_with_libtalloc" = "xyes" -a $BLDSHARED = true; then - LIBTALLOC_SHARED=$LIBTALLOC_SHARED_TARGET - AC_MSG_RESULT(yes) - if test x"$USESHARED" != x"true" -o x"$LINK_LIBTALLOC" = "xSTATIC" ; then - LIBTALLOC_STATIC=$LIBTALLOC_STATIC_TARGET - AC_MSG_NOTICE([not using libtalloc shared library internally]) - else - LIBTALLOC_LIBS=-ltalloc - AC_MSG_NOTICE([using libtalloc shared library internally]) - fi -else - enable_static=yes - AC_MSG_RESULT(no shared library support -- will supply static library) -fi -if test $enable_static = yes; then - LIBTALLOC_STATIC=$LIBTALLOC_STATIC_TARGET -fi -################################################# -# should we build libtdb? -LIBTDB_SHARED_TARGET=bin/libtdb.$SHLIBEXT -LIBTDB_STATIC_TARGET=bin/libtdb.a -LIBTDB_SHARED= -LIBTDB_STATIC= -LIBTDB_LIBS= - -AC_MSG_CHECKING(whether to build the libtdb shared library) -AC_ARG_WITH(libtdb, -[AS_HELP_STRING([--with-libtdb], - [Build the libtdb shared library (default=yes if shared libs supported)])], +dnl SMB_LIBRARY(name) +dnl +dnl configure build and use of an (internal) shared library +dnl +AC_DEFUN([SMB_LIBRARY], +[ +m4_pushdef([LIBNAME], [lib$1]) +m4_pushdef([LIBUC], [m4_toupper(LIBNAME)]) +m4_pushdef([LIBLIBS], [-l$1]) + +LIBUC[_SHARED_TARGET]=bin/LIBNAME.$SHLIBEXT +LIBUC[_STATIC_TARGET]=bin/LIBNAME.a +LIBUC[_SHARED]= +LIBUC[_STATIC]= +LIBUC[_LIBS]= + +AC_SUBST(LIBUC[_SHARED_TARGET]) +AC_SUBST(LIBUC[_STATIC_TARGET]) +AC_SUBST(LIBUC[_SHARED]) +AC_SUBST(LIBUC[_STATIC]) +AC_SUBST(LIBUC[_LIBS]) + +AC_MSG_CHECKING([whether to build the LIBNAME shared library]) +AC_ARG_WITH(LIBNAME, +[AS_HELP_STRING([--with-LIBNAME], + [Build the LIBNAME shared library (default=yes if shared libs supported)])], [ case "$withval" in *) AC_MSG_RESULT(no) + build_lib=no ;; yes) - samba_cv_with_libtdb=yes + build_lib=yes ;; esac ], [ # if unspecified, default is to build it if possible. -samba_cv_with_libtdb=yes +build_lib=yes ] ) -if test x"$samba_cv_with_libtdb" = "xyes" -a $BLDSHARED = true; then - LIBTDB_SHARED=$LIBTDB_SHARED_TARGET +if eval test x"$build_lib" = "xyes" -a $BLDSHARED = true; then + LIBUC[_SHARED]=$LIBUC[_SHARED_TARGET] AC_MSG_RESULT(yes) - if test x"$USESHARED" != x"true" -o x"$LINK_LIBTDB" = "xSTATIC" ; then - LIBTDB_STATIC=$LIBTDB_STATIC_TARGET - AC_MSG_NOTICE([not using libtdb shared library internally]) + if test x"$USESHARED" != x"true" -o x"$LINK_LIBUC" = "xSTATIC" ; then + LIBUC[_STATIC]=$LIBUC[_STATIC_TARGET] else - LIBTDB_LIBS=-ltdb + LIBUC[_LIBS]=LIBLIBS fi else enable_static=yes AC_MSG_RESULT(no shared library support -- will supply static library) fi if test $enable_static = yes; then - LIBTDB_STATIC=$LIBTDB_STATIC_TARGET + LIBUC[_STATIC]=$LIBUC[_STATIC_TARGET] fi -################################################# -# should we build libnetapi? -LIBNETAPI_SHARED_TARGET=bin/libnetapi.$SHLIBEXT -LIBNETAPI_STATIC_TARGET=bin/libnetapi.a -LIBNETAPI_SHARED= -LIBNETAPI_STATIC= -LIBNETAPI_LIBS= - -AC_MSG_CHECKING(whether to build the libnetapi shared library) -AC_ARG_WITH(libnetapi, -[AS_HELP_STRING([--with-libnetapi], [Build the libnetapi shared library (default=yes if shared libs supported)])], -[ -case "$withval" in - *) - AC_MSG_RESULT(no) - ;; - yes) - samba_cv_with_libnetapi=yes - ;; -esac -], -[ -# if unspecified, default is to build it if possible. -samba_cv_with_libnetapi=yes -] -) +m4_popdef([LIBNAME]) +m4_popdef([LIBUC]) +m4_popdef([LIBLIBS]) + +]) + + +SMB_LIBRARY(talloc) +SMB_LIBRARY(tdb) +SMB_LIBRARY(netapi) -if test x"$samba_cv_with_libnetapi" = x"yes" -a $BLDSHARED = true; then - LIBNETAPI_SHARED=$LIBNETAPI_SHARED_TARGET - AC_MSG_RESULT(yes) - if test x"$USESHARED" != x"true" -o x"$LINK_LIBNETAPI" = x"STATIC" ; then - LIBNETAPI_STATIC=$LIBNETAPI_STATIC_TARGET - AC_MSG_NOTICE([not using libnetapi shared library internally]) - else - LIBNETAPI_LIBS=-lnetapi - fi -else - enable_static=yes - AC_MSG_RESULT(no shared library support -- will supply static library) -fi -if test x"$enable_static" = x"yes"; then - LIBNETAPI_STATIC=$LIBNETAPI_STATIC_TARGET -fi ################################################# # should we build libaddns? -- cgit