Move VFS example skel.c to two different examples: one for opaque operations and...
[kai/samba.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 #dnl Check if we use GNU ld
87 #LD=ld
88 #AC_PROG_LD_GNU
89
90 #dnl look for executable suffix
91 #AC_EXEEXT
92
93 builddir=`pwd`
94 AC_SUBST(builddir)
95
96 # Assume non-shared by default and override below
97 BLDSHARED="false"
98
99 # these are the defaults, good for lots of systems
100 HOST_OS="$host_os"
101 LDSHFLAGS="-shared"
102 SONAMEFLAG="#"
103 SHLD="\${CC}"
104 PICFLAG=""
105 PICSUFFIX="po"
106 POBAD_CC="#"
107 SHLIBEXT="so"
108
109 if test "$enable_shared" = "yes"; then
110   # this bit needs to be modified for each OS that is suported by
111   # smbwrapper. You need to specify how to created a shared library and
112   # how to compile C code to produce PIC object files
113
114   AC_MSG_CHECKING([ability to build shared libraries])
115
116   # and these are for particular systems
117   case "$host_os" in
118                 *linux*)
119                         BLDSHARED="true"
120                         LDSHFLAGS="-shared" 
121                         DYNEXP="-Wl,--export-dynamic"
122                         PICFLAG="-fPIC"
123                         SONAMEFLAG="-Wl,-soname="
124                         ;;
125                 *solaris*)
126                         BLDSHARED="true"
127                         LDSHFLAGS="-G"
128                         SONAMEFLAG="-h "
129                         if test "${GCC}" = "yes"; then
130                                 PICFLAG="-fPIC"
131                                 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
132                                         DYNEXP="-Wl,-E"
133                                 fi
134                         else
135                                 PICFLAG="-KPIC"
136                                 ## ${CFLAGS} added for building 64-bit shared 
137                                 ## libs using Sun's Compiler
138                                 LDSHFLAGS="-G \${CFLAGS}"
139                                 POBAD_CC=""
140                                 PICSUFFIX="po.o"
141                         fi
142                         ;;
143                 *sunos*)
144                         BLDSHARED="true"
145                         LDSHFLAGS="-G"
146                         SONAMEFLAG="-Wl,-h,"
147                         PICFLAG="-KPIC"   # Is this correct for SunOS
148                         ;;
149                 *netbsd* | *freebsd*)  BLDSHARED="true"
150                         LDSHFLAGS="-shared"
151                         DYNEXP="-Wl,--export-dynamic"
152                         SONAMEFLAG="-Wl,-soname,"
153                         PICFLAG="-fPIC -DPIC"
154                         ;;
155                 *openbsd*)  BLDSHARED="true"
156                         LDSHFLAGS="-shared"
157                         DYNEXP="-Wl,-Bdynamic"
158                         SONAMEFLAG="-Wl,-soname,"
159                         PICFLAG="-fPIC"
160                         ;;
161                 *irix*)
162                         case "$host_os" in
163                         *irix6*)
164                         ;;
165                         esac
166                         ATTEMPT_WRAP32_BUILD=yes
167                         BLDSHARED="true"
168                         LDSHFLAGS="-set_version sgi1.0 -shared"
169                         SONAMEFLAG="-soname "
170                         SHLD="\${LD}"
171                         if test "${GCC}" = "yes"; then
172                                 PICFLAG="-fPIC"
173                         else 
174                                 PICFLAG="-KPIC"
175                         fi
176                         ;;
177                 *aix*)
178                         BLDSHARED="true"
179                         LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
180                         DYNEXP="-Wl,-brtl,-bexpall"
181                         PICFLAG="-O2"
182                         if test "${GCC}" != "yes"; then
183                                 ## for funky AIX compiler using strncpy()
184                                 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
185                         fi
186                         ;;
187                 *hpux*)
188                         SHLIBEXT="sl"
189                         # Use special PIC flags for the native HP-UX compiler.
190                         if test $ac_cv_prog_cc_Ae = yes; then
191                                 BLDSHARED="true"
192                                 SHLD="/usr/bin/ld"
193                                 LDSHFLAGS="-B symbolic -b -z"
194                                 SONAMEFLAG="+h "
195                                 PICFLAG="+z"
196                         fi
197                         DYNEXP="-Wl,-E"
198                         ;;
199                 *qnx*)
200                         ;;
201                 *osf*)
202                         BLDSHARED="true"
203                         LDSHFLAGS="-shared"
204                         SONAMEFLAG="-Wl,-soname,"
205                         PICFLAG="-fPIC"
206                         ;;
207                 *sco*)
208                         ;;
209                 *unixware*)
210                         BLDSHARED="true"
211                         LDSHFLAGS="-shared"
212                         SONAMEFLAG="-Wl,-soname,"
213                         PICFLAG="-KPIC"
214                         ;;
215                 *next2*)
216                         ;;
217                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
218                         ;;
219                 *sysv4*)
220                         case "$host" in
221                                 *-univel-*)
222                                         LDSHFLAGS="-G"
223                                         DYNEXP="-Bexport"
224                                 ;;
225                                 *mips-sni-sysv4*) 
226                                 ;;
227                         esac
228                         ;;
229
230                 *sysv5*)
231                         LDSHFLAGS="-G"
232                         ;;
233                 *vos*)
234                         BLDSHARED="false"
235                         LDSHFLAGS=""
236                         ;;
237                 *)
238                         ;;
239   esac
240   AC_SUBST(DYNEXP)
241   AC_MSG_RESULT($BLDSHARED)
242   AC_MSG_CHECKING([linker flags for shared libraries])
243   AC_MSG_RESULT([$LDSHFLAGS])
244   AC_MSG_CHECKING([compiler flags for position-independent code])
245   AC_MSG_RESULT([$PICFLAGS])
246 fi
247
248 #######################################################
249 # test whether building a shared library actually works
250 if test $BLDSHARED = true; then
251 AC_CACHE_CHECK([whether building shared libraries actually works], 
252                [ac_cv_shlib_works],[
253    ac_cv_shlib_works=no
254    # try building a trivial shared library
255    if test "$PICSUFFIX" = "po"; then
256      $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c &&
257        $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po &&
258        ac_cv_shlib_works=yes
259    else
260      $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c &&
261        mv shlib.$PICSUFFIX shlib.po &&
262        $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po &&
263        ac_cv_shlib_works=yes
264    fi
265    rm -f "shlib.$SHLIBEXT" shlib.po
266 ])
267 if test $ac_cv_shlib_works = no; then
268    BLDSHARED=false
269 fi
270 fi
271
272
273
274
275 AC_OUTPUT(Makefile)