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