From ecd7fc59a8bfad088dae158a3d53b9df13e72dfa Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 24 Feb 2003 03:22:49 +0000 Subject: Merge crypt(), ACL lib and shared lib changes from HEAD. (This used to be commit e380224d8cd265b9845ad80af2b053a56078e790) --- source3/Makefile.in | 10 ++-- source3/aclocal.m4 | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++ source3/configure.in | 143 +++++++++++++++++++++++++++++----------------- 3 files changed, 252 insertions(+), 57 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 0d4fef7525..c48a71caf0 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -26,6 +26,7 @@ TERMLDFLAGS=@TERMLDFLAGS@ TERMLIBS=@TERMLIBS@ PRINTLIBS=@PRINTLIBS@ AUTHLIBS=@AUTHLIBS@ +ACLLIBS=@ACLLIBS@ LINK=$(CC) $(FLAGS) $(LDFLAGS) @@ -168,7 +169,7 @@ READLINE_OBJ = lib/readline.o POPT_LIB_OBJ = lib/popt_common.o UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \ - ubiqx/ubi_dLinkList.o ubiqx/ubi_sLinkList.o ubiqx/debugparse.o + ubiqx/ubi_dLinkList.o ubiqx/ubi_sLinkList.o PARAM_OBJ = param/loadparm.o param/params.o dynconfig.o @@ -704,7 +705,7 @@ bin/.dummy: bin/smbd@EXEEXT@: $(SMBD_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINTLIBS) \ - $(AUTHLIBS) $(LIBS) @BUILD_POPT@ + $(AUTHLIBS) $(ACLLIBS) $(LIBS) @BUILD_POPT@ bin/nmbd@EXEEXT@: $(NMBD_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @@ -817,7 +818,7 @@ bin/nsstest@EXEEXT@: $(NSSTEST_OBJ) bin/.dummy bin/vfstest@EXEEXT@: $(VFSTEST_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINTLIBS) $(AUTHLIBS) $(LIBS) @BUILD_POPT@ + @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINTLIBS) $(AUTHLIBS) $(ACLLIBS) $(LIBS) @BUILD_POPT@ bin/locktest2@EXEEXT@: $(LOCKTEST2_OBJ) bin/.dummy @echo Linking $@ @@ -1032,7 +1033,8 @@ installclientlib: # Python extensions PYTHON_OBJS = $(LIB_OBJ) $(LIBSMB_OBJ) $(RPC_PARSE_OBJ) $(UBIQX_OBJ) \ - $(PARAM_OBJ) $(LIBMSRPC_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) $(SECRETS_OBJ) + $(PARAM_OBJ) $(LIBMSRPC_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ + $(SECRETS_OBJ) $(KRBCLIENT_OBJ) PY_SPOOLSS_PROTO_OBJ = python/py_spoolss.o \ python/py_spoolss_printers.o python/py_spoolss_printers_conv.o\ diff --git a/source3/aclocal.m4 b/source3/aclocal.m4 index 5b1500106c..7bec88dd87 100644 --- a/source3/aclocal.m4 +++ b/source3/aclocal.m4 @@ -485,3 +485,159 @@ AC_DEFUN(LIB_REMOVE_USR_LIB,[ done $1=[$]ac_new_flags ]) + +dnl From Bruno Haible. + +AC_DEFUN(jm_ICONV, +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable libiconv installed). + AC_MSG_CHECKING(for iconv in $1) + jm_cv_func_iconv="no" + jm_cv_lib_iconv=no + jm_cv_giconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + jm_cv_func_iconv=yes + jm_cv_giconv=yes) + + if test "$jm_cv_func_iconv" != yes; then + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + jm_cv_func_iconv=yes) + + if test "$jm_cv_lib_iconv" != yes; then + jm_save_LIBS="$LIBS" + LIBS="$LIBS -lgiconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + jm_cv_lib_iconv=yes + jm_cv_func_iconv=yes + jm_cv_giconv=yes) + LIBS="$jm_save_LIBS" + + if test "$jm_cv_func_iconv" != yes; then + jm_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + jm_cv_lib_iconv=yes + jm_cv_func_iconv=yes) + LIBS="$jm_save_LIBS" + fi + fi + fi + + if test "$jm_cv_func_iconv" = yes; then + if test "$jm_cv_giconv" = yes; then + AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h]) + AC_MSG_RESULT(yes) + ICONV_FOUND=yes + else + AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h]) + AC_MSG_RESULT(yes) + ICONV_FOUND=yes + fi + else + AC_MSG_RESULT(no) + fi + if test "$jm_cv_lib_iconv" = yes; then + if test "$jm_cv_giconv" = yes; then + LIBS="$LIBS -lgiconv" + else + LIBS="$LIBS -liconv" + fi + fi +]) + +dnl CFLAGS_ADD_DIR(CFLAGS, $INCDIR) +dnl This function doesn't add -I/usr/include into CFLAGS +AC_DEFUN(CFLAGS_ADD_DIR,[ +if test "$2" != "/usr/include" ; then + $1="$$1 -I$2" +fi +]) + +dnl LIB_ADD_DIR(LDFLAGS, $LIBDIR) +dnl This function doesn't add -L/usr/lib into LDFLAGS +AC_DEFUN(LIB_ADD_DIR,[ +if test "$2" != "/usr/lib" ; then + $1="$$1 -L$2" +fi +]) + +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 --git a/source3/configure.in b/source3/configure.in index bd5a088502..d9da1c489c 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6,6 +6,9 @@ AC_PREREQ(2.53) 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 @@ -149,6 +152,7 @@ AC_SUBST(LIBSMBCLIENT_SHARED) AC_SUBST(LIBSMBCLIENT) AC_SUBST(PRINTLIBS) AC_SUBST(AUTHLIBS) +AC_SUBST(ACLLIBS) AC_SUBST(SHLIB_PROGS) AC_SUBST(SMBWRAPPER) AC_SUBST(EXTRA_BIN_PROGS) @@ -277,6 +281,7 @@ dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_AWK +AC_PATH_PROG(PERL, perl) dnl Check if we use GNU ld LD=ld @@ -724,11 +729,6 @@ fi AC_FUNC_MEMCMP -############################################### -# test for where we get crypt() from -AC_SEARCH_LIBS(crypt, [crypt], [AUTHLIBS="$AUTHLIBS -lcrypt"; - AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])]) - ############################################### # Readline included by default unless explicitly asked not to test "${with_readline+set}" != "set" && with_readline=yes @@ -950,9 +950,8 @@ AC_LIBTESTFUNC(sec, bigcrypt) 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" @@ -963,12 +962,16 @@ PICFLAG="" 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" @@ -1112,13 +1115,14 @@ case "$host_os" in *) 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 @@ -1480,26 +1484,47 @@ if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then fi -################################################# -# check for libiconv support -AC_MSG_CHECKING(whether to use libiconv) +ICONV_LOCATION=standard +LOOK_DIRS="/usr /usr/local /sw" AC_ARG_WITH(libiconv, [ --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ], -[ case "$withval" in - no) - AC_MSG_RESULT(no) - ;; - *) - AC_MSG_RESULT(yes) - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - AC_CHECK_LIB(iconv, iconv_open) - AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}",[Path to iconv]) - ;; - esac ], - AC_MSG_RESULT(no) -) +[ + if test "$withval" = "no" ; then + AC_MSG_ERROR(I won't take no for an answer) + else + if test "$withval" != "yes" ; then + LOOK_DIRS="$withval $LOOK_DIRS" + fi + fi +]) +ICONV_FOUND="no" +for i in $LOOK_DIRS ; do + save_LIBS=$LIBS + save_LDFLAGS=$LDFLAGS + save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="-I$i/include" + LDFLAGS="-L$i/lib" + LIBS= + export LDFLAGS LIBS CPPFLAGS +dnl Try to find iconv(3) + jm_ICONV($i) + + CPPFLAGS=$save_CPPFLAGS + if test -n "$ICONV_FOUND" ; then + LDFLAGS=$save_LDFLAGS + LIB_ADD_DIR(LDFLAGS, "$i/lib") + CFLAGS_ADD_DIR(CPPFLAGS, "$i/include") + LIBS="$save_LIBS $LIBS" + ICONV_LOCATION=$i + export LDFLAGS LIBS CPPFLAGS + break + else + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + export LDFLAGS LIBS CPPFLAGS + fi +done ############ # check for iconv in libc @@ -1517,6 +1542,11 @@ if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv]) fi +if test x"$ICONV_FOUND" = x"no" -o x"$samba_cv_HAVE_NATIVE_ICONV" != x"yes" ; then + AC_MSG_WARN([Sufficient support for iconv function was not found. + Install libiconv from http://freshmeat.net/projects/libiconv/ for better charset compatibility!]) +fi + AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[ AC_TRY_RUN([ @@ -2380,15 +2410,10 @@ AC_ARG_WITH(pam_smbpass, ############################################### -# test for where we get crypt() from, but only -# if not using PAM -if test x"$with_pam_for_crypt" = x"no"; then -AC_CHECK_FUNCS(crypt) -if test x"$ac_cv_func_crypt" = x"no"; then - AC_CHECK_LIB(crypt, crypt, [AUTHLIBS="$AUTHLIBS -lcrypt"; - AC_DEFINE(HAVE_CRYPT,1,[Whether crypt() is available])]) -fi -fi +# test for where we get crypt() from +AC_SEARCH_LIBS(crypt, [crypt], + [test "$ac_cv_search_crypt" = "none required" || AUTHLIBS="-lcrypt $AUTHLIBS" + AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])]) ## ## moved after the check for -lcrypt in order to @@ -2627,9 +2652,12 @@ AC_ARG_WITH(libsmbclient, 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 ], @@ -2640,10 +2668,13 @@ AC_ARG_WITH(libsmbclient, 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] ) @@ -2912,23 +2943,29 @@ AC_ARG_WITH(acl-support, *osf*) AC_MSG_RESULT(Using Tru64 ACLs) AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available]) - LIBS="$LIBS -lpacl" + ACLLIBS="$ACLLIBS -lpacl" ;; *) - AC_CHECK_LIB(acl,acl_get_file) + AC_CHECK_LIB(acl,acl_get_file,[ACLLIBS="$ACLLIBS -lacl"]) AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[ + acl_LIBS=$LIBS + LIBS="$LIBS -lacl" AC_TRY_LINK([#include #include ], [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);], -samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)]) +samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no) + LIBS=$acl_LIBS]) if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then AC_MSG_RESULT(Using posix ACLs) AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available]) AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[ + acl_LIBS=$LIBS + LIBS="$LIBS -lacl" AC_TRY_LINK([#include #include ], [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);], -samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)]) +samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no) + LIBS=$acl_LIBS]) if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available]) fi -- cgit