Release: captive7
[lufs.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.50)
3 AC_INIT(AUTHORS)
4 AM_CONFIG_HEADER(config.h)
5 AC_CANONICAL_SYSTEM
6 VERSION_BASE=0.9.7
7 VERSION_EXT=captive7
8 AC_SUBST(VERSION_BASE)
9 AC_SUBST(VERSION_EXT)
10 AM_INIT_AUTOMAKE(lufs,$VERSION_BASE$VERSION_EXT)
11 AM_MAINTAINER_MODE
12 dnl Some Makefiles use additional tests etc.
13 AM_CONDITIONAL(MAINTAINER_MODE,[test "$USE_MAINTAINER_MODE" = "yes"])
14
15 dnl "static" FSs
16 opt_fs="localfs gnetfs"
17
18 dnl Checks for programs.
19 AC_PROG_CC
20 AC_PROG_CPP
21 AC_PROG_INSTALL
22 AC_PROG_LN_S
23 AC_DISABLE_STATIC
24 AM_PROG_LIBTOOL
25 AC_PROG_MAKE_SET
26
27 AC_ARG_WITH(cxx, 
28     [  --with-cxx              permit use of C++ compiler for additional filesystems],
29     [
30         AC_PROG_CXX
31         opt_fs="$opt_fs locasefs ftpfs"
32     ],
33     [
34         AC_PROG_CXX(true)
35         CXX=false
36     ])
37
38 dnl Checking os
39 AC_MSG_CHECKING(OS)
40 OS_DIR=`uname -s`
41 if test ! -d kernel/$OS_DIR
42 then
43     AC_MSG_ERROR($OS_DIR - not supported!)
44 else
45     AC_MSG_RESULT($OS_DIR)
46 fi
47 AC_SUBST(OS_DIR)
48
49 dnl options
50 AC_ARG_ENABLE(debug,
51     [  --enable-debug          enable debug messages to stdout (default=no)],
52     [  DEBUG_FLAGS="-g -DDEBUG" && CXXFLAGS="-g -O2 -Wall -DDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" && CFLAGS="-g -O2 -Wall -DDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"],
53     [  CXXFLAGS="-O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" && CFLAGS="-O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"])
54 AC_SUBST(DEBUG_FLAGS)
55
56 AC_ARG_ENABLE(kdebug,
57     [  --enable-kdebug         enable kernel module debug messages (default=no)],
58     [  KDEBUG_FLAGS="-DLUFS_DEBUG -DLUFS_VERBOSE" ], )
59 AC_SUBST(KDEBUG_FLAGS)
60
61 AC_ARG_ENABLE(autofs-install,
62     [  --enable-autofs-install enable installing of autofs configuration (default=no)],
63     [  AUTOFS_INSTALL="yes"],)
64 AC_SUBST(AUTOFS_INSTALL)    
65
66 AC_ARG_ENABLE(suid,
67     [  --enable-suid           make lufsmnt suid root (default=yes)],
68     [ if test $enableval = "no"; then LUFS_SUID=""; else LUFS_SUID="true"; fi ] , LUFS_SUID="true" )
69 AC_SUBST(LUFS_SUID)
70
71
72 dnl Checking ssh
73 AC_MSG_CHECKING(for ssh)
74 AC_ARG_WITH(ssh, 
75         [  --with-ssh=PATH         specify the path to the ssh executable], 
76         [
77             if test "$CXX" = "false"
78             then
79                 AC_MSG_ERROR([Use --with-cxx to permit C++ compilation of sshfs.])
80             fi
81             SSHPROG=$withval
82             if test ! -x "$SSHPROG"
83             then
84                 AC_MSG_ERROR([Specified --with-ssh $SSHPROG is not executable.])
85             fi
86         ],[
87             if test "$CXX" = "false"
88             then
89                 SSHPROG=no
90             else
91                 if which ssh 2>/dev/null
92                 then
93                     SSHPROG=`which ssh`
94                 else
95                     SSHPROG=no
96                 fi
97             fi
98         ])
99 if test "$SSHPROG" = "no"
100 then
101     AC_MSG_RESULT([not found (sshfs support disabled)])
102 else
103     AC_MSG_RESULT([found ($SSHPROG)])
104     AC_DEFINE([HAS_SSH], 1 , [Define if ssh is found.])
105     opt_fs="$opt_fs sshfs"
106 fi
107 AC_SUBST(SSHPROG)
108
109
110 dnl Checking gnome
111 if test "$CXX" != "false"
112 then
113     AC_CHECK_PROG(GCONF, gnome-config, gnome-config)
114     AC_CHECK_PROG(GVFSCONF, gnome-vfs-config, gnome-vfs-config)
115     AC_CHECK_LIB(gnomevfs, gnome_vfs_init, HAS_GNOMEVFS=1,)
116     if test "$GCONF" -a "$GVFSCONF" -a "$HAS_GNOMEVFS"
117     then
118         AC_DEFINE([HAS_GVFS], 1, [Define if gvfs is to be built.])
119
120         GVFS_LDADD="`$GCONF --libs gnome` `$GVFSCONF --libs`"
121         GVFS_CFLAGS="`$GCONF --cflags gnome` `$GVFSCONF --cflags`"
122         opt_fs="$opt_fs gvfs"
123     fi
124 fi
125 AC_SUBST(GVFS_LDADD)
126 AC_SUBST(GVFS_CFLAGS)
127
128 AC_ARG_ENABLE(wavfs,
129         [  --enable-wavfs          build wavfs support (default=no)],
130         [
131             if test "$CXX" = "false"
132             then
133                 AC_MSG_ERROR([Use --with-cxx to permit C++ compilation of wavfs.])
134             fi
135             opt_fs="$opt_fs wavfs"
136         ],)
137
138
139 AC_ARG_ENABLE(cefs,
140         [  --enable-cefs           build cefs support (default=no)],
141         [
142             if test "$CXX" = "false"
143             then
144                 AC_MSG_ERROR([Use --with-cxx to permit C++ compilation of cefs.])
145             fi
146             opt_fs="$opt_fs cefs"
147         ],)
148
149 if test -n "$cefs_dir"; then
150     AC_DEFINE([HAS_CEFS], 1, [Define if cefs is to be built.])
151     AC_DEFINE([INFOFILE], ["/tmp/cedevices"], [Path to the information file for the RAPI library])
152 fi
153
154 AC_ARG_ENABLE(cardfs,
155         [  --enable-cardfs         build cardfs support (default=no)],
156         [ WITH_CARDFS=true ],)
157
158 dnl Checks for libraries.
159 AC_CHECK_LIB(pthread, pthread_detach,,AC_MSG_ERROR(libpthread is needed by lufs))
160
161
162 dnl Checks for header files.
163 AC_HEADER_STDC
164 AC_CHECK_HEADERS(unistd.h)
165
166
167 dnl This will test for endian-swapping headers
168 AC_CHECK_HEADERS(byteswap.h sys/byteswap.h endian.h machine/endian.h sys/types.h)
169
170
171 dnl Checks for typedefs, structures, and compiler characteristics.
172 AC_C_CONST
173 AC_TYPE_PID_T
174
175 dnl Checks for library functions.
176 AC_CHECK_FUNCS(mkdir rmdir)
177
178 if test -n "$WITH_CARDFS"; then
179     echo checking for cardfs
180     if test "$CXX" = "false"
181     then
182         AC_MSG_ERROR([Use --with-cxx to permit C++ compilation of cardfs.])
183     fi
184     AC_MSG_CHECKING(for libchipcard)
185     AC_ARG_WITH(chipcard-dir, 
186         [  --with-chipcard-dir=DIR uses libchipcard from given dir],
187         [cc_dir="$withval"],
188         [cc_dir="/usr/local/libchipcard \
189             /usr/local \
190             /usr/libchipcard \
191             /usr \
192             /"])
193     for li in $cc_dir; do
194         if test -x "$li/bin/libchipcard-config"; then
195             chipcard_dir="$li"
196         fi
197     done
198     if test -z "$chipcard_dir"; then
199         AC_MSG_RESULT([not found (chipcard support disabled)])
200     else
201         all_libraries="$all_libraries `$chipcard_dir/bin/libchipcard-config --libraries`"
202         all_includes="$all_includes `$chipcard_dir/bin/libchipcard-config --includes`"
203         AC_DEFINE([HAS_LIBCHIPCARD], 1, [Define if libchipcard is present.])
204         define_has_libchipcard="#define HAS_LIBCHIPCARD"
205         AC_SUBST(define_has_libchipcard)
206         LIBCHIPCARD_LIB="`$chipcard_dir/bin/libchipcard-config --libraries` -lcardfs"
207         LIBCHIPCARD_INCLUDES="`$chipcard_dir/bin/libchipcard-config --includes`"
208         AC_MSG_RESULT($chipcard_dir)
209         all_libraries="$all_libraries $libchipcard_libs"
210         all_includes="$all_includes $libchipcard_includes"
211         opt_fs="$opt_fs cardfs"
212     fi
213 fi
214 AC_SUBST(LIBCHIPCARD_LIB)
215 AC_SUBST(LIBCHIPCARD_INCLUDES)
216
217 all_includes="$all_includes -I`pwd`/include"
218
219 AC_SUBST(opt_fs)
220 AC_SUBST(all_includes)
221 AC_SUBST(all_libraries)
222
223 AC_OUTPUT(\
224         Makefile \
225         macros/Makefile \
226         lufsd/Makefile \
227         filesystems/Makefile \
228         filesystems/localfs/Makefile \
229         filesystems/locasefs/Makefile \
230         filesystems/sshfs/Makefile \
231         filesystems/ftpfs/Makefile \
232         filesystems/cardfs/Makefile \
233         filesystems/cefs/Makefile \
234         filesystems/cefs/asyncd/Makefile \
235         filesystems/gvfs/Makefile \
236         filesystems/gnetfs/Makefile \
237         filesystems/wavfs/Makefile \
238         util/Makefile \
239         kernel/Makefile \
240         kernel/Linux/Makefile \
241         kernel/Linux/2.4/Makefile \
242         kernel/Linux/2.6/Makefile \
243         kernel/Linux/modbin/Makefile \
244         include/Makefile \
245         docs/Makefile \
246         man/Makefile \
247         lufs.spec \
248         kernel/Linux/prepmod \
249         debian/changelog \
250         kernel/Linux/2.4/makefile \
251         kernel/Linux/2.6/makefile \
252         )
253
254 echo "###############################################################################"
255 echo " supported filesystems: $opt_fs"
256 echo -n " suid files: "
257 if test $LUFS_SUID; then echo "lufsmnt."; else echo "none."; fi
258 echo "###############################################################################"