s4-rpc_server: limit allowed transports for samr_ValidatePassword().
[Samba/gebeck_regimport.git] / examples / VFS / configure.in
blob1c61853769ff7877ea22676ceebab548cd5e4189
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
5 AC_PREREQ(2.53)
6 AC_INIT(Makefile.in)
8 AC_CONFIG_HEADER(module_config.h)
9 #dnl To make sure that didn't get #define PACKAGE_* in modules_config.h
10 #echo "" > confdefs.h
12 dnl Checks for programs.
13 AC_PROG_CC
14 AC_PROG_INSTALL
15 AC_CANONICAL_HOST
17 #################################################
18 # Directory handling stuff to support both the
19 # legacy SAMBA directories and FHS compliant
20 # ones...
21 AC_PREFIX_DEFAULT(/usr/local/samba)
23 AC_ARG_WITH(fhs, 
24 [  --with-fhs              Use FHS-compliant paths (default=no)],
25     libdir="\${prefix}/lib/samba",
26     libdir="\${prefix}/lib")
28 AC_SUBST(libdir)
30 SAMBA_SOURCE="../../source3"
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 (../../source3)],
35 [ case "$withval" in
36   yes|no)
37   #
38   # Just in case anybody calls it without argument
39   #
40     AC_MSG_WARN([--with-samba-source called without argument - will use default])
41   ;;
42   * )
43     SAMBA_SOURCE="$withval"
44     ;;
45   esac])
47 AC_SUBST(SAMBA_SOURCE)
49 dnl Unique-to-Samba variables we'll be playing with.
50 AC_SUBST(CC)
51 AC_SUBST(SHELL)
52 AC_SUBST(LDSHFLAGS)
53 AC_SUBST(SONAMEFLAG)
54 AC_SUBST(SHLD)
55 AC_SUBST(HOST_OS)
56 AC_SUBST(PICFLAGS)
57 AC_SUBST(PICSUFFIX)
58 AC_SUBST(SHLIBEXT)
59 AC_SUBST(INSTALLCLIENTCMD_SH)
60 AC_SUBST(INSTALLCLIENTCMD_A)
61 AC_SUBST(SHLIB_PROGS)
62 AC_SUBST(EXTRA_BIN_PROGS)
63 AC_SUBST(EXTRA_SBIN_PROGS)
64 AC_SUBST(EXTRA_ALL_TARGETS)
66 AC_ARG_ENABLE(debug, 
67 [  --enable-debug          Turn on compiler debugging information (default=no)],
68     [if eval "test x$enable_debug = xyes"; then
69         CFLAGS="${CFLAGS} -g"
70     fi])
72 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
73     [if eval "test x$enable_developer = xyes"; then
74         developer=yes
75         CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
76     fi])
78 # compile with optimization and without debugging by default, but
79 # allow people to set their own preference.
80 if test "x$CFLAGS" = x
81 then
82   CFLAGS="-O ${CFLAGS}"
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@//`"
92     FOUND_KRB5=yes
93     AC_MSG_RESULT(yes)
94   else
95     AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
96   fi
97   
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)
102   AC_ARG_WITH(krb5,
103   [  --with-krb5=base-dir    Locate Kerberos 5 support (default=/usr)],
104   [ case "$withval" in
105     no)
106       AC_MSG_RESULT(no)
107       ;;
108     *)
109       AC_MSG_RESULT(yes)
110       CFLAGS="$CFLAGS -I$withval/include"
111       CPPFLAGS="$CPPFLAGS -I$withval/include"
112       FOUND_KRB5=yes
113       ;;
114     esac ],
115     AC_MSG_RESULT(no)
116   )
117   fi
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"
127         AC_MSG_RESULT(yes)
128     else
129         CFLAGS="$CFLAGS -I/usr/include/heimdal"
130         CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
131         AC_MSG_RESULT(yes)
133     fi
134 else
135     AC_MSG_RESULT(no)
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"
148     AC_MSG_RESULT(yes)
149 else
150     AC_MSG_RESULT(no)
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
156   # include paths
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
164 #LD=ld
165 #AC_PROG_LD_GNU
167 builddir=`pwd`
168 AC_SUBST(builddir)
170 # Assume non-shared by default and override below
171 BLDSHARED="false"
173 # these are the defaults, good for lots of systems
174 HOST_OS="$host_os"
175 LDSHFLAGS="-shared"
176 SONAMEFLAG="#"
177 SHLD="\${CC}"
178 PICFLAGS=""
179 PICSUFFIX="po"
180 SHLIBEXT="so"
182 # Since we are not embedded in the Samba tree, building shared modules is
183 # really the only option.
184 enable_shared=yes
186 if test "$enable_shared" = "yes"; then
187   # this bit needs to be modified for each OS that is suported by
188   # smbwrapper. You need to specify how to created a shared library and
189   # how to compile C code to produce PIC object files
191   AC_MSG_CHECKING([ability to build shared libraries])
193   # and these are for particular systems
194   case "$host_os" in
195                 *linux*)
196                         BLDSHARED="true"
197                         LDSHFLAGS="-shared" 
198                         DYNEXP="-Wl,--export-dynamic"
199                         PICFLAGS="-fPIC"
200                         SONAMEFLAG="-Wl,-soname="
201                         ;;
202                 *solaris*)
203                         BLDSHARED="true"
204                         LDSHFLAGS="-G"
205                         SONAMEFLAG="-h "
206                         if test "${GCC}" = "yes"; then
207                                 PICFLAGS="-fPIC"
208                                 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
209                                         DYNEXP="-Wl,-E"
210                                 fi
211                         else
212                                 PICFLAGS="-KPIC"
213                                 ## ${CFLAGS} added for building 64-bit shared 
214                                 ## libs using Sun's Compiler
215                                 LDSHFLAGS="-G \${CFLAGS}"
216                                 PICSUFFIX="po.o"
217                         fi
218                         ;;
219                 *sunos*)
220                         BLDSHARED="true"
221                         LDSHFLAGS="-G"
222                         SONAMEFLAG="-Wl,-h,"
223                         PICFLAGS="-KPIC"   # Is this correct for SunOS
224                         ;;
225                 *netbsd* | *freebsd*)  BLDSHARED="true"
226                         LDSHFLAGS="-shared"
227                         DYNEXP="-Wl,--export-dynamic"
228                         SONAMEFLAG="-Wl,-soname,"
229                         PICFLAGS="-fPIC -DPIC"
230                         ;;
231                 *openbsd*)  BLDSHARED="true"
232                         LDSHFLAGS="-shared"
233                         DYNEXP="-Wl,-Bdynamic"
234                         SONAMEFLAG="-Wl,-soname,"
235                         PICFLAGS="-fPIC"
236                         ;;
237                 *irix*)
238                         case "$host_os" in
239                         *irix6*)
240                         ;;
241                         esac
242                         ATTEMPT_WRAP32_BUILD=yes
243                         BLDSHARED="true"
244                         LDSHFLAGS="-set_version sgi1.0 -shared"
245                         SONAMEFLAG="-soname "
246                         SHLD="\${LD}"
247                         if test "${GCC}" = "yes"; then
248                                 PICFLAGS="-fPIC"
249                         else 
250                                 PICFLAGS="-KPIC"
251                         fi
252                         ;;
253                 *aix*)
254                         BLDSHARED="true"
255                         LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
256                         DYNEXP="-Wl,-brtl,-bexpall"
257                         PICFLAGS="-O2"
258                         if test "${GCC}" != "yes"; then
259                                 ## for funky AIX compiler using strncpy()
260                                 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
261                         fi
262                         ;;
263                 *hpux*)
264                         SHLIBEXT="sl"
265                         # Use special PIC flags for the native HP-UX compiler.
266                         if test $ac_cv_prog_cc_Ae = yes; then
267                                 BLDSHARED="true"
268                                 SHLD="/usr/bin/ld"
269                                 LDSHFLAGS="-B symbolic -b -z"
270                                 SONAMEFLAG="+h "
271                                 PICFLAGS="+z"
272                         fi
273                         DYNEXP="-Wl,-E"
274                         ;;
275                 *qnx*)
276                         ;;
277                 *osf*)
278                         BLDSHARED="true"
279                         LDSHFLAGS="-shared"
280                         SONAMEFLAG="-Wl,-soname,"
281                         PICFLAGS="-fPIC"
282                         ;;
283                 *sco*)
284                         ;;
285                 *unixware*)
286                         BLDSHARED="true"
287                         LDSHFLAGS="-shared"
288                         SONAMEFLAG="-Wl,-soname,"
289                         PICFLAGS="-KPIC"
290                         ;;
291                 *next2*)
292                         ;;
293                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
294                         ;;
295                 *sysv4*)
296                         case "$host" in
297                                 *-univel-*)
298                                         LDSHFLAGS="-G"
299                                         DYNEXP="-Bexport"
300                                 ;;
301                                 *mips-sni-sysv4*) 
302                                 ;;
303                         esac
304                         ;;
306                 *sysv5*)
307                         LDSHFLAGS="-G"
308                         ;;
309                 *vos*)
310                         BLDSHARED="false"
311                         LDSHFLAGS=""
312                         ;;
313                 *darwin*)
314                         BLDSHARED="true"
315                         LDSHFLAGS="-bundle -flat_namespace -undefined suppress"
316                         SHLIBEXT="dylib"
317                         ;;
318                 *)
319                         ;;
320   esac
321   AC_SUBST(DYNEXP)
322   AC_MSG_RESULT($BLDSHARED)
323   AC_MSG_CHECKING([linker flags for shared libraries])
324   AC_MSG_RESULT([$LDSHFLAGS])
325   AC_MSG_CHECKING([compiler flags for position-independent code])
326   AC_MSG_RESULT([$PICFLAGS])
329 #######################################################
330 # test whether building a shared library actually works
331 if test $BLDSHARED = true; then
332 AC_CACHE_CHECK([whether building shared libraries actually works], 
333                [ac_cv_shlib_works],[
334    ac_cv_shlib_works=no
335    # try building a trivial shared library
336    if test "$PICSUFFIX" = "po"; then
337      $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o shlib.po ${SAMBA_SOURCE}/../tests/shlib.c &&
338        $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po &&
339        ac_cv_shlib_works=yes
340    else
341      $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o shlib.$PICSUFFIX ${SAMBA_SOURCE}/../tests/shlib.c &&
342        mv shlib.$PICSUFFIX shlib.po &&
343        $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po &&
344        ac_cv_shlib_works=yes
345    fi
346    rm -f "shlib.$SHLIBEXT" shlib.po
348 if test $ac_cv_shlib_works = no; then
349    BLDSHARED=false
350    AC_MSG_WARN([[Did you forget to specify --with-samba-source=/path/to/samba?]])
357 AC_OUTPUT(Makefile)