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