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