]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - configure.in
debian: Improve uuid-runtime package description
[thirdparty/e2fsprogs.git] / configure.in
CommitLineData
50e1e10f 1AC_INIT(version.h)
b0cacab0
TT
2AC_PREREQ(2.50)
3AC_CONFIG_AUX_DIR(config)
50e1e10f
TT
4MCONFIG=./MCONFIG
5AC_SUBST_FILE(MCONFIG)
74becf3c
TT
6BINARY_TYPE=bin
7dnl
8dnl This is to figure out the version number and the date....
9dnl
10E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
11 | awk '{print $3}' | tr \" " " | awk '{print $1}'`
12DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
13 | tr \" " "`
bff0cc95 14E2FSPROGS_DAY=`echo $DATE | awk -F- '{print $1}'`
74becf3c
TT
15MONTH=`echo $DATE | awk -F- '{print $2}'`
16YEAR=`echo $DATE | awk -F- '{print $3}'`
17
40fa8cc9
TT
18if expr $YEAR ">" 1900 > /dev/null ; then
19 E2FSPROGS_YEAR=$YEAR
20elif expr $YEAR ">" 90 >/dev/null ; then
74becf3c
TT
21 E2FSPROGS_YEAR=19$YEAR
22else
23 E2FSPROGS_YEAR=20$YEAR
24fi
25
26case $MONTH in
927566a3
AD
27Jan) MONTH_NUM=01; E2FSPROGS_MONTH="January" ;;
28Feb) MONTH_NUM=02; E2FSPROGS_MONTH="February" ;;
29Mar) MONTH_NUM=03; E2FSPROGS_MONTH="March" ;;
30Apr) MONTH_NUM=04; E2FSPROGS_MONTH="April" ;;
31May) MONTH_NUM=05; E2FSPROGS_MONTH="May" ;;
32Jun) MONTH_NUM=06; E2FSPROGS_MONTH="June" ;;
33Jul) MONTH_NUM=07; E2FSPROGS_MONTH="July" ;;
34Aug) MONTH_NUM=08; E2FSPROGS_MONTH="August" ;;
35Sep) MONTH_NUM=09; E2FSPROGS_MONTH="September" ;;
36Oct) MONTH_NUM=10; E2FSPROGS_MONTH="October" ;;
37Nov) MONTH_NUM=11; E2FSPROGS_MONTH="November" ;;
38Dec) MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
74becf3c
TT
39*) echo "Unknown month $MONTH??" ;;
40esac
41
927566a3
AD
42base_ver=`echo $E2FSPROGS_VERSION | \
43 sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
927566a3
AD
44
45date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
46
47case $E2FSPROGS_VERSION in
48*-WIP|pre-*)
d69e7e28 49 pre_vers=`echo $base_ver 0.01 - p | dc`
927566a3
AD
50 E2FSPROGS_PKGVER="$pre_vers+${base_ver}_WIP_$date_spec"
51 ;;
52*)
53 E2FSPROGS_PKGVER="$base_ver"
54 ;;
55esac
56
57unset DATE MONTH YEAR base_ver pre_vers date_spec
74becf3c
TT
58echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION"
59echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}"
60AC_SUBST(E2FSPROGS_YEAR)
61AC_SUBST(E2FSPROGS_MONTH)
bff0cc95 62AC_SUBST(E2FSPROGS_DAY)
74becf3c 63AC_SUBST(E2FSPROGS_VERSION)
927566a3 64AC_SUBST(E2FSPROGS_PKGVER)
ea97be5a 65AC_CANONICAL_HOST
74becf3c 66dnl
d21ae6c5
TT
67dnl Use diet libc
68dnl
69AC_ARG_WITH([diet-libc],
3249394d 70[ --with-diet-libc use diet libc],
d21ae6c5 71CC="diet cc -nostdinc"
d21ae6c5
TT
72AC_MSG_RESULT(CC=$CC))dnl
73dnl
74becf3c
TT
74dnl set $(CC) from --with-cc=value
75dnl
76AC_ARG_WITH([cc],
77[ --with-cc=COMPILER select compiler to use],
78AC_MSG_RESULT(CC=$withval)
79CC=$withval,
80if test -z "$CC" ; then CC=cc; fi
81[AC_MSG_RESULT(CC defaults to $CC)])dnl
82export CC
83AC_SUBST([CC])
73ae2d4a 84AC_PROG_CC
29a5deed 85AC_PROG_CPP
74becf3c
TT
86dnl
87dnl set $(LD) from --with-linker=value
88dnl
89AC_ARG_WITH([linker],
90[ --with-linker=LINKER select linker to use],
91AC_MSG_RESULT(LD=$withval)
92LD=$withval,
93if test -z "$LD" ; then LD=$CC; fi
94[AC_MSG_RESULT(LD defaults to $LD)])dnl
95export LD
96AC_SUBST([LD])
97dnl
98dnl set $(CCOPTS) from --with-ccopts=value
99dnl
100AC_ARG_WITH([ccopts],
101[ --with-ccopts=CCOPTS select compiler command line options],
102AC_MSG_RESULT(CCOPTS is $withval)
877eb6d9
TT
103CFLAGS=$withval,
104)dnl
74becf3c 105dnl
f8bd9807
TT
106dnl On systems without linux header files, we add an extra include directory
107dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
108dnl is quoted so that it gets expanded by make, not by configure.
109dnl
110AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
73ae2d4a
TT
111if test "$linux_headers" != yes; then
112 LINUX_INCLUDE='-I$(top_builddir)/include'
f8bd9807
TT
113fi
114AC_SUBST(LINUX_INCLUDE)
115dnl
b1c92f91
MA
116dnl Alpha computers use fast and imprecise floating point code that may
117dnl miss exceptions by default. Force sane options if we're using GCC.
118AC_MSG_CHECKING(for additional special compiler flags)
119if test "$GCC" = yes
120then
121 case "$host_cpu" in
122 alpha) addcflags="-mieee" ;;
123 esac
124fi
125if test "x$addcflags" != x
126then
127 AC_MSG_RESULT($addcflags)
128 CFLAGS="$addcflags $CFLAGS"
129else
130 AC_MSG_RESULT([[(none)]])
131fi
132dnl
a4d09610
TT
133dnl Set default values for library extentions. Will be dealt with after
134dnl parsing configuration opions, which may modify these
135dnl
136LIB_EXT=.a
137STATIC_LIB_EXT=.a
138PROFILE_LIB_EXT=.a
139dnl
74becf3c
TT
140dnl set $(LDFLAGS) from --with-ldopts=value
141dnl
142AC_ARG_WITH([ldopts],
143[ --with-ldopts=LDOPTS select linker command line options],
144AC_MSG_RESULT(LDFLAGS is $withval)
145LDFLAGS=$withval,
146LDFLAGS=)dnl
147AC_SUBST(LDFLAGS)
50e1e10f 148dnl
a4b2d3ce 149dnl Allow separate `root_prefix' to be specified
fc6d9d51 150dnl
a4b2d3ce
TT
151AC_ARG_WITH([root-prefix],
152[ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
153root_prefix=$withval,
154root_prefix=NONE)dnl
fc6d9d51 155dnl
98919bdb
TT
156dnl handle --enable-maintainer-mode
157dnl
158AC_ARG_ENABLE([maintainer-mode],
159[ --enable-maintainer-mode enable makefile rules useful for maintainers],
160if test "$enableval" = "no"
161then
162 MAINTAINER_CMT=#
163 echo "Disabling maintainer mode"
164else
165 MAINTAINER_CMT=
166 echo "Enabling maintainer mode"
167fi
168,
169MAINTAINER_CMT=#
170echo "Disabling maintainer mode by default"
171)
172AC_SUBST(MAINTAINER_CMT)
173dnl
1917875f
TT
174dnl handle --enable-compression
175dnl
176AC_ARG_ENABLE([compression],
177[ --enable-compression enable EXPERIMENTAL compression support],
178if test "$enableval" = "no"
179then
180 echo "Disabling compression support"
181else
182 AC_DEFINE(ENABLE_COMPRESSION)
183 echo "Enabling compression support"
184 echo "WARNING: Compression support is experimental"
185fi
186,
187echo "Disabling compression support by default"
188)
189dnl
8fdc9985
TT
190dnl handle --enable-htree
191dnl
192AC_ARG_ENABLE([htree],
193[ --enable-htree enable EXPERIMENTAL htree directory support],
194if test "$enableval" = "no"
195then
196 HTREE_CMT=#
197 echo "Disabling htree directory support"
198else
199 HTREE_CMT=
200 AC_DEFINE(ENABLE_HTREE)
201 echo "Enabling htree directory support"
8fdc9985
TT
202fi
203,
559ca6cb
TT
204HTREE_CMT=
205AC_DEFINE(ENABLE_HTREE)
206echo "Enabling htree directory support by default"
8fdc9985
TT
207)
208AC_SUBST(HTREE_CMT)
209dnl
a4ece359
TT
210dnl This needs to be before all of the --enable-*-shlibs options
211dnl
212E2_PKG_CONFIG_STATIC=--static
213dnl
50e1e10f
TT
214dnl handle --enable-elf-shlibs
215dnl
216AC_ARG_ENABLE([elf-shlibs],
a4d09610 217[ --enable-elf-shlibs select ELF shared libraries],
50e1e10f
TT
218if test "$enableval" = "no"
219then
220 ELF_CMT=#
221 MAKEFILE_ELF=/dev/null
222 echo "Disabling ELF shared libraries"
223else
a4ece359 224 E2_PKG_CONFIG_STATIC=
50e1e10f
TT
225 ELF_CMT=
226 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
f5955dda
TT
227 [case "$host_os" in
228 solaris2.*)
229 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
230 ;;
231 esac]
74becf3c 232 BINARY_TYPE=elfbin
a4d09610 233 LIB_EXT=.so
50e1e10f
TT
234 echo "Enabling ELF shared libraries"
235fi
236,
237MAKEFILE_ELF=/dev/null
238ELF_CMT=#
239echo "Disabling ELF shared libraries by default"
240)
241AC_SUBST(ELF_CMT)
242AC_SUBST_FILE(MAKEFILE_ELF)
243dnl
244dnl handle --enable-bsd-shlibs
245dnl
246AC_ARG_ENABLE([bsd-shlibs],
a4d09610 247[ --enable-bsd-shlibs select BSD shared libraries],
50e1e10f
TT
248if test "$enableval" = "no"
249then
250 BSDLIB_CMT=#
251 MAKEFILE_BSDLIB=/dev/null
252 echo "Disabling BSD shared libraries"
253else
a4ece359 254 E2_PKG_CONFIG_STATIC=
50e1e10f
TT
255 BSDLIB_CMT=
256 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
a4d09610 257 LIB_EXT=.so
e71d8731 258 [case "$host_os" in
aa75eccc 259 darwin*)
e71d8731
TT
260 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
261 LIB_EXT=.dylib
262 ;;
263 esac]
50e1e10f
TT
264 echo "Enabling BSD shared libraries"
265fi
266,
267MAKEFILE_BSDLIB=/dev/null
268BSDLIB_CMT=#
269echo "Disabling BSD shared libraries by default"
270)
271AC_SUBST(BSDLIB_CMT)
272AC_SUBST_FILE(MAKEFILE_BSDLIB)
273dnl
274dnl handle --enable-profile
275dnl
276AC_ARG_ENABLE([profile],
a4d09610 277[ --enable-profile build profiling libraries],
50e1e10f
TT
278if test "$enableval" = "no"
279then
280 PROFILE_CMT=#
281 MAKEFILE_PROFILE=/dev/null
282 echo "Disabling profiling libraries"
283else
284 PROFILE_CMT=
285 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
a4d09610 286 PROFILED_LIB_EXT=_p.a
50e1e10f
TT
287 echo "Building profiling libraries"
288fi
289,
290PROFILE_CMT=#
291MAKEFILE_PROFILE=/dev/null
292echo "Disabling profiling libraries by default"
293)
294AC_SUBST(PROFILE_CMT)
295AC_SUBST_FILE(MAKEFILE_PROFILE)
296dnl
297dnl handle --enable-checker
298dnl
299AC_ARG_ENABLE([checker],
a4d09610 300[ --enable-checker build checker libraries],
50e1e10f
TT
301if test "$enableval" = "no"
302then
303 CHECKER_CMT=#
304 MAKEFILE_CHECKER=/dev/null
305 echo "Disabling checker libraries"
306else
307 CHECKER_CMT=
308 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
309 echo "Building checker libraries"
310fi
311,
312CHECKER_CMT=#
313MAKEFILE_CHECKER=/dev/null
314echo "Disabling checker libraries by default"
315)
316AC_SUBST(CHECKER_CMT)
317AC_SUBST_FILE(MAKEFILE_CHECKER)
318dnl
a4d09610
TT
319dnl Substitute library extensions
320dnl
321AC_SUBST(LIB_EXT)
322AC_SUBST(STATIC_LIB_EXT)
323AC_SUBST(PROFILED_LIB_EXT)
324dnl
782bebfd 325dnl handle --enable-jbd-debug
cdf186e4 326dnl
782bebfd
TT
327AC_ARG_ENABLE([jbd-debug],
328[ --enable-jbd-debug enable journal debugging],
cdf186e4
TT
329if test "$enableval" = "no"
330then
331 echo "Disabling journal debugging"
332else
8cf93332 333 AC_DEFINE(CONFIG_JBD_DEBUG)
cdf186e4
TT
334 echo "Enabling journal debugging"
335fi
336,
337echo "Disabling journal debugging by default"
338)
339dnl
f0a22d0f
TT
340dnl handle --enable-blkid-debug
341dnl
342AC_ARG_ENABLE([blkid-debug],
d21ae6c5 343[ --enable-blkid-debug enable blkid debugging],
f0a22d0f
TT
344if test "$enableval" = "no"
345then
346 echo "Disabling blkid debugging"
347else
348 AC_DEFINE(CONFIG_BLKID_DEBUG)
349 echo "Enabling blkid debugging"
350fi
351,
352echo "Disabling blkid debugging by default"
2a29f135
TT
353)
354dnl
355dnl handle --enable-testio-debug
356dnl
357AC_ARG_ENABLE([testio-debug],
358[ --enable-testio-debug enable the use of the test I/O manager for debugging],
359if test "$enableval" = "no"
360then
361 echo "Disabling testio debugging"
362else
363 AC_DEFINE(CONFIG_TESTIO_DEBUG)
364 echo "Enabling testio debugging"
365fi
366,
367echo "Disabling testio debugging by default"
f0a22d0f
TT
368)
369dnl
cdf186e4
TT
370dnl handle --enable-swapfs
371dnl
372AC_ARG_ENABLE([swapfs],
373[ --disable-swapfs disable support of legacy byte-swapped filesystems],
374if test "$enableval" = "no"
375then
feb44c69 376 SWAPFS_CMT=#
cdf186e4
TT
377 echo "Disabling swapfs support"
378else
feb44c69 379 SWAPFS_CMT=
cdf186e4
TT
380 AC_DEFINE(ENABLE_SWAPFS)
381 echo "Enabling swapfs support"
382fi
383,
feb44c69 384SWAPFS_CMT=
cdf186e4
TT
385echo "Enabling swapfs support by default"
386AC_DEFINE(ENABLE_SWAPFS)
387)
feb44c69 388AC_SUBST(SWAPFS_CMT)
cdf186e4
TT
389dnl
390dnl handle --enable-debugfs
391dnl
392AC_ARG_ENABLE([debugfs],
393[ --disable-debugfs disable support of debugfs program],
394if test "$enableval" = "no"
395then
396 echo "Disabling debugfs support"
397 DEBUGFS_CMT="#"
398else
399 DEBUGFS_CMT=
400 echo "Enabling debugfs support"
401fi
402,
403echo "Enabling debugfs support by default"
404DEBUGFS_CMT=
405)
406AC_SUBST(DEBUGFS_CMT)
407dnl
408dnl handle --enable-imager
409dnl
410AC_ARG_ENABLE([imager],
411[ --disable-imager disable support of e2image program],
412if test "$enableval" = "no"
413then
414 echo "Disabling e2image support"
415 IMAGER_CMT="#"
416else
417 IMAGER_CMT=
418 echo "Enabling e2image support"
419fi
420,
421echo "Enabling e2image support by default"
422IMAGER_CMT=
423)
424AC_SUBST(IMAGER_CMT)
425dnl
426dnl handle --enable-resizer
427dnl
428AC_ARG_ENABLE([resizer],
429[ --disable-resizer disable support of e2resize program],
430if test "$enableval" = "no"
431then
432 echo "Disabling e2resize support"
433 RESIZER_CMT="#"
434else
435 RESIZER_CMT=
436 echo "Enabling e2resize support"
437fi
438,
439echo "Enabling e2resize support by default"
440RESIZER_CMT=
441)
442AC_SUBST(RESIZER_CMT)
443dnl
fc6d9d51
TT
444dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
445dnl
446AC_ARG_ENABLE([fsck],
447[ --enable-fsck build fsck wrapper program],
448[if test "$enableval" = "no"
449then
450 FSCK_PROG='' FSCK_MAN=''
451 echo "Not building fsck wrapper"
452else
453 FSCK_PROG=fsck FSCK_MAN=fsck.8
454 echo "Building fsck wrapper"
455fi]
456,
457[case "$host_os" in
e363240d 458 gnu*)
fc6d9d51
TT
459 FSCK_PROG='' FSCK_MAN=''
460 echo "Not building fsck wrapper by default"
461 ;;
462 *)
463 FSCK_PROG=fsck FSCK_MAN=fsck.8
464 echo "Building fsck wrapper by default"
465esac]
466)
467AC_SUBST(FSCK_PROG)
468AC_SUBST(FSCK_MAN)
469dnl
5d40773b
TT
470dnl See whether to install the `e2initrd-helper' program
471dnl
472AC_ARG_ENABLE([e2initrd-helper],
473[ --enable-e2initrd-helper build e2initrd-helper program],
474[if test "$enableval" = "no"
475then
476 E2INITRD_PROG='' E2INITRD_MAN=''
477 echo "Not building e2initrd helper"
478else
479 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
480 echo "Building e2initrd helper"
481fi]
482,
483E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
484echo "Building e2initrd helper by default"
485)
486AC_SUBST(E2INITRD_PROG)
487AC_SUBST(E2INITRD_MAN)
4db2f59a
KZ
488dnl handle --enable-blkid-devmapper
489dnl
a4ece359 490STATIC_BLKID_DEVMAPPER_LIBS=''
4db2f59a
KZ
491AC_ARG_ENABLE([blkid-devmapper],
492[ --enable-blkid-devmapper build with device-mapper support],
493[if test "$enableval" = "no"
494then
495 echo "Disabling device-mapper support"
496 DEVMAPPER_REQ=''
497 DEVMAPPER_LIBS=''
498 STATIC_DEVMAPPER_LIBS=''
499else
500 AC_DEFINE(HAVE_DEVMAPPER)
501 echo "Enabling device-mapper support"
502
a4ece359 503 PKG_PROG_PKG_CONFIG()
4db2f59a 504
a4ece359
TT
505 if test -z "$PKG_CONFIG"; then
506 echo "pkg-config not installed; please install it."
507 exit 1;
508 fi
509
510 AC_CHECK_LIB(devmapper, dm_tree_create,
511 [DEVMAPPER_LIBS=`$PKG_CONFIG --libs devmapper`;
512 STATIC_DEVMAPPER_LIBS=`$PKG_CONFIG --static --libs devmapper`;
513 DEVMAPPER_REQ="devmapper";
514 DEVMAPPER_PC_LIBS="-ldevmapper"],
515 [AC_MSG_ERROR([device-mapper library not found])],
516 [$DEVMAPPER_LIBS])
517 # work around stupid devmapper.pc bug in Debian
518 case "$STATIC_DEVMAPPER_LIBS" in
519 *pthread*)
520 ;;
521 *)
522 echo "Working around Debian bug #390243..."
523 STATIC_DEVMAPPER_LIBS="-pthread $STATIC_DEVMAPPER_LIBS"
524 ;;
525 esac
526 if test "$E2_PKG_CONFIG_STATIC" = "--static"; then
527 DEVMAPPER_LIBS="$STATIC_DEVMAPPER_LIBS"
528 STATIC_BLKID_DEVMAPPER_LIBS="$STATIC_DEVMAPPER_LIBS"
529 fi
4db2f59a
KZ
530fi]
531,
532echo "Disabling device-mapper support by default"
533)
534AC_SUBST(DEVMAPPER_REQ)
535AC_SUBST(DEVMAPPER_PC_LIBS)
536AC_SUBST(DEVMAPPER_LIBS)
537AC_SUBST(STATIC_DEVMAPPER_LIBS)
a4ece359 538AC_SUBST(STATIC_BLKID_DEVMAPPER_LIBS)
4db2f59a 539dnl
5d40773b 540dnl
50e1e10f 541dnl
3249394d
TT
542AC_ARG_ENABLE([tls],
543[ --disable-tls disable use of thread local support],
544[if test "$enableval" = "no"
545then
546 try_tls=""
547 echo "Disabling thread local support"
548else
549 try_tls="yes"
550 echo "Enabling thread local support"
551fi]
552,
553try_tls="yes"
554echo "Try using thread local support by default"
555)
556if test "$try_tls" = "yes"
557then
558AX_TLS
559fi
560dnl
561dnl
562dnl
5610f992
TT
563AC_ARG_ENABLE([uuidd],
564[ --disable-uuidd disable building the uuid daemon],
565[if test "$enableval" = "no"
566then
567 echo "Not building uuidd"
568 UUIDD_CMT="#"
569else
570 AC_DEFINE(USE_UUIDD)
571 UUIDD_CMT=""
572 echo "Building uuidd"
573fi]
574,
575AC_DEFINE(USE_UUIDD)
576UUIDD_CMT=""
577echo "Building uuidd by default"
578)
579AC_SUBST(UUIDD_CMT)
580dnl
581dnl
582dnl
50e1e10f
TT
583MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
584AC_SUBST_FILE(MAKEFILE_LIBRARY)
585dnl
cdf186e4
TT
586dnl Add internationalization support, using gettext.
587dnl
b0cacab0 588GETTEXT_PACKAGE=e2fsprogs
cdf186e4
TT
589PACKAGE=e2fsprogs
590VERSION="$E2FSPROGS_VERSION"
b0cacab0 591VERSION=0.14.1
cdf186e4
TT
592AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
593AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
b0cacab0 594AC_SUBST(GETTEXT_PACKAGE)
cdf186e4
TT
595AC_SUBST(PACKAGE)
596AC_SUBST(VERSION)
597
cdf186e4
TT
598AM_GNU_GETTEXT
599dnl
50e1e10f
TT
600dnl End of configuration options
601dnl
74becf3c 602AC_SUBST(BINARY_TYPE)
50e1e10f
TT
603AC_PROG_MAKE_SET
604AC_PATH_PROG(LN, ln, ln)
fc6d9d51 605AC_PROG_LN_S
50e1e10f
TT
606AC_PATH_PROG(MV, mv, mv)
607AC_PATH_PROG(CP, cp, cp)
608AC_PATH_PROG(RM, rm, rm)
609AC_PATH_PROG(CHMOD, chmod, :)
32237014
TT
610AC_PROG_AWK
611AC_PROG_EGREP
50e1e10f 612AC_PATH_PROG(SED, sed, sed)
9d564f73 613AC_PATH_PROG(PERL, perl, perl)
250f79f0 614AC_PATH_PROG(LDCONFIG, ldconfig, :)
50e1e10f
TT
615AC_CHECK_TOOL(AR, ar, ar)
616AC_CHECK_TOOL(RANLIB, ranlib, :)
617AC_CHECK_TOOL(STRIP, strip, :)
7321d94e
MK
618AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
619if test "_$MAKEINFO" = "_"; then
620 MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
621else
622 case "$MAKEINFO" in
623 */missing.*)
624 AC_MSG_WARN([
625*** Makeinfo is missing. Info documentation will not be built.])
626 ;;
627 *)
628 ;;
629 esac
630fi
631AC_SUBST(MAKEINFO)
50e1e10f 632AC_PROG_INSTALL
6c133523
TT
633# See if we need a separate native compiler.
634if test $cross_compiling = no; then
635 BUILD_CC="$CC"
636 AC_SUBST(BUILD_CC)
637else
638 AC_CHECK_PROGS(BUILD_CC, gcc cc)
639fi
e7cc6f7d 640AC_CHECK_HEADERS(dirent.h errno.h getopt.h malloc.h mntent.h paths.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h)
da76d6b7
TT
641AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
642[[
643#if HAVE_SYS_QUEUE_H
644#include <sys/queue.h>
645#endif
646]])
647AC_CHECK_HEADERS(net/if.h,,,
648[[
649#if HAVE_SYS_TYPES_H
650#include <sys/types.h>
651#endif
652#if HAVE_SYS_SOCKET
653#include <sys/socket.h>
654#endif
655]])
50e1e10f 656AC_FUNC_VPRINTF
fff45483
TT
657dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
658dnl is not decleared.
6c65d251
TT
659AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
660 [#include <dirent.h>])
fff45483 661dnl Check to see if ssize_t was decleared
6c65d251
TT
662AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
663 [#include <sys/types.h>])
50e1e10f 664dnl
b0b9c4de
TT
665dnl Check to see if llseek() is declared in unistd.h. On some libc's
666dnl it is, and on others it isn't..... Thank you glibc developers....
667dnl
6c65d251
TT
668AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
669 [#include <unistd.h>])
b0b9c4de 670dnl
6928adc9
TT
671dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
672dnl are so convoluted that I can't tell whether it will always be defined,
673dnl and if it isn't defined while lseek64 is defined in the library,
674dnl disaster will strike.
675dnl
676dnl Warning! Use of --enable-gcc-wall may throw off this test.
677dnl
678dnl
6c65d251
TT
679AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
680 [#define _LARGEFILE_SOURCE
681 #define _LARGEFILE64_SOURCE
682 #include <unistd.h>])
6928adc9 683dnl
50e1e10f
TT
684dnl Word sizes...
685dnl
50e1e10f
TT
686AC_CHECK_SIZEOF(short)
687AC_CHECK_SIZEOF(int)
688AC_CHECK_SIZEOF(long)
fc6d9d51 689AC_CHECK_SIZEOF(long long)
50e1e10f
TT
690SIZEOF_SHORT=$ac_cv_sizeof_short
691SIZEOF_INT=$ac_cv_sizeof_int
692SIZEOF_LONG=$ac_cv_sizeof_long
fc6d9d51 693SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
50e1e10f
TT
694AC_SUBST(SIZEOF_SHORT)
695AC_SUBST(SIZEOF_INT)
696AC_SUBST(SIZEOF_LONG)
fc6d9d51 697AC_SUBST(SIZEOF_LONG_LONG)
877eb6d9 698AC_C_BIGENDIAN
29a5deed 699BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
4ea7ea00
TT
700ASM_TYPES_HEADER=./asm_types.h
701AC_SUBST_FILE(ASM_TYPES_HEADER)
50e1e10f 702dnl
0c193f82
TT
703dnl See if we have inttypes.h and if intptr_t is defined
704dnl
705AC_CHECK_HEADERS([inttypes.h])
d2ee56d8 706AC_CHECK_TYPES(intptr_t)
0c193f82 707dnl
50e1e10f
TT
708dnl See if struct stat has a st_flags field, in which case we can get file
709dnl flags somewhat portably. Also check for the analogous setter, chflags().
710dnl
711AC_MSG_CHECKING(whether struct stat has a st_flags field)
712AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
713 AC_TRY_COMPILE([#include <sys/stat.h>],
714 [struct stat stat; stat.st_flags = 0;],
715 [e2fsprogs_cv_struct_st_flags=yes],
716 [e2fsprogs_cv_struct_st_flags=no]))
717AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
718if test "$e2fsprogs_cv_struct_st_flags" = yes; then
c03bc4e8
TT
719 AC_MSG_CHECKING(whether st_flags field is useful)
720 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
721 AC_TRY_COMPILE([#include <sys/stat.h>],
722 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
723 [e2fsprogs_cv_struct_st_flags_immut=yes],
724 [e2fsprogs_cv_struct_st_flags_immut=no]))
725 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
726 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
727 AC_DEFINE(HAVE_STAT_FLAGS)
728 fi
50e1e10f 729fi
84ea6e70
TT
730dnl
731dnl Check for the presence of SA_LEN
732dnl
6c65d251
TT
733AC_CHECK_MEMBER(struct sockaddr.sa_len,
734 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
735 [#include <sys/types.h>
736 #include <sys/socket.h>])
84ea6e70 737dnl
261cd396 738AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid)
fc6d9d51 739dnl
fc6d9d51
TT
740dnl Check to see if -lsocket is required (solaris) to make something
741dnl that uses socket() to compile; this is needed for the UUID library
742dnl
743SOCKET_LIB=''
744AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
745AC_SUBST(SOCKET_LIB)
746dnl
3ae497ea
TT
747dnl Check to see if libdl exists for the sake of dlopen
748dnl
749DLOPEN_LIB=''
750AC_CHECK_LIB(dl, dlopen,
751[DLOPEN_LIB=-ldl
752AC_DEFINE(HAVE_DLOPEN)])
753AC_SUBST(DLOPEN_LIB)
754dnl
50e1e10f
TT
755dnl See if optreset exists
756dnl
757AC_MSG_CHECKING(for optreset)
758AC_CACHE_VAL(ac_cv_have_optreset,
759[AC_EGREP_HEADER(optreset, unistd.h,
760 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
761AC_MSG_RESULT($ac_cv_have_optreset)
762if test $ac_cv_have_optreset = yes; then
763 AC_DEFINE(HAVE_OPTRESET)
764fi
765dnl
e54635de
TT
766dnl Check for unified diff
767dnl
768AC_MSG_CHECKING(for unified diff option)
27f991b0 769if diff -u $0 $0 > /dev/null 2>&1 ; then
e54635de
TT
770 UNI_DIFF_OPTS=-u
771else
772 UNI_DIFF_OPTS=-c
773fi
774AC_MSG_RESULT($UNI_DIFF_OPTS)
775AC_SUBST(UNI_DIFF_OPTS)
776dnl
8f3f29d3
TT
777dnl We use the EXT2 ioctls only under Linux
778dnl
779case "$host_os" in
780linux*)
781 AC_DEFINE(HAVE_EXT2_IOCTLS)
782 ;;
783esac
50e1e10f 784dnl
fff45483 785dnl OS-specific uncomment control
e6f2bda3
TT
786dnl
787LINUX_CMT="#"
fff45483
TT
788CYGWIN_CMT="#"
789UNIX_CMT=
e6f2bda3
TT
790case "$host_os" in
791linux*)
792 LINUX_CMT=
793 ;;
fff45483
TT
794cygwin)
795 CYGWIN_CMT=
796 UNIX_CMT="#"
fff45483 797 ;;
e6f2bda3
TT
798esac
799AC_SUBST(LINUX_CMT)
fff45483
TT
800AC_SUBST(CYGWIN_CMT)
801AC_SUBST(UNIX_CMT)
e6f2bda3 802dnl
6c133523 803dnl Linux and Hurd places root files in the / by default
50e1e10f 804dnl
50e1e10f 805case "$host_os" in
93636bde 806linux* | gnu* | k*bsd*-gnu)
a4b2d3ce
TT
807 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
808 root_prefix="";
809 echo "On $host_os systems, root_prefix defaults to ''"
fc6d9d51
TT
810 fi
811 ;;
812esac
fc6d9d51 813dnl
a4b2d3ce 814dnl On Linux/hurd, force the prefix to be /usr
fc6d9d51
TT
815dnl
816case "$host_os" in
93636bde 817linux* | gnu* | k*bsd*-gnu)
fc6d9d51 818 if test "$prefix" = NONE ; then
a4b2d3ce
TT
819 prefix="/usr";
820 echo "On $host_os systems, prefix defaults to /usr"
bff61a7a
TT
821 if test "$mandir" = '${prefix}/man' ; then
822 echo "...and mandir defaults to /usr/share/man"
823 mandir=/usr/share/man
824 fi
50e1e10f
TT
825 fi
826;;
827esac
a4b2d3ce 828if test "$root_prefix" = NONE ; then
ffe1991f 829 if test "$prefix" = NONE ; then
a4b2d3ce
TT
830 root_prefix="$ac_default_prefix"
831 else
832 root_prefix="$prefix"
833 fi
b5ffeade
TT
834 root_bindir=$bindir
835 root_sbindir=$sbindir
836 root_libdir=$libdir
837 root_sysconfdir=$sysconfdir
838else
839 root_bindir='${root_prefix}/bin'
840 root_sbindir='${root_prefix}/sbin'
841 root_libdir='${root_prefix}/lib'
842 root_sysconfdir='${root_prefix}/etc'
a4b2d3ce 843fi
c4ef11c5
TT
844if test "$bindir" != '${exec_prefix}/bin'; then
845 root_bindir=$bindir
846 echo "Setting root_bindir to $root_bindir"
847fi
848if test "$sbindir" != '${exec_prefix}/sbin'; then
849 root_sbindir=$sbindir
850 echo "Setting root_sbindir to $root_sbindir"
851fi
852if test "$libdir" != '${exec_prefix}/lib'; then
853 root_libdir=$libdir
854 echo "Setting root_libdir to $root_libdir"
855fi
856if test "$sysconfdir" != '${prefix}/etc'; then
857 root_sysconfdir=$sysconfdir
858 echo "Setting root_sysconfdir to $root_sysconfdir"
859fi
a4b2d3ce 860AC_SUBST(root_prefix)
b5ffeade
TT
861AC_SUBST(root_bindir)
862AC_SUBST(root_sbindir)
863AC_SUBST(root_libdir)
864AC_SUBST(root_sysconfdir)
50e1e10f
TT
865dnl
866dnl See if -static works.
50e1e10f 867dnl
ae851482
TT
868AC_MSG_CHECKING([whether linker accepts -static])
869AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
870[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
871AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
872 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
873LDFLAGS=$SAVE_LDFLAGS])
defde784
TT
874dnl
875dnl Regardless of how the test turns out, Solaris doesn't handle -static
876dnl This is caused by the socket library requiring the nsl library, which
877dnl requires the -dl library, which only works for dynamically linked
878dnl programs. It basically means you can't have statically linked programs
879dnl which use the network under Solaris.
880dnl
881case "$host_os" in
882solaris2.*)
883 ac_cv_e2fsprogs_use_static=no
884;;
885esac
ae851482 886AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
74becf3c 887LDFLAG_STATIC=
ae851482 888if test $ac_cv_e2fsprogs_use_static = yes; then
50e1e10f 889 LDFLAG_STATIC=-static
ae851482 890fi
50e1e10f
TT
891AC_SUBST(LDFLAG_STATIC)
892dnl
07a0db15
TT
893dnl Work around mysterious Darwin / GNU libintl problem
894dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
895dnl Apple hacked gcc somehow?)
896dnl
897case "$host_os" in
898darwin*)
899 echo "Using Apple Darwin / GNU libintl workaround"
900 AC_DEFINE(_INTL_REDIRECT_MACROS)
901 ;;
902esac
903dnl
50e1e10f
TT
904dnl Make the ss and et directories work correctly.
905dnl
906SS_DIR=`cd ${srcdir}/lib/ss; pwd`
907ET_DIR=`cd ${srcdir}/lib/et; pwd`
908AC_SUBST(SS_DIR)
909AC_SUBST(ET_DIR)
910dnl
911dnl Only try to run the test suite if we're not cross compiling.
912dnl
913if test "$cross_compiling" = yes ; then
914 DO_TEST_SUITE=
915else
916 DO_TEST_SUITE=check
917fi
918AC_SUBST(DO_TEST_SUITE)
919dnl
c6f35b8a
TT
920dnl Only include the intl include files if we're building with them
921dnl
922INTL_FLAGS=
923if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
924 INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
925fi
926AC_SUBST(INTL_FLAGS)
927dnl
dd947da2
TT
928dnl Build CFLAGS
929dnl
930if test $cross_compiling = no; then
931 BUILD_CFLAGS="$CFLAGS"
932 BUILD_LDFLAGS="$LDFLAGS"
933else
934 BUILD_CFLAGS=
935 BUILD_LDFLAGS=
936fi
937AC_SUBST(BUILD_CFLAGS)
938AC_SUBST(BUILD_LDFLAGS)
939dnl
50e1e10f
TT
940dnl Make our output files, being sure that we create the some miscellaneous
941dnl directories
942dnl
943test -d lib || mkdir lib
944test -d include || mkdir include
945test -d include/linux || mkdir include/linux
defde784 946test -d include/asm || mkdir include/asm
bff0cc95
TT
947for i in MCONFIG Makefile e2fsprogs.spec \
948 util/Makefile util/subst.conf util/gen-tarball \
4ea7ea00
TT
949 lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
950 lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
94ba8c75
TT
951 lib/uuid/Makefile lib/uuid/uuid_types.h \
952 lib/blkid/Makefile lib/blkid/blkid_types.h \
e6441865
TT
953 lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
954 lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
921f4ad5 955 misc/Makefile ext2ed/Makefile e2fsck/Makefile \
94ba8c75
TT
956 debugfs/Makefile tests/Makefile tests/progs/Makefile \
957 resize/Makefile doc/Makefile intl/Makefile po/Makefile.in ; do
958 if test -d `dirname ${srcdir}/$i` ; then
959 outlist="$outlist $i"
960 fi
961done
962AC_OUTPUT($outlist)
ee683a13
TT
963if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi
964