• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AC_INIT(version.h)
2AC_PREREQ(2.50)
3AC_CONFIG_AUX_DIR(config)
4MCONFIG=./MCONFIG
5AC_SUBST_FILE(MCONFIG)
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 \" " "`
14E2FSPROGS_DAY=`echo $DATE | awk -F- '{print $1}'`
15MONTH=`echo $DATE | awk -F- '{print $2}'`
16YEAR=`echo $DATE | awk -F- '{print $3}'`
17
18if expr $YEAR ">" 1900 > /dev/null ; then
19	E2FSPROGS_YEAR=$YEAR
20elif expr $YEAR ">" 90 >/dev/null ; then
21	E2FSPROGS_YEAR=19$YEAR
22else
23	E2FSPROGS_YEAR=20$YEAR
24fi
25
26case $MONTH in
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" ;;
39*)	AC_MSG_WARN([Unknown month $MONTH??]) ;;
40esac
41
42base_ver=`echo $E2FSPROGS_VERSION | \
43	       sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
44
45date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
46
47case $E2FSPROGS_VERSION in
48*-WIP|pre-*)
49	E2FSPROGS_PKGVER="$base_ver~WIP-$E2FSPROGS_YEAR-$MONTH_NUM-$E2FSPROGS_DAY"
50	;;
51*)
52	E2FSPROGS_PKGVER="$base_ver"
53	;;
54esac
55
56unset DATE MONTH YEAR base_ver pre_vers date_spec
57AC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
58AC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
59AC_SUBST(E2FSPROGS_YEAR)
60AC_SUBST(E2FSPROGS_MONTH)
61AC_SUBST(E2FSPROGS_DAY)
62AC_SUBST(E2FSPROGS_VERSION)
63AC_SUBST(E2FSPROGS_PKGVER)
64AC_CANONICAL_HOST
65dnl
66dnl Check to see if libdl exists for the sake of dlopen
67dnl
68DLOPEN_LIB=''
69AC_CHECK_LIB(dl, dlopen,
70[DLOPEN_LIB=-ldl
71AC_DEFINE(HAVE_DLOPEN)])
72AC_SUBST(DLOPEN_LIB)
73dnl
74dnl Use diet libc
75dnl
76WITH_DIET_LIBC=
77AC_ARG_WITH([diet-libc],
78[  --with-diet-libc        use diet libc],
79CC="diet cc -nostdinc"
80WITH_DIET_LIBC=yes
81AC_MSG_RESULT(CC=$CC))dnl
82dnl
83AC_ARG_WITH([cc],
84AC_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
85AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
86dnl
87AC_ARG_WITH([ccopts],
88AC_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
89AC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
90dnl
91AC_ARG_WITH([ldopts],
92AC_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
93AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
94dnl
95AC_PROG_CC
96AC_PROG_CPP
97dnl
98dnl On systems without linux header files, we add an extra include directory
99dnl that holds enough to fake it (hopefully).  Note that the $(top_srcdir) here
100dnl is quoted so that it gets expanded by make, not by configure.
101dnl
102AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
103if test "$linux_headers" != yes; then
104  LINUX_INCLUDE='-I$(top_builddir)/include'
105fi
106AC_SUBST(LINUX_INCLUDE)
107dnl
108dnl Alpha computers use fast and imprecise floating point code that may
109dnl miss exceptions by default. Force sane options if we're using GCC.
110AC_MSG_CHECKING(for additional special compiler flags)
111if test "$GCC" = yes
112then
113    case "$host_cpu" in
114	alpha)		addcflags="-mieee" ;;
115    esac
116fi
117if test "x$addcflags" != x
118then
119    AC_MSG_RESULT($addcflags)
120    CFLAGS="$addcflags $CFLAGS"
121else
122    AC_MSG_RESULT([[(none)]])
123fi
124dnl
125dnl Set default values for library extentions.  Will be dealt with after
126dnl parsing configuration opions, which may modify these
127dnl
128LIB_EXT=.a
129STATIC_LIB_EXT=.a
130PROFILED_LIB_EXT=.a
131dnl
132dnl Allow separate `root_prefix' to be specified
133dnl
134AC_ARG_WITH([root-prefix],
135[  --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
136root_prefix=$withval,
137root_prefix=NONE)dnl
138dnl
139dnl handle --enable-maintainer-mode
140dnl
141AC_ARG_ENABLE([maintainer-mode],
142[  --enable-maintainer-mode enable makefile rules useful for maintainers],
143if test "$enableval" = "no"
144then
145	MAINTAINER_CMT=#
146	AC_MSG_RESULT([Disabling maintainer mode])
147else
148	MAINTAINER_CMT=
149	AC_MSG_RESULT([Enabling maintainer mode])
150fi
151,
152MAINTAINER_CMT=#
153AC_MSG_RESULT([Disabling maintainer mode by default])
154)
155AC_SUBST(MAINTAINER_CMT)
156dnl
157dnl handle --enable-symlink-install
158dnl
159AC_ARG_ENABLE([symlink-install],
160[  --enable-symlink-install use symlinks when installing instead of hard links],
161if test "$enableval" = "no"
162then
163	LINK_INSTALL_FLAGS=-f
164	AC_MSG_RESULT([Disabling symlinks for install])
165else
166	LINK_INSTALL_FLAGS=-sf
167	AC_MSG_RESULT([Enabling symlinks for install])
168fi
169,
170LINK_INSTALL_FLAGS=-f
171AC_MSG_RESULT([Disabling symlinks for install])
172)
173AC_SUBST(LINK_INSTALL_FLAGS)
174dnl
175dnl handle --enable-symlink-build
176dnl
177AC_ARG_ENABLE([symlink-build],
178[  --enable-symlink-build  use symlinks while building instead of hard links],
179if test "$enableval" = "no"
180then
181	LINK_BUILD_FLAGS=
182	AC_MSG_RESULT([Disabling symlinks for build])
183else
184	LINK_BUILD_FLAGS=-s
185	AC_MSG_RESULT([Enabling symlinks for build])
186fi
187,
188LINK_BUILD_FLAGS=
189AC_MSG_RESULT([Disabling symlinks for build])
190)
191AC_SUBST(LINK_BUILD_FLAGS)
192dnl
193dnl handle --enable-verbose-makecmds
194dnl
195AC_ARG_ENABLE([verbose-makecmds],
196[  --enable-verbose-makecmds enable verbose make command output],
197if test "$enableval" = "no"
198then
199	AC_MSG_RESULT([Disabling verbose make commands])
200	E=@echo
201	Q=@
202else
203	AC_MSG_RESULT([Enabling verbose make commands])
204	E=@\\#
205	Q=
206fi
207,
208AC_MSG_RESULT([Disabling verbose make commands])
209E=@echo
210Q=@
211)
212AC_SUBST(E)
213AC_SUBST(Q)
214dnl
215dnl handle --enable-compression
216dnl
217AC_ARG_ENABLE([compression],
218[  --enable-compression	  enable EXPERIMENTAL compression support],
219if test "$enableval" = "no"
220then
221	AC_MSG_RESULT([Disabling compression support])
222else
223	AC_DEFINE(ENABLE_COMPRESSION)
224	AC_MSG_RESULT([Enabling compression support])
225	AC_MSG_WARN([Compression support is experimental])
226fi
227,
228AC_MSG_RESULT([Disabling compression support by default])
229)
230dnl
231dnl handle --enable-htree
232dnl
233AC_ARG_ENABLE([htree],
234[  --enable-htree      	  enable EXPERIMENTAL htree directory support],
235if test "$enableval" = "no"
236then
237	HTREE_CMT=#
238	AC_MSG_RESULT([Disabling htree directory support])
239else
240	HTREE_CMT=
241	AC_DEFINE(ENABLE_HTREE)
242	AC_MSG_RESULT([Enabling htree directory support])
243fi
244,
245HTREE_CMT=
246AC_DEFINE(ENABLE_HTREE)
247AC_MSG_RESULT([Enabling htree directory support by default])
248)
249AC_SUBST(HTREE_CMT)
250dnl
251dnl This needs to be before all of the --enable-*-shlibs options
252dnl
253E2_PKG_CONFIG_STATIC=--static
254LDFLAG_DYNAMIC=
255PRIVATE_LIBS_CMT=
256dnl
257dnl handle --enable-elf-shlibs
258dnl
259AC_ARG_ENABLE([elf-shlibs],
260[  --enable-elf-shlibs	  select ELF shared libraries],
261if test "$enableval" = "no"
262then
263	ELF_CMT=#
264	MAKEFILE_ELF=/dev/null
265	AC_MSG_RESULT([Disabling ELF shared libraries])
266else
267	E2_PKG_CONFIG_STATIC=
268	ELF_CMT=
269	MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
270	[case "$host_os" in
271	solaris2.*)
272		MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
273	;;
274	esac]
275	BINARY_TYPE=elfbin
276	LIB_EXT=.so
277	PRIVATE_LIBS_CMT=#
278	LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
279	AC_MSG_RESULT([Enabling ELF shared libraries])
280fi
281,
282MAKEFILE_ELF=/dev/null
283ELF_CMT=#
284AC_MSG_RESULT([Disabling ELF shared libraries by default])
285)
286AC_SUBST(ELF_CMT)
287AC_SUBST_FILE(MAKEFILE_ELF)
288dnl
289dnl handle --enable-bsd-shlibs
290dnl
291AC_ARG_ENABLE([bsd-shlibs],
292[  --enable-bsd-shlibs	  select BSD shared libraries],
293if test "$enableval" = "no"
294then
295	BSDLIB_CMT=#
296	MAKEFILE_BSDLIB=/dev/null
297	AC_MSG_RESULT([Disabling BSD shared libraries])
298else
299	E2_PKG_CONFIG_STATIC=
300	BSDLIB_CMT=
301	MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
302	LIB_EXT=.so
303	[case "$host_os" in
304	darwin*)
305		MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
306		LIB_EXT=.dylib
307	;;
308	esac]
309	AC_MSG_RESULT([Enabling BSD shared libraries])
310fi
311,
312MAKEFILE_BSDLIB=/dev/null
313BSDLIB_CMT=#
314AC_MSG_RESULT([Disabling BSD shared libraries by default])
315)
316AC_SUBST(BSDLIB_CMT)
317AC_SUBST_FILE(MAKEFILE_BSDLIB)
318dnl
319dnl handle --enable-profile
320dnl
321AC_ARG_ENABLE([profile],
322[  --enable-profile	  build profiling libraries],
323if test "$enableval" = "no"
324then
325	PROFILE_CMT=#
326	MAKEFILE_PROFILE=/dev/null
327	AC_MSG_RESULT([Disabling profiling libraries])
328else
329	PROFILE_CMT=
330	MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
331	PROFILED_LIB_EXT=_p.a
332	AC_MSG_RESULT([Building profiling libraries])
333fi
334,
335PROFILE_CMT=#
336MAKEFILE_PROFILE=/dev/null
337AC_MSG_RESULT([Disabling profiling libraries by default])
338)
339AC_SUBST(PROFILE_CMT)
340AC_SUBST_FILE(MAKEFILE_PROFILE)
341dnl
342dnl handle --enable-checker
343dnl
344AC_ARG_ENABLE([checker],
345[  --enable-checker	  build checker libraries],
346if test "$enableval" = "no"
347then
348	CHECKER_CMT=#
349	MAKEFILE_CHECKER=/dev/null
350	AC_MSG_RESULT([Disabling checker libraries])
351else
352	CHECKER_CMT=
353	MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
354	AC_MSG_RESULT([Building checker libraries])
355fi
356,
357CHECKER_CMT=#
358MAKEFILE_CHECKER=/dev/null
359AC_MSG_RESULT([Disabling checker libraries by default])
360)
361AC_SUBST(CHECKER_CMT)
362AC_SUBST_FILE(MAKEFILE_CHECKER)
363dnl
364dnl Substitute library extensions
365dnl
366AC_SUBST(LIB_EXT)
367AC_SUBST(STATIC_LIB_EXT)
368AC_SUBST(PROFILED_LIB_EXT)
369AC_SUBST(LDFLAG_DYNAMIC)
370AC_SUBST(PRIVATE_LIBS_CMT)
371dnl
372dnl handle --enable-jbd-debug
373dnl
374AC_ARG_ENABLE([jbd-debug],
375[  --enable-jbd-debug  	  enable journal debugging],
376if test "$enableval" = "no"
377then
378	AC_MSG_RESULT([Disabling journal debugging])
379else
380	AC_DEFINE(CONFIG_JBD_DEBUG)
381	AC_MSG_RESULT([Enabling journal debugging])
382fi
383,
384AC_MSG_RESULT([Disabling journal debugging by default])
385)
386dnl
387dnl handle --enable-blkid-debug
388dnl
389AC_ARG_ENABLE([blkid-debug],
390[  --enable-blkid-debug    enable blkid debugging],
391if test "$enableval" = "no"
392then
393	AC_MSG_RESULT([Disabling blkid debugging])
394else
395	AC_DEFINE(CONFIG_BLKID_DEBUG)
396	AC_MSG_RESULT([Enabling blkid debugging])
397fi
398,
399AC_MSG_RESULT([Disabling blkid debugging by default])
400)
401dnl
402dnl handle --enable-testio-debug
403dnl
404AC_ARG_ENABLE([testio-debug],
405[  --disable-testio-debug  disable the use of the test I/O manager for debugging],
406if test "$enableval" = "no"
407then
408	AC_MSG_RESULT([Disabling testio debugging])
409	TEST_IO_CMT="#"
410else
411	TEST_IO_CMT=
412	AC_DEFINE(CONFIG_TESTIO_DEBUG)
413	AC_MSG_RESULT([Enabling testio debugging])
414fi
415,
416AC_MSG_RESULT([Enabling testio debugging by default])
417AC_DEFINE(CONFIG_TESTIO_DEBUG)
418TEST_IO_CMT=
419)
420AC_SUBST(TEST_IO_CMT)
421dnl
422dnl handle --disable-libuuid
423dnl
424PKG_PROG_PKG_CONFIG
425LIBUUID=
426DEPLIBUUID=
427STATIC_LIBUUID=
428DEPSTATIC_LIBUUID=
429PROFILED_LIBUUID=
430DEPPROFILED_LIBUUID=
431UUID_CMT=
432AC_ARG_ENABLE([libuuid],
433[  --disable-libuuid	  do not build private uuid library],
434if test "$enableval" = "no"
435then
436	if test -z "$PKG_CONFIG"; then
437		AC_MSG_ERROR([pkg-config not installed; please install it.])
438	fi
439
440	AC_CHECK_LIB(uuid, uuid_generate,
441		[LIBUUID=`$PKG_CONFIG --libs uuid`;
442		 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`],
443		[AC_MSG_ERROR([external uuid library not found])],
444		[$LIBUUID])
445	UUID_CMT=#
446	AC_MSG_RESULT([Disabling private uuid library])
447else
448	LIBUUID='$(LIB)/libuuid'$LIB_EXT
449	DEPLIBUUID=$LIBUUID
450	STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
451	DEPSTATIC_LIBUUID=$STATIC_LIBUUID
452	PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
453	DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
454	AC_MSG_RESULT([Enabling private uuid library])
455fi
456,
457LIBUUID='$(LIB)/libuuid'$LIB_EXT
458DEPLIBUUID=$LIBUUID
459STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
460DEPSTATIC_LIBUUID=$STATIC_LIBUUID
461PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
462DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
463AC_MSG_RESULT([Enabling private uuid library by default])
464)
465AC_SUBST(LIBUUID)
466AC_SUBST(DEPLIBUUID)
467AC_SUBST(STATIC_LIBUUID)
468AC_SUBST(DEPSTATIC_LIBUUID)
469AC_SUBST(PROFILED_LIBUUID)
470AC_SUBST(DEPPROFILED_LIBUUID)
471AC_SUBST(UUID_CMT)
472dnl
473dnl handle --disable-libblkid
474dnl
475PKG_PROG_PKG_CONFIG
476LIBBLKID=
477DEPLIBBLKID=
478STATIC_LIBBLKID=
479DEPSTATIC_LIBBLKID=
480PROFILED_LIBBLKID=
481DEPPROFILED_LIBBLKID=
482BLKID_CMT=
483AC_ARG_ENABLE([libblkid],
484[  --disable-libblkid	  do not build private blkid library],
485if test "$enableval" = "no"
486then
487	if test -z "$PKG_CONFIG"; then
488		AC_MSG_ERROR([pkg-config not installed; please install it.])
489	fi
490
491	AC_CHECK_LIB(blkid, blkid_get_cache,
492		[LIBBLKID=`$PKG_CONFIG --libs blkid`;
493		 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
494		[AC_MSG_ERROR([external blkid library not found])],
495		[$LIBBLKID])
496	BLKID_CMT=#
497	AC_MSG_RESULT([Disabling private blkid library])
498else
499	LIBBLKID='$(LIB)/libblkid'$LIB_EXT
500	DEPLIBBLKID=$LIBBLKID
501	STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
502	DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
503	PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
504	DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
505	AC_DEFINE(CONFIG_BUILD_FINDFS)
506	AC_MSG_RESULT([Enabling private blkid library])
507fi
508,
509LIBBLKID='$(LIB)/libblkid'$LIB_EXT
510DEPLIBBLKID=$LIBBLKID
511STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
512DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
513PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
514DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
515AC_DEFINE(CONFIG_BUILD_FINDFS)
516AC_MSG_RESULT([Enabling private blkid library by default])
517)
518AC_SUBST(LIBBLKID)
519AC_SUBST(DEPLIBBLKID)
520AC_SUBST(STATIC_LIBBLKID)
521AC_SUBST(DEPSTATIC_LIBBLKID)
522AC_SUBST(PROFILED_LIBBLKID)
523AC_SUBST(DEPPROFILED_LIBBLKID)
524AC_SUBST(BLKID_CMT)
525dnl
526dnl handle --enable-debugfs
527dnl
528AC_ARG_ENABLE([debugfs],
529[  --disable-debugfs   	  disable support of debugfs program],
530if test "$enableval" = "no"
531then
532	AC_MSG_RESULT([Disabling debugfs support])
533	DEBUGFS_CMT="#"
534else
535	DEBUGFS_CMT=
536	AC_MSG_RESULT([Enabling debugfs support])
537fi
538,
539AC_MSG_RESULT([Enabling debugfs support by default])
540DEBUGFS_CMT=
541)
542AC_SUBST(DEBUGFS_CMT)
543dnl
544dnl handle --enable-imager
545dnl
546AC_ARG_ENABLE([imager],
547[  --disable-imager   	  disable support of e2image program],
548if test "$enableval" = "no"
549then
550	AC_MSG_RESULT([Disabling e2image support])
551	IMAGER_CMT="#"
552else
553	IMAGER_CMT=
554	AC_MSG_RESULT([Enabling e2image support])
555fi
556,
557AC_MSG_RESULT([Enabling e2image support by default])
558IMAGER_CMT=
559)
560AC_SUBST(IMAGER_CMT)
561dnl
562dnl handle --enable-resizer
563dnl
564AC_ARG_ENABLE([resizer],
565[  --disable-resizer   	  disable support of e2resize program],
566if test "$enableval" = "no"
567then
568	AC_MSG_RESULT([Disabling e2resize support])
569	RESIZER_CMT="#"
570else
571	RESIZER_CMT=
572	AC_MSG_RESULT([Enabling e2resize support])
573fi
574,
575AC_MSG_RESULT([Enabling e2resize support by default])
576RESIZER_CMT=
577)
578AC_SUBST(RESIZER_CMT)
579dnl
580dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
581dnl
582AC_ARG_ENABLE([fsck],
583[  --enable-fsck           build fsck wrapper program],
584[if test "$enableval" = "no"
585then
586	FSCK_PROG='' FSCK_MAN=''
587	AC_MSG_RESULT([Not building fsck wrapper])
588else
589	FSCK_PROG=fsck FSCK_MAN=fsck.8
590	AC_MSG_RESULT([Building fsck wrapper])
591fi]
592,
593[case "$host_os" in
594  gnu*)
595    FSCK_PROG='' FSCK_MAN=''
596    AC_MSG_RESULT([Not building fsck wrapper by default])
597    ;;
598  *)
599    FSCK_PROG=fsck FSCK_MAN=fsck.8
600    AC_MSG_RESULT([Building fsck wrapper by default])
601esac]
602)
603AC_SUBST(FSCK_PROG)
604AC_SUBST(FSCK_MAN)
605dnl
606dnl See whether to install the `e2initrd-helper' program
607dnl
608AC_ARG_ENABLE([e2initrd-helper],
609[  --enable-e2initrd-helper build e2initrd-helper program],
610[if test "$enableval" = "no"
611then
612	E2INITRD_PROG='' E2INITRD_MAN=''
613	AC_MSG_RESULT([Not building e2initrd helper])
614else
615	E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
616	AC_MSG_RESULT([Building e2initrd helper])
617fi]
618,
619E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
620AC_MSG_RESULT([Building e2initrd helper by default])
621)
622AC_SUBST(E2INITRD_PROG)
623AC_SUBST(E2INITRD_MAN)
624dnl
625dnl
626dnl
627AC_ARG_ENABLE([tls],
628[  --disable-tls           disable use of thread local support],
629[if test "$enableval" = "no"
630then
631	try_tls=""
632	AC_MSG_RESULT([Disabling thread local support])
633else
634	try_tls="yes"
635	AC_MSG_RESULT([Enabling thread local support])
636fi]
637,
638if test -n "$WITH_DIET_LIBC"
639then
640	try_tls=""
641	AC_MSG_RESULT([Diet libc does not support thread local support])
642else
643	try_tls="yes"
644	AC_MSG_RESULT([Try using thread local support by default])
645fi
646)
647if test "$try_tls" = "yes"
648then
649AX_TLS
650fi
651dnl
652dnl
653dnl
654AC_ARG_ENABLE([uuidd],
655[  --disable-uuidd         disable building the uuid daemon],
656[if test "$enableval" = "no"
657then
658	AC_MSG_RESULT([Not building uuidd])
659	UUIDD_CMT="#"
660else
661	AC_DEFINE(USE_UUIDD)
662	UUIDD_CMT=""
663	AC_MSG_RESULT([Building uuidd])
664fi]
665,
666AC_DEFINE(USE_UUIDD)
667UUIDD_CMT=""
668AC_MSG_RESULT([Building uuidd by default])
669)
670AC_SUBST(UUIDD_CMT)
671dnl
672dnl
673dnl
674MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
675AC_SUBST_FILE(MAKEFILE_LIBRARY)
676dnl
677dnl Add internationalization support, using gettext.
678dnl
679GETTEXT_PACKAGE=e2fsprogs
680PACKAGE=e2fsprogs
681VERSION="$E2FSPROGS_VERSION"
682VERSION=0.14.1
683AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
684AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
685AC_SUBST(GETTEXT_PACKAGE)
686AC_SUBST(PACKAGE)
687AC_SUBST(VERSION)
688
689AM_GNU_GETTEXT
690dnl
691dnl End of configuration options
692dnl
693AC_SUBST(BINARY_TYPE)
694AC_PROG_MAKE_SET
695CHECK_GNU_MAKE
696AC_PATH_PROG(LN, ln, ln)
697AC_PROG_LN_S
698AC_PATH_PROG(MV, mv, mv)
699AC_PATH_PROG(CP, cp, cp)
700AC_PATH_PROG(RM, rm, rm)
701AC_PATH_PROG(CHMOD, chmod, :)
702AC_PROG_AWK
703AC_PROG_EGREP
704AC_PATH_PROG(SED, sed, sed)
705AC_PATH_PROG(PERL, perl, perl)
706AC_PATH_PROG(LDCONFIG, ldconfig, :)
707AC_CHECK_TOOL(AR, ar, ar)
708AC_CHECK_TOOL(RANLIB, ranlib, :)
709AC_CHECK_TOOL(STRIP, strip, :)
710AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
711if test "_$MAKEINFO" = "_"; then
712    MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
713else
714    case "$MAKEINFO" in
715      */missing.*)
716        AC_MSG_WARN([
717*** Makeinfo is missing. Info documentation will not be built.])
718        ;;
719      *)
720        ;;
721    esac
722fi
723AC_SUBST(MAKEINFO)
724AC_PROG_INSTALL
725# See if we need a separate native compiler.
726if test $cross_compiling = no; then
727  BUILD_CC="$CC"
728  AC_SUBST(BUILD_CC)
729else
730  AC_CHECK_PROGS(BUILD_CC, gcc cc)
731fi
732AC_CHECK_HEADERS(dirent.h errno.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.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)
733AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
734[[
735#if HAVE_SYS_QUEUE_H
736#include <sys/queue.h>
737#endif
738]])
739AC_CHECK_HEADERS(net/if.h,,,
740[[
741#if HAVE_SYS_TYPES_H
742#include <sys/types.h>
743#endif
744#if HAVE_SYS_SOCKET
745#include <sys/socket.h>
746#endif
747]])
748AC_FUNC_VPRINTF
749dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
750dnl is not decleared.
751AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
752		[#include <dirent.h>])
753dnl Check to see if ssize_t was decleared
754AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
755	      [#include <sys/types.h>])
756dnl
757dnl Check to see if llseek() is declared in unistd.h.  On some libc's
758dnl it is, and on others it isn't..... Thank you glibc developers....
759dnl
760AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
761	      [#include <unistd.h>])
762dnl
763dnl Check to see if lseek64() is declared in unistd.h.  Glibc's header files
764dnl are so convoluted that I can't tell whether it will always be defined,
765dnl and if it isn't defined while lseek64 is defined in the library,
766dnl disaster will strike.
767dnl
768dnl Warning!  Use of --enable-gcc-wall may throw off this test.
769dnl
770dnl
771AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
772		[#define _LARGEFILE_SOURCE
773		 #define _LARGEFILE64_SOURCE
774		 #include <unistd.h>])
775dnl
776dnl Word sizes...
777dnl
778AC_CHECK_SIZEOF(short)
779AC_CHECK_SIZEOF(int)
780AC_CHECK_SIZEOF(long)
781AC_CHECK_SIZEOF(long long)
782SIZEOF_SHORT=$ac_cv_sizeof_short
783SIZEOF_INT=$ac_cv_sizeof_int
784SIZEOF_LONG=$ac_cv_sizeof_long
785SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
786AC_SUBST(SIZEOF_SHORT)
787AC_SUBST(SIZEOF_INT)
788AC_SUBST(SIZEOF_LONG)
789AC_SUBST(SIZEOF_LONG_LONG)
790AC_C_BIGENDIAN
791BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
792ASM_TYPES_HEADER=./asm_types.h
793AC_SUBST_FILE(ASM_TYPES_HEADER)
794dnl
795dnl Save the configuration #defines needed for the public ext2fs.h
796dnl header file
797dnl
798echo "/* These defines are needed for the public ext2fs.h header file */" \
799     > public_config.h
800if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
801  uniq tmp_config.$$ >> public_config.h
802else
803  echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
804fi
805if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
806  uniq tmp_config.$$ >> public_config.h
807else
808  echo "#undef WORDS_BIGENDIAN" >> public_config.h
809fi
810rm -f tmp_config.$$
811PUBLIC_CONFIG_HEADER=./public_config.h
812AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
813dnl
814dnl See if we have inttypes.h and if intptr_t is defined
815dnl
816AC_CHECK_HEADERS([inttypes.h])
817AC_CHECK_TYPES(intptr_t)
818dnl
819dnl See if struct stat has a st_flags field, in which case we can get file
820dnl flags somewhat portably.  Also check for the analogous setter, chflags().
821dnl
822AC_MSG_CHECKING(whether struct stat has a st_flags field)
823AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
824	AC_TRY_COMPILE([#include <sys/stat.h>],
825		[struct stat stat; stat.st_flags = 0;],
826		[e2fsprogs_cv_struct_st_flags=yes],
827		[e2fsprogs_cv_struct_st_flags=no]))
828AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
829if test "$e2fsprogs_cv_struct_st_flags" = yes; then
830  AC_MSG_CHECKING(whether st_flags field is useful)
831  AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
832	AC_TRY_COMPILE([#include <sys/stat.h>],
833		[struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
834		[e2fsprogs_cv_struct_st_flags_immut=yes],
835		[e2fsprogs_cv_struct_st_flags_immut=no]))
836  AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
837  if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
838	  AC_DEFINE(HAVE_STAT_FLAGS)
839  fi
840fi
841dnl
842dnl Check for the presence of SA_LEN
843dnl
844AC_CHECK_MEMBER(struct sockaddr.sa_len,
845		AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
846	[#include <sys/types.h>
847	 #include <sys/socket.h>])
848dnl
849dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using
850dnl the system-provided blkid library
851dnl
852if test -n "$BLKID_CMT"; then
853  AC_SEARCH_LIBS([blkid_probe_all], [blkid])
854fi
855dnl
856AC_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 usleep nanosleep getdtablesize getrlimit blkid_probe_get_topology mbstowcs)
857dnl
858dnl Check to see if -lsocket is required (solaris) to make something
859dnl that uses socket() to compile; this is needed for the UUID library
860dnl
861SOCKET_LIB=''
862AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
863AC_SUBST(SOCKET_LIB)
864dnl
865dnl See if optreset exists
866dnl
867AC_MSG_CHECKING(for optreset)
868AC_CACHE_VAL(ac_cv_have_optreset,
869[AC_EGREP_HEADER(optreset, unistd.h,
870  ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
871AC_MSG_RESULT($ac_cv_have_optreset)
872if test $ac_cv_have_optreset = yes; then
873  AC_DEFINE(HAVE_OPTRESET)
874fi
875dnl
876dnl Test for sem_init, and which library it might require:
877dnl
878SEM_INIT_LIB=''
879AC_CHECK_FUNC(sem_init, ,
880  AC_CHECK_LIB(pthread, sem_init,
881  	AC_DEFINE(HAVE_SEM_INIT)
882  	SEM_INIT_LIB=-lpthread,
883  AC_CHECK_LIB(rt, sem_init,
884  	AC_DEFINE(HAVE_SEM_INIT)
885  	SEM_INIT_LIB=-lrt,
886  AC_CHECK_LIB(posix4, sem_init,
887  	AC_DEFINE(HAVE_SEM_INIT)
888  	SEM_INIT_LIB=-lposix4))))dnl
889AC_SUBST(SEM_INIT_LIB)
890dnl
891dnl Check for unified diff
892dnl
893AC_MSG_CHECKING(for unified diff option)
894if diff -u $0 $0 > /dev/null 2>&1 ; then
895   UNI_DIFF_OPTS=-u
896else
897   UNI_DIFF_OPTS=-c
898fi
899AC_MSG_RESULT($UNI_DIFF_OPTS)
900AC_SUBST(UNI_DIFF_OPTS)
901dnl
902dnl We use the EXT2 ioctls only under Linux
903dnl
904case "$host_os" in
905linux*)
906	AC_DEFINE(HAVE_EXT2_IOCTLS)
907	;;
908esac
909dnl
910dnl OS-specific uncomment control
911dnl
912LINUX_CMT="#"
913CYGWIN_CMT="#"
914UNIX_CMT=
915case "$host_os" in
916linux*)
917	LINUX_CMT=
918	;;
919cygwin)
920	CYGWIN_CMT=
921	UNIX_CMT="#"
922	;;
923esac
924AC_SUBST(LINUX_CMT)
925AC_SUBST(CYGWIN_CMT)
926AC_SUBST(UNIX_CMT)
927dnl
928dnl Linux and Hurd places root files in the / by default
929dnl
930case "$host_os" in
931linux* | gnu* | k*bsd*-gnu)
932	if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
933		root_prefix="";
934		AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
935	fi
936	;;
937esac
938dnl
939dnl On Linux/hurd, force the prefix to be /usr
940dnl
941case "$host_os" in
942linux* | gnu* | k*bsd*-gnu)
943	if test "$prefix" = NONE ; then
944		prefix="/usr";
945		AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
946		if test "$mandir" = '${prefix}/man' ; then
947			AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
948			mandir=/usr/share/man
949		fi
950	fi
951;;
952esac
953if test "$root_prefix" = NONE ; then
954	if test "$prefix" = NONE ; then
955		root_prefix="$ac_default_prefix"
956	else
957		root_prefix="$prefix"
958	fi
959	root_bindir=$bindir
960	root_sbindir=$sbindir
961	root_libdir=$libdir
962	root_sysconfdir=$sysconfdir
963else
964	root_bindir='${root_prefix}/bin'
965	root_sbindir='${root_prefix}/sbin'
966	root_libdir='${root_prefix}/lib'
967	root_sysconfdir='${root_prefix}/etc'
968fi
969if test "$bindir" != '${exec_prefix}/bin'; then
970    root_bindir=$bindir
971    AC_MSG_RESULT([Setting root_bindir to $root_bindir])
972fi
973if test "$sbindir" != '${exec_prefix}/sbin'; then
974    root_sbindir=$sbindir
975    AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
976fi
977if test "$libdir" != '${exec_prefix}/lib'; then
978    root_libdir=$libdir
979    AC_MSG_RESULT([Setting root_libdir to $root_libdir])
980fi
981if test "$sysconfdir" != '${prefix}/etc'; then
982    root_sysconfdir=$sysconfdir
983    AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
984fi
985AC_SUBST(root_prefix)
986AC_SUBST(root_bindir)
987AC_SUBST(root_sbindir)
988AC_SUBST(root_libdir)
989AC_SUBST(root_sysconfdir)
990dnl
991dnl See if -static works.
992dnl
993AC_MSG_CHECKING([whether linker accepts -static])
994AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
995[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
996AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
997 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
998LDFLAGS=$SAVE_LDFLAGS])
999dnl
1000dnl Regardless of how the test turns out, Solaris doesn't handle -static
1001dnl This is caused by the socket library requiring the nsl library, which
1002dnl requires the -dl library, which only works for dynamically linked
1003dnl programs.  It basically means you can't have statically linked programs
1004dnl which use the network under Solaris.
1005dnl
1006case "$host_os" in
1007solaris2.*)
1008	ac_cv_e2fsprogs_use_static=no
1009;;
1010esac
1011AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
1012LDFLAG_STATIC=
1013if test $ac_cv_e2fsprogs_use_static = yes; then
1014	LDFLAG_STATIC=-static
1015fi
1016AC_SUBST(LDFLAG_STATIC)
1017dnl
1018dnl Work around mysterious Darwin / GNU libintl problem
1019dnl (__asm__ redirection doesn't work for some mysterious reason.  Looks like
1020dnl Apple hacked gcc somehow?)
1021dnl
1022case "$host_os" in
1023darwin*)
1024	AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
1025	AC_DEFINE(_INTL_REDIRECT_MACROS)
1026	;;
1027esac
1028dnl
1029dnl Make the ss and et directories work correctly.
1030dnl
1031SS_DIR=`cd ${srcdir}/lib/ss; pwd`
1032ET_DIR=`cd ${srcdir}/lib/et; pwd`
1033AC_SUBST(SS_DIR)
1034AC_SUBST(ET_DIR)
1035dnl
1036dnl Only try to run the test suite if we're not cross compiling.
1037dnl
1038if test "$cross_compiling" = yes ; then
1039  DO_TEST_SUITE=
1040else
1041  DO_TEST_SUITE=check
1042fi
1043AC_SUBST(DO_TEST_SUITE)
1044dnl
1045dnl Only include the intl include files if we're building with them
1046dnl
1047INTL_FLAGS=
1048if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
1049	INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
1050fi
1051AC_SUBST(INTL_FLAGS)
1052dnl
1053dnl Build CFLAGS
1054dnl
1055if test $cross_compiling = no; then
1056   BUILD_CFLAGS="$CFLAGS"
1057   BUILD_LDFLAGS="$LDFLAGS"
1058else
1059   BUILD_CFLAGS=
1060   BUILD_LDFLAGS=
1061fi
1062AC_SUBST(BUILD_CFLAGS)
1063AC_SUBST(BUILD_LDFLAGS)
1064dnl
1065dnl Make our output files, being sure that we create the some miscellaneous
1066dnl directories
1067dnl
1068test -d lib || mkdir lib
1069test -d include || mkdir include
1070test -d include/linux || mkdir include/linux
1071test -d include/asm || mkdir include/asm
1072for i in MCONFIG Makefile e2fsprogs.spec \
1073	util/Makefile util/subst.conf util/gen-tarball \
1074	lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
1075	lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
1076	lib/uuid/Makefile lib/uuid/uuid_types.h \
1077	lib/blkid/Makefile lib/blkid/blkid_types.h \
1078	lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
1079	lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
1080	misc/Makefile ext2ed/Makefile e2fsck/Makefile \
1081	debugfs/Makefile tests/Makefile tests/progs/Makefile \
1082	resize/Makefile doc/Makefile intl/Makefile \
1083	intl/libgnuintl.h po/Makefile.in ; do
1084	if test -d `dirname ${srcdir}/$i` ; then
1085		outlist="$outlist $i"
1086	fi
1087done
1088AC_OUTPUT($outlist)
1089if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi
1090