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