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 #dnl Uncomment this if you want to use your own define's too
9 #AC_CONFIG_HEADER(module_config.h)
10 #dnl To make sure that didn't get #define PACKAGE_* in modules_config.h
13 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.
60 AC_SUBST(INSTALLCLIENTCMD_SH)
61 AC_SUBST(INSTALLCLIENTCMD_A)
63 AC_SUBST(EXTRA_BIN_PROGS)
64 AC_SUBST(EXTRA_SBIN_PROGS)
65 AC_SUBST(EXTRA_ALL_TARGETS)
68 [ --enable-debug Turn on compiler debugging information (default=no)],
69 [if eval "test x$enable_debug = xyes"; then
73 AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)],
74 [if eval "test x$enable_developer = xyes"; then
76 CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
79 # compile with optimization and without debugging by default, but
80 # allow people to set their own preference.
81 if test "x$CFLAGS" = x
86 #################################################
87 # check for krb5-config from recent MIT and Heimdal kerberos 5
88 AC_PATH_PROG(KRB5_CONFIG, krb5-config)
89 AC_MSG_CHECKING(for working krb5-config)
90 if test -x "$KRB5_CONFIG"; then
91 CFLAGS="$CFLAGS `$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`"
92 CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`"
96 AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
99 if test x$FOUND_KRB5 = x"no"; then
100 #################################################
101 # check for location of Kerberos 5 install
102 AC_MSG_CHECKING(for kerberos 5 install path)
104 [ --with-krb5=base-dir Locate Kerberos 5 support (default=/usr)],
111 CFLAGS="$CFLAGS -I$withval/include"
112 CPPFLAGS="$CPPFLAGS -I$withval/include"
120 if test x$FOUND_KRB5 = x"no"; then
121 #################################################
122 # see if this box has the SuSE location for the heimdal kerberos implementation
123 AC_MSG_CHECKING(for /usr/include/heimdal)
124 if test -d /usr/include/heimdal; then
125 if test -f /usr/lib/heimdal/lib/libkrb5.a; then
126 CFLAGS="$CFLAGS -I/usr/include/heimdal"
127 CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
130 CFLAGS="$CFLAGS -I/usr/include/heimdal"
131 CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
141 if test x$FOUND_KRB5 = x"no"; then
142 #################################################
143 # see if this box has the RedHat location for kerberos
144 AC_MSG_CHECKING(for /usr/kerberos)
145 if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then
146 LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
147 CFLAGS="$CFLAGS -I/usr/kerberos/include"
148 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
155 # now check for krb5.h. Some systems have the libraries without the headers!
156 # note that this check is done here to allow for different kerberos
158 AC_CHECK_HEADERS(krb5.h)
160 # now check for gssapi headers. This is also done here to allow for
161 # different kerberos include paths
162 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h)
164 #dnl Check if we use GNU ld
168 #dnl look for executable suffix
174 # Assume non-shared by default and override below
177 # these are the defaults, good for lots of systems
187 if test "$enable_shared" = "yes"; then
188 # this bit needs to be modified for each OS that is suported by
189 # smbwrapper. You need to specify how to created a shared library and
190 # how to compile C code to produce PIC object files
192 AC_MSG_CHECKING([ability to build shared libraries])
194 # and these are for particular systems
199 DYNEXP="-Wl,--export-dynamic"
201 SONAMEFLAG="-Wl,-soname="
207 if test "${GCC}" = "yes"; then
209 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
214 ## ${CFLAGS} added for building 64-bit shared
215 ## libs using Sun's Compiler
216 LDSHFLAGS="-G \${CFLAGS}"
225 PICFLAG="-KPIC" # Is this correct for SunOS
227 *netbsd* | *freebsd*) BLDSHARED="true"
229 DYNEXP="-Wl,--export-dynamic"
230 SONAMEFLAG="-Wl,-soname,"
231 PICFLAG="-fPIC -DPIC"
233 *openbsd*) BLDSHARED="true"
235 DYNEXP="-Wl,-Bdynamic"
236 SONAMEFLAG="-Wl,-soname,"
244 ATTEMPT_WRAP32_BUILD=yes
246 LDSHFLAGS="-set_version sgi1.0 -shared"
247 SONAMEFLAG="-soname "
249 if test "${GCC}" = "yes"; then
257 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
258 DYNEXP="-Wl,-brtl,-bexpall"
260 if test "${GCC}" != "yes"; then
261 ## for funky AIX compiler using strncpy()
262 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
267 # Use special PIC flags for the native HP-UX compiler.
268 if test $ac_cv_prog_cc_Ae = yes; then
271 LDSHFLAGS="-B symbolic -b -z"
282 SONAMEFLAG="-Wl,-soname,"
290 SONAMEFLAG="-Wl,-soname,"
295 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
319 AC_MSG_RESULT($BLDSHARED)
320 AC_MSG_CHECKING([linker flags for shared libraries])
321 AC_MSG_RESULT([$LDSHFLAGS])
322 AC_MSG_CHECKING([compiler flags for position-independent code])
323 AC_MSG_RESULT([$PICFLAGS])
326 #######################################################
327 # test whether building a shared library actually works
328 if test $BLDSHARED = true; then
329 AC_CACHE_CHECK([whether building shared libraries actually works],
330 [ac_cv_shlib_works],[
332 # try building a trivial shared library
333 if test "$PICSUFFIX" = "po"; then
334 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c &&
335 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po &&
336 ac_cv_shlib_works=yes
338 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c &&
339 mv shlib.$PICSUFFIX shlib.po &&
340 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po &&
341 ac_cv_shlib_works=yes
343 rm -f "shlib.$SHLIBEXT" shlib.po
345 if test $ac_cv_shlib_works = no; then