Whamcloud - gitweb
ChangeLog, pass3.c, problem.c:
[tools/e2fsprogs.git] / configure.in
1 AC_INIT(version.h)
2 AC_PREREQ(2.12)
3 MCONFIG=./MCONFIG
4 AC_SUBST_FILE(MCONFIG)
5 BINARY_TYPE=bin
6 dnl
7 dnl This is to figure out the version number and the date....
8 dnl
9 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h  \
10         | awk '{print $3}' | tr \" " " | awk '{print $1}'`
11 DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
12         | tr \" " "`
13 MONTH=`echo $DATE | awk -F- '{print $2}'`
14 YEAR=`echo $DATE | awk -F- '{print $3}'`
15
16 if expr $YEAR ">" 90 >/dev/null ; then
17         E2FSPROGS_YEAR=19$YEAR
18 else
19         E2FSPROGS_YEAR=20$YEAR
20 fi
21
22 case $MONTH in
23 Jan)    E2FSPROGS_MONTH="January" ;;
24 Feb)    E2FSPROGS_MONTH="February" ;;
25 Mar)    E2FSPROGS_MONTH="March" ;;
26 Apr)    E2FSPROGS_MONTH="April" ;;
27 May)    E2FSPROGS_MONTH="May" ;;
28 Jun)    E2FSPROGS_MONTH="June" ;;
29 Jul)    E2FSPROGS_MONTH="July" ;;
30 Aug)    E2FSPROGS_MONTH="August" ;;
31 Sep)    E2FSPROGS_MONTH="September" ;;
32 Oct)    E2FSPROGS_MONTH="October" ;;
33 Nov)    E2FSPROGS_MONTH="November" ;;
34 Dec)    E2FSPROGS_MONTH="December" ;;
35 *)      echo "Unknown month $MONTH??" ;;
36 esac
37
38 unset DATE MONTH YEAR
39 echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION"
40 echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}"
41 AC_SUBST(E2FSPROGS_YEAR)
42 AC_SUBST(E2FSPROGS_MONTH)
43 AC_SUBST(E2FSPROGS_VERSION)
44 AC_REQUIRE([AC_CANONICAL_HOST])
45 dnl
46 dnl set $(CC) from --with-cc=value
47 dnl
48 AC_ARG_WITH([cc],
49 [  --with-cc=COMPILER      select compiler to use],
50 AC_MSG_RESULT(CC=$withval)
51 CC=$withval,
52 if test -z "$CC" ; then CC=cc; fi
53 [AC_MSG_RESULT(CC defaults to $CC)])dnl
54 export CC
55 AC_SUBST([CC])
56 dnl
57 dnl set $(LD) from --with-linker=value
58 dnl
59 AC_ARG_WITH([linker],
60 [  --with-linker=LINKER    select linker to use],
61 AC_MSG_RESULT(LD=$withval)
62 LD=$withval,
63 if test -z "$LD" ; then LD=$CC; fi
64 [AC_MSG_RESULT(LD defaults to $LD)])dnl
65 export LD
66 AC_SUBST([LD])
67 dnl
68 dnl set $(CCOPTS) from --with-ccopts=value
69 dnl
70 AC_ARG_WITH([ccopts],
71 [  --with-ccopts=CCOPTS    select compiler command line options],
72 AC_MSG_RESULT(CCOPTS is $withval)
73 CCOPTS=$withval
74 CFLAGS="$CFLAGS $withval",
75 CCOPTS=)dnl
76 AC_SUBST(CCOPTS)
77 dnl
78 dnl Set default values for library extentions.  Will be dealt with after
79 dnl parsing configuration opions, which may modify these
80 dnl
81 LIB_EXT=.a
82 STATIC_LIB_EXT=.a
83 PROFILE_LIB_EXT=.a
84 dnl
85 dnl set $(LDFLAGS) from --with-ldopts=value
86 dnl
87 AC_ARG_WITH([ldopts],
88 [  --with-ldopts=LDOPTS    select linker command line options],
89 AC_MSG_RESULT(LDFLAGS is $withval)
90 LDFLAGS=$withval,
91 LDFLAGS=)dnl
92 AC_SUBST(LDFLAGS)
93 dnl
94 dnl Allow separate `root_prefix' to be specified
95 dnl
96 AC_ARG_WITH([root-prefix],
97 [  --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
98 root_prefix=$withval,
99 root_prefix=NONE)dnl
100 dnl
101 dnl handle --enable-dll-shlibs
102 dnl
103 AC_ARG_ENABLE([dll-shlibs],
104 [  --enable-dll-shlibs    select DLL libraries],
105 if test "$enableval" = "no"
106 then
107         DLL_CMT=#
108         MAKEFILE_DLL=/dev/null
109         echo "Disabling DLL shared libraries"
110 else
111         DLL_CMT=
112         MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
113         BINARY_TYPE=dllbin
114         LIB_EXT=.sa
115         echo "Enabling DLL shared libraries"
116 fi
117 ,
118 MAKEFILE_DLL=/dev/null
119 DLL_CMT=#
120 echo "Disabling DLL shared libraries by default"
121 )
122 AC_SUBST(DLL_CMT)
123 AC_SUBST_FILE(MAKEFILE_DLL)
124 dnl
125 dnl handle --enable-elf-shlibs
126 dnl
127 AC_ARG_ENABLE([elf-shlibs],
128 [  --enable-elf-shlibs    select ELF shared libraries],
129 if test "$enableval" = "no"
130 then
131         ELF_CMT=#
132         MAKEFILE_ELF=/dev/null
133         echo "Disabling ELF shared libraries"
134 else
135         ELF_CMT=
136         MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
137         BINARY_TYPE=elfbin
138         LIB_EXT=.so
139         echo "Enabling ELF shared libraries"
140 fi
141 ,
142 MAKEFILE_ELF=/dev/null
143 ELF_CMT=#
144 echo "Disabling ELF shared libraries by default"
145 )
146 AC_SUBST(ELF_CMT)
147 AC_SUBST_FILE(MAKEFILE_ELF)
148 dnl
149 dnl handle --enable-bsd-shlibs
150 dnl
151 AC_ARG_ENABLE([bsd-shlibs],
152 [  --enable-bsd-shlibs    select BSD shared libraries],
153 if test "$enableval" = "no"
154 then
155         BSDLIB_CMT=#
156         MAKEFILE_BSDLIB=/dev/null
157         echo "Disabling BSD shared libraries"
158 else
159         BSDLIB_CMT=
160         MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
161         LIB_EXT=.so
162         echo "Enabling BSD shared libraries"
163 fi
164 ,
165 MAKEFILE_BSDLIB=/dev/null
166 BSDLIB_CMT=#
167 echo "Disabling BSD shared libraries by default"
168 )
169 AC_SUBST(BSDLIB_CMT)
170 AC_SUBST_FILE(MAKEFILE_BSDLIB)
171 dnl
172 dnl handle --enable-profile
173 dnl
174 AC_ARG_ENABLE([profile],
175 [  --enable-profile       build profiling libraries],
176 if test "$enableval" = "no"
177 then
178         PROFILE_CMT=#
179         MAKEFILE_PROFILE=/dev/null
180         echo "Disabling profiling libraries"
181 else
182         PROFILE_CMT=
183         MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
184         PROFILED_LIB_EXT=_p.a
185         echo "Building profiling libraries"
186 fi
187 ,
188 PROFILE_CMT=#
189 MAKEFILE_PROFILE=/dev/null
190 echo "Disabling profiling libraries by default"
191 )
192 AC_SUBST(PROFILE_CMT)
193 AC_SUBST_FILE(MAKEFILE_PROFILE)
194 dnl
195 dnl handle --enable-checker
196 dnl
197 AC_ARG_ENABLE([checker],
198 [  --enable-checker       build checker libraries],
199 if test "$enableval" = "no"
200 then
201         CHECKER_CMT=#
202         MAKEFILE_CHECKER=/dev/null
203         echo "Disabling checker libraries"
204 else
205         CHECKER_CMT=
206         MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
207         echo "Building checker libraries"
208 fi
209 ,
210 CHECKER_CMT=#
211 MAKEFILE_CHECKER=/dev/null
212 echo "Disabling checker libraries by default"
213 )
214 AC_SUBST(CHECKER_CMT)
215 AC_SUBST_FILE(MAKEFILE_CHECKER)
216 dnl
217 dnl Substitute library extensions
218 dnl
219 AC_SUBST(LIB_EXT)
220 AC_SUBST(STATIC_LIB_EXT)
221 AC_SUBST(PROFILED_LIB_EXT)
222 dnl
223 dnl handle --enable-gcc-wall
224 dnl
225 AC_ARG_ENABLE([gcc-wall],
226 [  --enable-gcc-wall      enable GCC anal warnings (DON'T USE IN PRODUCTION)],
227 if test "$enableval" = "no"
228 then
229         W=#
230         echo "Disabling GCC warnings"
231 else
232         W=
233         echo "Enabling GCC warnings"
234 fi
235 ,
236 W=#
237 echo "Disabling GCC warnings by default"
238 )
239 AC_SUBST(W)
240 AC_ARG_ENABLE([dynamic-e2fsck],
241 [  --enable-dynamic-e2fsck build e2fsck dynamically],
242 if test "$enableval" = "no"
243 then
244         E2FSCK_TYPE=static
245         echo "Building e2fsck statically"
246 else
247         E2FSCK_TYPE=shared
248         echo "Building e2fsck dynamically"
249 fi
250 ,
251 E2FSCK_TYPE=static
252 echo "Building e2fsck statically by default"
253 )
254 AC_SUBST(E2FSCK_TYPE)
255 dnl
256 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
257 dnl
258 AC_ARG_ENABLE([fsck],
259 [  --enable-fsck           build fsck wrapper program],
260 [if test "$enableval" = "no"
261 then
262         FSCK_PROG='' FSCK_MAN=''
263         echo "Not building fsck wrapper"
264 else
265         FSCK_PROG=fsck FSCK_MAN=fsck.8
266         echo "Building fsck wrapper"
267 fi]
268 ,
269 [case "$host_os" in
270   gnu*)
271     FSCK_PROG='' FSCK_MAN=''
272     echo "Not building fsck wrapper by default"
273     ;;
274   *)
275     FSCK_PROG=fsck FSCK_MAN=fsck.8
276     echo "Building fsck wrapper by default"
277 esac]
278 )
279 AC_SUBST(FSCK_PROG)
280 AC_SUBST(FSCK_MAN)
281 dnl
282 dnl
283 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
284 AC_SUBST_FILE(MAKEFILE_LIBRARY)
285 dnl
286 dnl
287 AC_ARG_ENABLE([old-bitops],
288 [  --enable-old-bitops    Use old (non-standard but native) bitmask operations],
289 if test "$enableval" = "no"
290 then
291         echo "Using new (standard) bitmask operations"
292 else
293         AC_DEFINE(EXT2_OLD_BITOPS)
294         echo "Using old (native) bitmask operations"
295
296 fi
297 ,
298 echo "Using standard bitmask operations by default"
299 )
300 dnl
301 dnl End of configuration options
302 dnl
303 AC_SUBST(BINARY_TYPE)
304 AC_PROG_MAKE_SET
305 AC_PATH_PROG(LN, ln, ln)
306 AC_PROG_LN_S
307 AC_PATH_PROG(MV, mv, mv)
308 AC_PATH_PROG(CP, cp, cp)
309 AC_PATH_PROG(RM, rm, rm)
310 AC_PATH_PROG(CHMOD, chmod, :)
311 AC_PATH_PROG(AWK, awk, awk)
312 AC_PATH_PROG(SED, sed, sed)
313 AC_CHECK_TOOL(AR, ar, ar)
314 AC_CHECK_TOOL(RANLIB, ranlib, :)
315 AC_CHECK_TOOL(STRIP, strip, :)
316 AC_PROG_CC
317 AC_PROG_INSTALL
318 AC_C_CROSS
319 AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h mntent.h paths.h dirent.h getopt.h setjmp.h linux/fd.h linux/major.h sys/disklabel.h sys/sockio.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h)
320 AC_FUNC_VPRINTF
321 dnl
322 dnl See if struct dirent has a d_namlen field (like bsd systems), implying
323 dnl that the actual length of the structure may be grater than the declared
324 dnl length. 
325 dnl
326 AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
327 AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
328         AC_TRY_COMPILE(
329 [#include <sys/types.h>
330 #include <dirent.h>],
331                 [struct dirent de; de.d_namlen = 0;],
332                 [e2fsprogs_cv_struct_d_namlen=yes],
333                 [e2fsprogs_cv_struct_d_namlen=no]))
334 AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
335 if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
336   AC_DEFINE(HAVE_DIRENT_NAMLEN)
337 fi
338 dnl
339 dnl Check to see if llseek() is declared in unistd.h.  On some libc's 
340 dnl it is, and on others it isn't..... Thank you glibc developers....
341 dnl
342 dnl Warning!  Use of --enable-gcc-wall may throw off this test.
343 dnl
344 dnl
345 AC_MSG_CHECKING(whether llseek declared in unistd.h)
346 AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
347         AC_TRY_COMPILE(
348 [#include <unistd.h>], [extern int llseek(int);],
349         [e2fsprogs_cv_have_llseek_prototype=no],
350         [e2fsprogs_cv_have_llseek_prototype=yes]))
351 AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
352 if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
353    AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
354 fi
355 dnl
356 dnl Word sizes...
357 dnl
358 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
359   # if cross-compiling, with no cached values, just assume something common. 
360   ac_cv_sizeof_short=2
361   ac_cv_sizeof_int=4
362   ac_cv_sizeof_long=4
363   ac_cv_sizeof_long_long=0
364   AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
365 fi
366 AC_CHECK_SIZEOF(short)
367 AC_CHECK_SIZEOF(int)
368 AC_CHECK_SIZEOF(long)
369 AC_CHECK_SIZEOF(long long)
370 SIZEOF_SHORT=$ac_cv_sizeof_short
371 SIZEOF_INT=$ac_cv_sizeof_int
372 SIZEOF_LONG=$ac_cv_sizeof_long
373 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
374 AC_SUBST(SIZEOF_SHORT)
375 AC_SUBST(SIZEOF_INT)
376 AC_SUBST(SIZEOF_LONG)
377 AC_SUBST(SIZEOF_LONG_LONG)
378 dnl
379 dnl See if struct stat has a st_flags field, in which case we can get file
380 dnl flags somewhat portably.  Also check for the analogous setter, chflags().
381 dnl
382 AC_MSG_CHECKING(whether struct stat has a st_flags field)
383 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
384         AC_TRY_COMPILE([#include <sys/stat.h>],
385                 [struct stat stat; stat.st_flags = 0;],
386                 [e2fsprogs_cv_struct_st_flags=yes],
387                 [e2fsprogs_cv_struct_st_flags=no]))
388 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
389 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
390   AC_DEFINE(HAVE_STAT_FLAGS)
391 fi
392 AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo strcasecmp srandom fchown)
393 dnl
394 dnl Check to see if ino_t is defined
395 dnl
396 AC_MSG_CHECKING(ino_t defined by sys/types.h)
397 AC_CACHE_VAL(e2fsprogs_cv_ino_t,
398         AC_TRY_COMPILE([#include <sys/types.h>],
399         [ino_t ino; ino = 0;],
400         [e2fsprogs_cv_ino_t=yes],
401         [e2fsprogs_cv_ino_t=no]))
402 AC_MSG_RESULT($e2fsprogs_cv_ino_t)
403 if test "$e2fsprogs_cv_ino_t" = yes; then
404    AC_DEFINE(HAVE_INO_T)
405 fi
406 dnl
407 dnl On systems without linux header files, we add an extra include directory
408 dnl that holds enough to fake it (hopefully).  Note that the $(top_srcdir) here
409 dnl is quoted so that it gets expanded by make, not by configure.
410 dnl
411 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
412 if test "$linux_headers" = yes; then
413   AC_DEFINE(HAVE_LINUX_FS_H)
414 else
415   LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
416   # Use this include directory with test compiles in the configure script too.
417   CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
418 fi
419 AC_SUBST(LINUX_INCLUDE)
420 dnl
421 dnl Check to see if -lsocket is required (solaris) to make something
422 dnl that uses socket() to compile; this is needed for the UUID library
423 dnl
424 SOCKET_LIB=''
425 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
426 AC_SUBST(SOCKET_LIB)
427 dnl
428 dnl See if optreset exists
429 dnl
430 AC_MSG_CHECKING(for optreset)
431 AC_CACHE_VAL(ac_cv_have_optreset,
432 [AC_EGREP_HEADER(optreset, unistd.h,
433   ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
434 AC_MSG_RESULT($ac_cv_have_optreset)
435 if test $ac_cv_have_optreset = yes; then
436   AC_DEFINE(HAVE_OPTRESET)
437 fi
438 dnl
439 dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
440 dnl
441 AC_MSG_CHECKING(whether the ext2 ioctls compile)
442 AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
443         AC_TRY_COMPILE([#include <linux/ext2_fs.h>
444 #include <sys/ioctl.h>],
445                 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
446                 [e2fsprogs_cv_ioctl_ext2=yes],
447                 [e2fsprogs_cv_ioctl_ext2=no]))
448 AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
449 if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
450   AC_DEFINE(HAVE_EXT2_IOCTLS)
451 fi
452 dnl
453 dnl Linux places root files in the / by default
454 dnl
455 case "$host_os" in
456 linux*)
457         if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
458                 root_prefix="";
459                 echo "On $host_os systems, root_prefix defaults to ''"
460         fi
461         ;;
462 esac
463 dnl
464 dnl On Linux/hurd, force the prefix to be /usr
465 dnl
466 case "$host_os" in
467 linux* | gnu*)
468         if test "$prefix" = NONE ; then
469                 prefix="/usr";
470                 echo "On $host_os systems, prefix defaults to /usr"
471         fi
472 ;;
473 esac
474 if test "$root_prefix" = NONE ; then
475         if test "$prefix" = NONE ; then
476                 root_prefix="$ac_default_prefix"
477         else
478                 root_prefix="$prefix"
479         fi
480 fi
481 AC_SUBST(root_prefix)
482 dnl
483 dnl See if -static works.
484 dnl
485 AC_MSG_CHECKING([whether linker accepts -static])
486 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
487 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
488 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
489  ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
490 LDFLAGS=$SAVE_LDFLAGS])
491 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
492 LDFLAG_STATIC=
493 if test $ac_cv_e2fsprogs_use_static = yes; then
494         LDFLAG_STATIC=-static
495 fi
496 AC_SUBST(LDFLAG_STATIC)
497 dnl
498 dnl Make the ss and et directories work correctly.
499 dnl
500 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
501 ET_DIR=`cd ${srcdir}/lib/et; pwd`
502 AC_SUBST(SS_DIR)
503 AC_SUBST(ET_DIR)
504 dnl
505 dnl Only try to run the test suite if we're not cross compiling.
506 dnl
507 if test "$cross_compiling" = yes ; then
508   DO_TEST_SUITE=
509 else
510   DO_TEST_SUITE=check
511 fi
512 AC_SUBST(DO_TEST_SUITE)
513 dnl
514 dnl
515 dnl
516 DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute
517 AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT)
518 dnl
519 dnl Make our output files, being sure that we create the some miscellaneous 
520 dnl directories
521 dnl
522 test -d lib || mkdir lib
523 test -d include || mkdir include
524 test -d include/linux || mkdir include/linux
525 rmakefile=
526 if test -d ${srcdir}/resize ; then
527    rmakefile=resize/Makefile
528 fi
529 AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile 
530         lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile
531         misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile 
532         tests/progs/Makefile $rmakefile doc/Makefile)