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