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