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