Make skeleton VFSs compile with new EA modules.
[sfrench/samba-autobuild/.git] / examples / VFS / configure.in
1 dnl -*- mode: m4-mode -*-
2 dnl Process this file with autoconf to produce a configure script.
3
4 dnl We must use autotools 2.53 or above
5 AC_PREREQ(2.53)
6 AC_INIT(Makefile.in)
7
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
11 #echo "" > confdefs.h
12
13 dnl Checks for programs.
14 AC_PROG_CC
15 AC_PROG_INSTALL
16
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)
22
23 AC_ARG_WITH(fhs, 
24 [  --with-fhs              Use FHS-compliant paths (default=no)],
25     libdir="\${prefix}/lib/samba",
26     libdir="\${prefix}/lib")
27
28 AC_SUBST(libdir)
29
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)],
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])
46
47 AC_SUBST(SAMBA_SOURCE)
48
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(PICFLAG)
57 AC_SUBST(PICSUFFIX)
58 AC_SUBST(POBAD_CC)
59 AC_SUBST(SHLIBEXT)
60 AC_SUBST(INSTALLCLIENTCMD_SH)
61 AC_SUBST(INSTALLCLIENTCMD_A)
62 AC_SUBST(SHLIB_PROGS)
63 AC_SUBST(EXTRA_BIN_PROGS)
64 AC_SUBST(EXTRA_SBIN_PROGS)
65 AC_SUBST(EXTRA_ALL_TARGETS)
66
67 AC_ARG_ENABLE(debug, 
68 [  --enable-debug          Turn on compiler debugging information (default=no)],
69     [if eval "test x$enable_debug = xyes"; then
70         CFLAGS="${CFLAGS} -g"
71     fi])
72
73 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
74     [if eval "test x$enable_developer = xyes"; then
75         developer=yes
76         CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
77     fi])
78
79 # compile with optimization and without debugging by default, but
80 # allow people to set their own preference.
81 if test "x$CFLAGS" = x
82 then
83   CFLAGS="-O ${CFLAGS}"
84 fi
85
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@//`"
93     FOUND_KRB5=yes
94     AC_MSG_RESULT(yes)
95   else
96     AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
97   fi
98   
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)
103   AC_ARG_WITH(krb5,
104   [  --with-krb5=base-dir    Locate Kerberos 5 support (default=/usr)],
105   [ case "$withval" in
106     no)
107       AC_MSG_RESULT(no)
108       ;;
109     *)
110       AC_MSG_RESULT(yes)
111       CFLAGS="$CFLAGS -I$withval/include"
112       CPPFLAGS="$CPPFLAGS -I$withval/include"
113       FOUND_KRB5=yes
114       ;;
115     esac ],
116     AC_MSG_RESULT(no)
117   )
118   fi
119
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"
128         AC_MSG_RESULT(yes)
129     else
130         CFLAGS="$CFLAGS -I/usr/include/heimdal"
131         CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
132         AC_MSG_RESULT(yes)
133  
134     fi
135 else
136     AC_MSG_RESULT(no)
137 fi
138 fi
139
140
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"
149     AC_MSG_RESULT(yes)
150 else
151     AC_MSG_RESULT(no)
152 fi
153 fi
154
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
157   # include paths
158   AC_CHECK_HEADERS(krb5.h)
159
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)
163
164 #dnl Check if we use GNU ld
165 #LD=ld
166 #AC_PROG_LD_GNU
167
168 #dnl look for executable suffix
169 #AC_EXEEXT
170
171 builddir=`pwd`
172 AC_SUBST(builddir)
173
174 # Assume non-shared by default and override below
175 BLDSHARED="false"
176
177 # these are the defaults, good for lots of systems
178 HOST_OS="$host_os"
179 LDSHFLAGS="-shared"
180 SONAMEFLAG="#"
181 SHLD="\${CC}"
182 PICFLAG=""
183 PICSUFFIX="po"
184 POBAD_CC="#"
185 SHLIBEXT="so"
186
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
191
192   AC_MSG_CHECKING([ability to build shared libraries])
193
194   # and these are for particular systems
195   case "$host_os" in
196                 *linux*)
197                         BLDSHARED="true"
198                         LDSHFLAGS="-shared" 
199                         DYNEXP="-Wl,--export-dynamic"
200                         PICFLAG="-fPIC"
201                         SONAMEFLAG="-Wl,-soname="
202                         ;;
203                 *solaris*)
204                         BLDSHARED="true"
205                         LDSHFLAGS="-G"
206                         SONAMEFLAG="-h "
207                         if test "${GCC}" = "yes"; then
208                                 PICFLAG="-fPIC"
209                                 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
210                                         DYNEXP="-Wl,-E"
211                                 fi
212                         else
213                                 PICFLAG="-KPIC"
214                                 ## ${CFLAGS} added for building 64-bit shared 
215                                 ## libs using Sun's Compiler
216                                 LDSHFLAGS="-G \${CFLAGS}"
217                                 POBAD_CC=""
218                                 PICSUFFIX="po.o"
219                         fi
220                         ;;
221                 *sunos*)
222                         BLDSHARED="true"
223                         LDSHFLAGS="-G"
224                         SONAMEFLAG="-Wl,-h,"
225                         PICFLAG="-KPIC"   # Is this correct for SunOS
226                         ;;
227                 *netbsd* | *freebsd*)  BLDSHARED="true"
228                         LDSHFLAGS="-shared"
229                         DYNEXP="-Wl,--export-dynamic"
230                         SONAMEFLAG="-Wl,-soname,"
231                         PICFLAG="-fPIC -DPIC"
232                         ;;
233                 *openbsd*)  BLDSHARED="true"
234                         LDSHFLAGS="-shared"
235                         DYNEXP="-Wl,-Bdynamic"
236                         SONAMEFLAG="-Wl,-soname,"
237                         PICFLAG="-fPIC"
238                         ;;
239                 *irix*)
240                         case "$host_os" in
241                         *irix6*)
242                         ;;
243                         esac
244                         ATTEMPT_WRAP32_BUILD=yes
245                         BLDSHARED="true"
246                         LDSHFLAGS="-set_version sgi1.0 -shared"
247                         SONAMEFLAG="-soname "
248                         SHLD="\${LD}"
249                         if test "${GCC}" = "yes"; then
250                                 PICFLAG="-fPIC"
251                         else 
252                                 PICFLAG="-KPIC"
253                         fi
254                         ;;
255                 *aix*)
256                         BLDSHARED="true"
257                         LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
258                         DYNEXP="-Wl,-brtl,-bexpall"
259                         PICFLAG="-O2"
260                         if test "${GCC}" != "yes"; then
261                                 ## for funky AIX compiler using strncpy()
262                                 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
263                         fi
264                         ;;
265                 *hpux*)
266                         SHLIBEXT="sl"
267                         # Use special PIC flags for the native HP-UX compiler.
268                         if test $ac_cv_prog_cc_Ae = yes; then
269                                 BLDSHARED="true"
270                                 SHLD="/usr/bin/ld"
271                                 LDSHFLAGS="-B symbolic -b -z"
272                                 SONAMEFLAG="+h "
273                                 PICFLAG="+z"
274                         fi
275                         DYNEXP="-Wl,-E"
276                         ;;
277                 *qnx*)
278                         ;;
279                 *osf*)
280                         BLDSHARED="true"
281                         LDSHFLAGS="-shared"
282                         SONAMEFLAG="-Wl,-soname,"
283                         PICFLAG="-fPIC"
284                         ;;
285                 *sco*)
286                         ;;
287                 *unixware*)
288                         BLDSHARED="true"
289                         LDSHFLAGS="-shared"
290                         SONAMEFLAG="-Wl,-soname,"
291                         PICFLAG="-KPIC"
292                         ;;
293                 *next2*)
294                         ;;
295                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
296                         ;;
297                 *sysv4*)
298                         case "$host" in
299                                 *-univel-*)
300                                         LDSHFLAGS="-G"
301                                         DYNEXP="-Bexport"
302                                 ;;
303                                 *mips-sni-sysv4*) 
304                                 ;;
305                         esac
306                         ;;
307
308                 *sysv5*)
309                         LDSHFLAGS="-G"
310                         ;;
311                 *vos*)
312                         BLDSHARED="false"
313                         LDSHFLAGS=""
314                         ;;
315                 *)
316                         ;;
317   esac
318   AC_SUBST(DYNEXP)
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])
324 fi
325
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],[
331    ac_cv_shlib_works=no
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
337    else
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
342    fi
343    rm -f "shlib.$SHLIBEXT" shlib.po
344 ])
345 if test $ac_cv_shlib_works = no; then
346    BLDSHARED=false
347 fi
348 fi
349
350
351
352
353 AC_OUTPUT(Makefile)