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