1 dnl -*- mode: m4-mode -*-
2 dnl Process this file with autoconf to produce a configure script.
4 dnl We must use autotools 2.53 or above
8 AC_CONFIG_HEADER(module_config.h)
9 #dnl To make sure that didn't get #define PACKAGE_* in modules_config.h
12 dnl Checks for programs.
17 #################################################
18 # Directory handling stuff to support both the
19 # legacy SAMBA directories and FHS compliant
21 AC_PREFIX_DEFAULT(/usr/local/samba)
24 [ --with-fhs Use FHS-compliant paths (default=no)],
25 libdir="\${prefix}/lib/samba",
26 libdir="\${prefix}/lib")
30 SAMBA_SOURCE="../../source"
31 ####################################################
32 # set the location location of the samba source tree
33 AC_ARG_WITH(samba-source,
34 [ --with-samba-source=DIR Where is the samba source tree (../../source)],
38 # Just in case anybody calls it without argument
40 AC_MSG_WARN([--with-samba-source called without argument - will use default])
43 SAMBA_SOURCE="$withval"
47 AC_SUBST(SAMBA_SOURCE)
49 dnl Unique-to-Samba variables we'll be playing with.
59 AC_SUBST(INSTALLCLIENTCMD_SH)
60 AC_SUBST(INSTALLCLIENTCMD_A)
62 AC_SUBST(EXTRA_BIN_PROGS)
63 AC_SUBST(EXTRA_SBIN_PROGS)
64 AC_SUBST(EXTRA_ALL_TARGETS)
67 [ --enable-debug Turn on compiler debugging information (default=no)],
68 [if eval "test x$enable_debug = xyes"; then
72 AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)],
73 [if eval "test x$enable_developer = xyes"; then
75 CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
78 # compile with optimization and without debugging by default, but
79 # allow people to set their own preference.
80 if test "x$CFLAGS" = x
85 #################################################
86 # check for krb5-config from recent MIT and Heimdal kerberos 5
87 AC_PATH_PROG(KRB5CONFIG, krb5-config)
88 AC_MSG_CHECKING(for working krb5-config)
89 if test -x "$KRB5CONFIG"; then
90 CFLAGS="$CFLAGS `$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
91 CPPFLAGS="$CPPFLAGS `$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
95 AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
98 if test x$FOUND_KRB5 = x"no"; then
99 #################################################
100 # check for location of Kerberos 5 install
101 AC_MSG_CHECKING(for kerberos 5 install path)
103 [ --with-krb5=base-dir Locate Kerberos 5 support (default=/usr)],
110 CFLAGS="$CFLAGS -I$withval/include"
111 CPPFLAGS="$CPPFLAGS -I$withval/include"
119 if test x$FOUND_KRB5 = x"no"; then
120 #################################################
121 # see if this box has the SuSE location for the heimdal kerberos implementation
122 AC_MSG_CHECKING(for /usr/include/heimdal)
123 if test -d /usr/include/heimdal; then
124 if test -f /usr/lib/heimdal/lib/libkrb5.a; then
125 CFLAGS="$CFLAGS -I/usr/include/heimdal"
126 CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
129 CFLAGS="$CFLAGS -I/usr/include/heimdal"
130 CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
140 if test x$FOUND_KRB5 = x"no"; then
141 #################################################
142 # see if this box has the RedHat location for kerberos
143 AC_MSG_CHECKING(for /usr/kerberos)
144 if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then
145 LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
146 CFLAGS="$CFLAGS -I/usr/kerberos/include"
147 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
154 # now check for krb5.h. Some systems have the libraries without the headers!
155 # note that this check is done here to allow for different kerberos
157 AC_CHECK_HEADERS(krb5.h)
159 # now check for gssapi headers. This is also done here to allow for
160 # different kerberos include paths
161 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h)
163 #dnl Check if we use GNU ld
167 #dnl look for executable suffix
173 # Assume non-shared by default and override below
176 # these are the defaults, good for lots of systems
185 # Since we are not embedded in the Samba tree, building shared modules is
186 # really the only option.
189 if test "$enable_shared" = "yes"; then
190 # this bit needs to be modified for each OS that is suported by
191 # smbwrapper. You need to specify how to created a shared library and
192 # how to compile C code to produce PIC object files
194 AC_MSG_CHECKING([ability to build shared libraries])
196 # and these are for particular systems
201 DYNEXP="-Wl,--export-dynamic"
203 SONAMEFLAG="-Wl,-soname="
209 if test "${GCC}" = "yes"; then
211 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
216 ## ${CFLAGS} added for building 64-bit shared
217 ## libs using Sun's Compiler
218 LDSHFLAGS="-G \${CFLAGS}"
226 PICFLAGS="-KPIC" # Is this correct for SunOS
228 *netbsd* | *freebsd*) BLDSHARED="true"
230 DYNEXP="-Wl,--export-dynamic"
231 SONAMEFLAG="-Wl,-soname,"
232 PICFLAGS="-fPIC -DPIC"
234 *openbsd*) BLDSHARED="true"
236 DYNEXP="-Wl,-Bdynamic"
237 SONAMEFLAG="-Wl,-soname,"
245 ATTEMPT_WRAP32_BUILD=yes
247 LDSHFLAGS="-set_version sgi1.0 -shared"
248 SONAMEFLAG="-soname "
250 if test "${GCC}" = "yes"; then
258 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
259 DYNEXP="-Wl,-brtl,-bexpall"
261 if test "${GCC}" != "yes"; then
262 ## for funky AIX compiler using strncpy()
263 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
268 # Use special PIC flags for the native HP-UX compiler.
269 if test $ac_cv_prog_cc_Ae = yes; then
272 LDSHFLAGS="-B symbolic -b -z"
283 SONAMEFLAG="-Wl,-soname,"
291 SONAMEFLAG="-Wl,-soname,"
296 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
318 LDSHFLAGS="-bundle -flat_namespace -undefined suppress"
325 AC_MSG_RESULT($BLDSHARED)
326 AC_MSG_CHECKING([linker flags for shared libraries])
327 AC_MSG_RESULT([$LDSHFLAGS])
328 AC_MSG_CHECKING([compiler flags for position-independent code])
329 AC_MSG_RESULT([$PICFLAGS])
332 #######################################################
333 # test whether building a shared library actually works
334 if test $BLDSHARED = true; then
335 AC_CACHE_CHECK([whether building shared libraries actually works],
336 [ac_cv_shlib_works],[
338 # try building a trivial shared library
339 if test "$PICSUFFIX" = "po"; then
340 $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o shlib.po ${srcdir-.}/../../source/tests/shlib.c &&
341 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po &&
342 ac_cv_shlib_works=yes
344 $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c &&
345 mv shlib.$PICSUFFIX shlib.po &&
346 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po &&
347 ac_cv_shlib_works=yes
349 rm -f "shlib.$SHLIBEXT" shlib.po
351 if test $ac_cv_shlib_works = no; then