From 51b6e23f9a88f1c8fabb67d5e6d9b81aa562623a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 1 Dec 2009 14:55:02 +0100 Subject: [PATCH] s3:build: fix the build when no external talloc and tdb are installed. The check for the external libs and the addition of the include paths to the CPPFLAGS was too late in configure. This patch moves the whole subsystem/library section up right below the detection of "BLDSHARED". And it updates not only SAMBA_CPPFLAGS but also SAMBA_CONFIGURE_CPPFLAGS so that many tests that use these flags can now succeed. Michael --- source3/configure.in | 345 ++++++++++++++++++++++--------------------- 1 file changed, 178 insertions(+), 167 deletions(-) diff --git a/source3/configure.in b/source3/configure.in index 01dcd9f744d..af52c933bdf 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -1837,6 +1837,184 @@ AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension]) AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR + +########################################################### +# +# Configuration of subsystems / libraries +# +########################################################### + +INSTALLLIBCMD_SH=: +INSTALLLIBCMD_A=: +UNINSTALLLIBCMD_SH=: +UNINSTALLLIBCMD_A=: + +if test $BLDSHARED = true; then + INSTALLLIBCMD_SH="\$(INSTALLCMD)" + UNINSTALLLIBCMD_SH="rm -f" +fi +if test $enable_static = yes; then + INSTALLLIBCMD_A="\$(INSTALLCMD)" + UNINSTALLLIBCMD_A="rm -f" +fi + +################################################# +# --disable-shared-libs +# can be used to disable the internal use of shared libs altogether +# (this only has an effect when building shared libs is enabled) +# +USESHARED=false +AC_SUBST(USESHARED) + +AC_MSG_CHECKING(whether to use shared libraries internally) +AC_ARG_ENABLE([shared-libs], + AS_HELP_STRING([--enable-shared-libs], + [Use shared libraries internally (default=yes)]), + [enable_shared_libs=$enableval], + [enable_shared_libs=yes]) + +if test x"$enable_shared_libs" != x"no" ; then + USESHARED=$BLDSHARED +fi + +AC_MSG_RESULT([$USESHARED]) + +if test x"$enable_shared_libs" = x"yes" -a x"$BLDSHARED" != x"true" ; then + AC_MSG_WARN([--enable-shared-libs: no support for shared libraries]) +fi + +################################################# +# --with-static-libs=LIBS: +# link (internal) libs dynamically or statically? +# +# If a subsystem is built as a library then this controls whether they are +# linked into Samba targets statically or dynamically: +# +# * If we build the shared library at all, we link dynamically by default. +# +# * We only link statically if we don't build shared or if the library +# appears in the --with-static-libs configure option. +# +# Example: +# --with-static-libs=libtalloc makes use of libtalloc.a instead +# of linking the dynamic variant with -ltalloc. +# +# NOTE: This option only affects libraries that we do not only build +# but that samba also links against as libraries (as opposed to linking +# the plain object files. - This has to be configured in Makefile.in. +# So in particular it does not harm to give invalid or unknown names here. +# + +AC_ARG_WITH([static-libs], + [AS_HELP_STRING([--with-static-libs=LIBS], + [Comma-separated list of names of (internal) libraries to link statically (instead of dynamically)])], + [AS_IF([test $withval], + [for lib in `echo $withval | sed -e 's/,/ /g'` ; do + [lib=`echo $lib | tr '[a-z]' '[A-Z]'`] + eval LINK_$lib=STATIC + done], [])], + []) + +# +# WORKAROUND: +# until we have organized other internal subsystems (as util, registry +# and smbconf) into shared libraries, we CAN NOT link libnetapi +# dynamically to samba programs. +# +LINK_LIBNETAPI=STATIC + +LINK_LIBSMBCLIENT=STATIC + +# +# The library versions are hardcoded here +# and filled into the LIBFOO_SOVER variable. +# +# TODO: for talloc and tdb (at least), these should +# be extracted from their respective source directories +# +AC_ARG_ENABLE(external_libtalloc, [AS_HELP_STRING([--enable-external-libtalloc], [Enable external talloc [default=auto]])], +[ enable_external_libtalloc=$enableval ], [ enable_external_libtalloc=auto ]) + +if test "x$enable_external_libtalloc" != xno +then + PKG_CHECK_MODULES(LIBTALLOC, talloc >= 2.0.1, + [ enable_external_libtalloc=yes ], + [ if test x$enable_external_libtalloc = xyes; then + AC_MSG_ERROR([Unable to find libtalloc]) + else + enable_external_libtalloc=no + fi + ]) +fi + +if test "x$enable_external_libtalloc" = xno +then + m4_include(../lib/talloc/libtalloc.m4) + LINK_LIBTALLOC=STATIC + SMB_LIBRARY(talloc, 2) + LIBTALLOC_OBJ0="" + for obj in ${TALLOC_OBJ}; do + LIBTALLOC_OBJ0="${LIBTALLOC_OBJ0} ${tallocdir}/${obj}" + done + SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}" + SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${TALLOC_CFLAGS}" + AC_SUBST(LIBTALLOC_OBJ0) + + TALLOCTORT="bin/talloctort\$(EXEEXT)" + AC_SUBST(TALLOCTORT) +fi + + +AC_ARG_ENABLE(external_libtdb, + [AS_HELP_STRING([--enable-external-libtdb], + [Enable external tdb [default=auto]])], + [ enable_external_libtalloc=$enableval ], + [ enable_external_libtalloc=auto ]) + +if test "x$enable_external_libtdb" != xno +then + PKG_CHECK_MODULES(LIBTDB, tdb >= 1.2.0, + [ enable_external_libtdb=yes ], + [ + if test x$enable_external_libtdb = xyes; then + AC_MSG_ERROR([Unable to find libtdb]) + else + enable_external_libtdb=no + fi + ]) +fi + +AC_SUBST(LIBTDB_OBJ0) +if test "x$enable_external_libtdb" = xno +then + m4_include(../lib/tdb/libtdb.m4) + LINK_LIBTDB=STATIC + SMB_LIBRARY(tdb, 1) + LIBTDB_OBJ0="" + for obj in ${TDB_OBJ}; do + LIBTDB_OBJ0="${LIBTDB_OBJ0} ${tdbdir}/${obj}" + done + AC_SUBST(LIBTDB_OBJ0) + SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}" + SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${TDB_CFLAGS}" + + TDBBACKUP="bin/tdbbackup\$(EXEEXT)" + AC_SUBST(TDBBACKUP) + TDBDUMP="bin/tdbdump\$(EXEEXT)" + AC_SUBST(TDBDUMP) + TDBTOOL="bin/tdbtool\$(EXEEXT)" + AC_SUBST(TDBTOOL) + TDBTORTURE="bin/tdbtorture\$(EXEEXT)" + AC_SUBST(TDBTORTURE) +fi + +SMB_LIBRARY(netapi, 0) +SMB_LIBRARY(smbclient, 0) +SMB_LIBRARY(smbsharemodes, 0) +SMB_LIBRARY(addns, 0, no, [undefined API]) + + + ################ AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[ @@ -4763,173 +4941,6 @@ else AC_MSG_RESULT(no$utmp_no_reason) fi -INSTALLLIBCMD_SH=: -INSTALLLIBCMD_A=: -UNINSTALLLIBCMD_SH=: -UNINSTALLLIBCMD_A=: - -if test $BLDSHARED = true; then - INSTALLLIBCMD_SH="\$(INSTALLCMD)" - UNINSTALLLIBCMD_SH="rm -f" -fi -if test $enable_static = yes; then - INSTALLLIBCMD_A="\$(INSTALLCMD)" - UNINSTALLLIBCMD_A="rm -f" -fi - -################################################# -# --disable-shared-libs -# can be used to disable the internal use of shared libs altogether -# (this only has an effect when building shared libs is enabled) -# -USESHARED=false -AC_SUBST(USESHARED) - -AC_MSG_CHECKING(whether to use shared libraries internally) -AC_ARG_ENABLE([shared-libs], - AS_HELP_STRING([--enable-shared-libs], - [Use shared libraries internally (default=yes)]), - [enable_shared_libs=$enableval], - [enable_shared_libs=yes]) - -if test x"$enable_shared_libs" != x"no" ; then - USESHARED=$BLDSHARED -fi - -AC_MSG_RESULT([$USESHARED]) - -if test x"$enable_shared_libs" = x"yes" -a x"$BLDSHARED" != x"true" ; then - AC_MSG_WARN([--enable-shared-libs: no support for shared libraries]) -fi - -################################################# -# --with-static-libs=LIBS: -# link (internal) libs dynamically or statically? -# -# If a subsystem is built as a library then this controls whether they are -# linked into Samba targets statically or dynamically: -# -# * If we build the shared library at all, we link dynamically by default. -# -# * We only link statically if we don't build shared or if the library -# appears in the --with-static-libs configure option. -# -# Example: -# --with-static-libs=libtalloc makes use of libtalloc.a instead -# of linking the dynamic variant with -ltalloc. -# -# NOTE: This option only affects libraries that we do not only build -# but that samba also links against as libraries (as opposed to linking -# the plain object files. - This has to be configured in Makefile.in. -# So in particular it does not harm to give invalid or unknown names here. -# - -AC_ARG_WITH([static-libs], - [AS_HELP_STRING([--with-static-libs=LIBS], - [Comma-separated list of names of (internal) libraries to link statically (instead of dynamically)])], - [AS_IF([test $withval], - [for lib in `echo $withval | sed -e 's/,/ /g'` ; do - [lib=`echo $lib | tr '[a-z]' '[A-Z]'`] - eval LINK_$lib=STATIC - done], [])], - []) - -# -# WORKAROUND: -# until we have organized other internal subsystems (as util, registry -# and smbconf) into shared libraries, we CAN NOT link libnetapi -# dynamically to samba programs. -# -LINK_LIBNETAPI=STATIC - -LINK_LIBSMBCLIENT=STATIC - -# -# The library versions are hardcoded here -# and filled into the LIBFOO_SOVER variable. -# -# TODO: for talloc and tdb (at least), these should -# be extracted from their respective source directories -# -AC_ARG_ENABLE(external_libtalloc, [AS_HELP_STRING([--enable-external-libtalloc], [Enable external talloc [default=auto]])], -[ enable_external_libtalloc=$enableval ], [ enable_external_libtalloc=auto ]) - -if test "x$enable_external_libtalloc" != xno -then - PKG_CHECK_MODULES(LIBTALLOC, talloc >= 2.0.1, - [ enable_external_libtalloc=yes ], - [ if test x$enable_external_libtalloc = xyes; then - AC_MSG_ERROR([Unable to find libtalloc]) - else - enable_external_libtalloc=no - fi - ]) -fi - -if test "x$enable_external_libtalloc" = xno -then - m4_include(../lib/talloc/libtalloc.m4) - LINK_LIBTALLOC=STATIC - SMB_LIBRARY(talloc, 2) - LIBTALLOC_OBJ0="" - for obj in ${TALLOC_OBJ}; do - LIBTALLOC_OBJ0="${LIBTALLOC_OBJ0} ${tallocdir}/${obj}" - done - SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}" - AC_SUBST(LIBTALLOC_OBJ0) - - TALLOCTORT="bin/talloctort\$(EXEEXT)" - AC_SUBST(TALLOCTORT) -fi - - -AC_ARG_ENABLE(external_libtdb, - [AS_HELP_STRING([--enable-external-libtdb], - [Enable external tdb [default=auto]])], - [ enable_external_libtalloc=$enableval ], - [ enable_external_libtalloc=auto ]) - -if test "x$enable_external_libtdb" != xno -then - PKG_CHECK_MODULES(LIBTDB, tdb >= 1.2.0, - [ enable_external_libtdb=yes ], - [ - if test x$enable_external_libtdb = xyes; then - AC_MSG_ERROR([Unable to find libtdb]) - else - enable_external_libtdb=no - fi - ]) -fi - -AC_SUBST(LIBTDB_OBJ0) -if test "x$enable_external_libtdb" = xno -then - m4_include(../lib/tdb/libtdb.m4) - LINK_LIBTDB=STATIC - SMB_LIBRARY(tdb, 1) - LIBTDB_OBJ0="" - for obj in ${TDB_OBJ}; do - LIBTDB_OBJ0="${LIBTDB_OBJ0} ${tdbdir}/${obj}" - done - AC_SUBST(LIBTDB_OBJ0) - SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}" - - TDBBACKUP="bin/tdbbackup\$(EXEEXT)" - AC_SUBST(TDBBACKUP) - TDBDUMP="bin/tdbdump\$(EXEEXT)" - AC_SUBST(TDBDUMP) - TDBTOOL="bin/tdbtool\$(EXEEXT)" - AC_SUBST(TDBTOOL) - TDBTORTURE="bin/tdbtorture\$(EXEEXT)" - AC_SUBST(TDBTORTURE) -fi - -SMB_LIBRARY(netapi, 0) -SMB_LIBRARY(smbclient, 0) -SMB_LIBRARY(smbsharemodes, 0) -SMB_LIBRARY(addns, 0, no, [undefined API]) - ################################################# # these tests are taken from the GNU fileutils package -- 2.34.1