fi
if test x"$DEST" = xSHARED; then
- AC_DEFINE([$1][_init], [init_module], [Whether to build $1 as shared module])
+ AC_DEFINE([$1][_init], [init_samba_module], [Whether to build $1 as shared module])
$4_MODULES="$$4_MODULES $3"
AC_MSG_RESULT([shared])
[$6]
ifelse([$2], , :, [rm -f $2])
])
+
+dnl SMB_LIBRARY(name, version, default, reason)
+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]=LIBLIBS
+LIBUC[_TARGET]=
+[INSTALL_]LIBUC=
+[UNINSTALL_]LIBUC=
+
+m4_if([$2], [], [LIBUC[_SOVER]=0], [LIBUC[_SOVER]=$2])
+
+AC_SUBST(LIBUC[_SHARED_TARGET])
+AC_SUBST(LIBUC[_STATIC_TARGET])
+AC_SUBST(LIBUC[_SHARED])
+AC_SUBST(LIBUC[_STATIC])
+AC_SUBST(LIBUC[_LIBS])
+AC_SUBST(LIBUC[_TARGET])
+AC_SUBST([INSTALL_]LIBUC)
+AC_SUBST([UNINSTALL_]LIBUC)
+AC_SUBST(LIBUC[_SOVER])
+
+AC_MSG_CHECKING([whether to build the LIBNAME shared library])
+m4_if([$3], [no], [
+dnl set the default to not build the shared lib
+AC_ARG_WITH(LIBNAME,
+AS_HELP_STRING([--with-]LIBNAME,
+ m4_if([$4], [],
+ [Build the LIBNAME shared library (default=no)],
+ [Build the LIBNAME shared library (default=no ($4))])),
+[
+case "$withval" in
+ yes)
+ build_lib=yes
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ build_lib=no
+ ;;
+esac
+],
+[
+# if unspecified, default is not to build
+AC_MSG_RESULT(yes)
+build_lib=no
+]
+)
+],[
+dnl by default, try to build the shared lib
+AC_ARG_WITH(LIBNAME,
+AS_HELP_STRING([--with-]LIBNAME,
+ [Build the LIBNAME shared library (default=yes if shared libs supported)]),
+[
+case "$withval" in
+ no)
+ AC_MSG_RESULT(no)
+ build_lib=no
+ ;;
+ *)
+ build_lib=yes
+ ;;
+esac
+],
+[
+# if unspecified, default is to build it if possible.
+build_lib=yes
+]
+)
+])
+
+if eval test x"$build_lib" = "xyes" ; then
+ # only set the install targets if the user chose the library
+ [INSTALL_]LIBUC=[install]LIBNAME
+ [UNINSTALL_]LIBUC=[uninstall]LIBNAME
+ if eval $BLDSHARED = true; then
+ LIBUC[_SHARED]=$LIBUC[_SHARED_TARGET]
+ LIBUC[_TARGET]=$LIBUC[_SHARED_TARGET]
+ AC_MSG_RESULT(yes)
+ if test x"$USESHARED" != x"true" -o x"$[LINK_]LIBUC" = "xSTATIC" ; then
+ enable_static=yes
+ LIBUC[_TARGET]=$LIBUC[_STATIC_TARGET]
+ LIBUC[_LIBS]=$LIBUC[_STATIC_TARGET]
+ else
+ LIBUC[_LIBS]=LIBLIBS
+ fi
+ else
+ enable_static=yes
+ LIBUC[_TARGET]=$LIBUC[_STATIC_TARGET]
+ AC_MSG_RESULT(no shared library support -- will supply static library)
+ fi
+else
+ enable_static=yes
+ AC_MSG_RESULT(shared library not selected, but will supply static library)
+fi
+if test $enable_static = yes; then
+ LIBUC[_STATIC]=[\$\(]LIBUC[_OBJ0\)]
+fi
+
+m4_popdef([LIBNAME])
+m4_popdef([LIBUC])
+m4_popdef([LIBLIBS])
+
+])
+
+
dnl AC_LIBTESTFUNC(lib, function, [actions if found], [actions if not found])
dnl Check for a function in a library, but don't keep adding the same library
dnl to the LIBS variable. Check whether the function is available in the
case [$]l[$]i in
-L/usr/lib) ;;
-L/usr/lib/) ;;
- -Wl,-rpath,/usr/lib) ;;
- -Wl,-rpath,/usr/lib/) ;;
+ -L/usr/lib64) ;;
+ -L/usr/lib64/) ;;
+ -Wl,-rpath,/usr/lib) l="";;
+ -Wl,-rpath,/usr/lib/) l="";;
+ -Wl,-rpath,/usr/lib64) l="";;
+ -Wl,-rpath,/usr/lib64/) l="";;
-Wl,-rpath) l=[$]i;;
-Wl,-rpath-Wl,/usr/lib) l="";;
-Wl,-rpath-Wl,/usr/lib/) l="";;
+ -Wl,-rpath-Wl,/usr/lib64) l="";;
+ -Wl,-rpath-Wl,/usr/lib64/) l="";;
*)
s=" "
if test x"[$]ac_new_flags" = x""; then
AC_MSG_RESULT($ICONV_CHARSET)
])
-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
])
])
-m4_include(lib/replace/libreplace.m4)
+m4_include(../lib/replace/libreplace.m4)