Currently, SAMBA_3_0 uses the following code to decide whether to build shared or static libs:
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
if test $BLDSHARED = true; then
INSTALLCLIENTCMD_SH="\$(INSTALLCMD)"
LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
LIBSMBCLIENT=libsmbclient
AC_MSG_RESULT(yes)
else
INSTALLCLIENTCMD_A="\$(INSTALLCMD)"
LIBSMBCLIENT=libsmbclient
AC_MSG_RESULT(no shared library support -- will supply static library)
fi
;;
esac ],
This makes it an either-or choice. Sometimes, it's useful to be able to
build (and install) static libraries even on platforms that support
shared libraries. The attached patch brings in a few macros from
libtool's aclocal.m4, to add --enable-shared and --enable-static options
to configure as a step in this direction.
--
Steve Langasek
postmodern programmer
diff -uNr samba-3.0alpha21.orig/source/aclocal.m4 samba-3.0alpha21/source/aclocal.m4
--- samba-3.0alpha21.orig/source/aclocal.m4 2003-02-16 19:34:05.000000000 -0600
+++ samba-3.0alpha21/source/aclocal.m4 2003-02-16 22:00:20.000000000 -0600
@@ -485,3 +485,67 @@
done
$1=[$]ac_new_flags
])
+
+dnl AC_ENABLE_SHARED - implement the --enable-shared flag
+dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
+dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+dnl `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries
+[default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+dnl AC_ENABLE_STATIC - implement the --enable-static flag
+dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
+dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+dnl `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries
+[default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
diff -uNr samba-3.0alpha21.orig/source/configure.in
samba-3.0alpha21/source/configure.in
--- samba-3.0alpha21.orig/source/configure.in 2003-02-16 19:34:08.000000000 -0600
+++ samba-3.0alpha21/source/configure.in 2003-02-16 22:05:07.000000000 -0600
@@ -6,6 +6,9 @@
AC_INIT(include/includes.h)
AC_CONFIG_HEADER(include/config.h)
+AC_DISABLE_STATIC
+AC_ENABLE_SHARED
+
#################################################
# Directory handling stuff to support both the
# legacy SAMBA directories and FHS compliant
@@ -983,9 +986,8 @@
AC_LIBTESTFUNC(security, getprpwnam)
AC_LIBTESTFUNC(sec, getprpwnam)
-# this bit needs to be modified for each OS that is suported by
-# smbwrapper. You need to specify how to created a shared library and
-# how to compile C code to produce PIC object files
+# Assume non-shared by default and override below
+BLDSHARED="false"
# these are the defaults, good for lots of systems
HOST_OS="$host_os"
@@ -996,12 +998,16 @@
PICSUFFIX="po"
POBAD_CC="#"
SHLIBEXT="so"
-# Assume non-shared by default and override below
-BLDSHARED="false"
-AC_MSG_CHECKING([ability to build shared libraries])
-# and these are for particular systems
-case "$host_os" in
+if test "$enable_shared" = "yes"; then
+ # this bit needs to be modified for each OS that is suported by
+ # smbwrapper. You need to specify how to created a shared library and
+ # how to compile C code to produce PIC object files
+
+ AC_MSG_CHECKING([ability to build shared libraries])
+
+ # and these are for particular systems
+ case "$host_os" in
*linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
BLDSHARED="true"
LDSHFLAGS="-shared"
@@ -1145,13 +1151,14 @@
*)
AC_DEFINE(STAT_ST_BLOCKSIZE,512)
;;
-esac
-AC_SUBST(DYNEXP)
-AC_MSG_RESULT($BLDSHARED)
-AC_MSG_CHECKING([linker flags for shared libraries])
-AC_MSG_RESULT([$LDSHFLAGS])
-AC_MSG_CHECKING([compiler flags for position-independent code])
-AC_MSG_RESULT([$PICFLAGS])
+ esac
+ AC_SUBST(DYNEXP)
+ AC_MSG_RESULT($BLDSHARED)
+ AC_MSG_CHECKING([linker flags for shared libraries])
+ AC_MSG_RESULT([$LDSHFLAGS])
+ AC_MSG_CHECKING([compiler flags for position-independent code])
+ AC_MSG_RESULT([$PICFLAGS])
+fi
#######################################################
# test whether building a shared library actually works
@@ -2657,9 +2664,12 @@
LIBSMBCLIENT=libsmbclient
AC_MSG_RESULT(yes)
else
+ enable_static=yes
+ AC_MSG_RESULT(no shared library support -- will supply static library)
+ fi
+ if test $enable_static = yes; then
INSTALLCLIENTCMD_A="\$(INSTALLCMD)"
LIBSMBCLIENT=libsmbclient
- AC_MSG_RESULT(no shared library support -- will supply static library)
fi
;;
esac ],
@@ -2670,10 +2680,13 @@
LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
LIBSMBCLIENT=libsmbclient
AC_MSG_RESULT(yes)
- else
+ else
+ enable_static=yes
+ AC_MSG_RESULT(no shared library support -- will supply static library)
+ fi
+ if test $enable_static = yes; then
INSTALLCLIENTCMD_A="\$(INSTALLCMD)"
LIBSMBCLIENT=libsmbclient
- AC_MSG_RESULT(no shared library support -- will supply static library)
fi]
)
msg06147/pgp00000.pgp
Description: PGP signature
