1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-29 11:21:54 +03:00

Fixes from Paul Green and vorlon@debian.org for building shared libraries

(make it possible to build both shared and static) and -lcrypt handling.
This commit is contained in:
Andrew Bartlett 0001-01-01 00:00:00 +00:00
parent 523d1429b1
commit 30510f5007
2 changed files with 99 additions and 32 deletions

64
source/aclocal.m4 vendored
View File

@ -577,3 +577,67 @@ 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)])

View File

@ -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
@ -726,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
@ -952,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"
@ -965,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"
@ -1114,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
@ -2408,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
@ -2673,9 +2670,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 ],
@ -2686,10 +2686,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]
)