]> 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 *) 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 pre_vers=`echo $base_ver 0.01 - p | dc`
45
46 date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
47
48 case $E2FSPROGS_VERSION in
49 *-WIP|pre-*)
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 handle --enable-elf-shlibs
211 dnl
212 AC_ARG_ENABLE([elf-shlibs],
213 [ --enable-elf-shlibs select ELF shared libraries],
214 if test "$enableval" = "no"
215 then
216 ELF_CMT=#
217 MAKEFILE_ELF=/dev/null
218 echo "Disabling ELF shared libraries"
219 else
220 ELF_CMT=
221 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
222 [case "$host_os" in
223 solaris2.*)
224 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
225 ;;
226 esac]
227 BINARY_TYPE=elfbin
228 LIB_EXT=.so
229 echo "Enabling ELF shared libraries"
230 fi
231 ,
232 MAKEFILE_ELF=/dev/null
233 ELF_CMT=#
234 echo "Disabling ELF shared libraries by default"
235 )
236 AC_SUBST(ELF_CMT)
237 AC_SUBST_FILE(MAKEFILE_ELF)
238 dnl
239 dnl handle --enable-bsd-shlibs
240 dnl
241 AC_ARG_ENABLE([bsd-shlibs],
242 [ --enable-bsd-shlibs select BSD shared libraries],
243 if test "$enableval" = "no"
244 then
245 BSDLIB_CMT=#
246 MAKEFILE_BSDLIB=/dev/null
247 echo "Disabling BSD shared libraries"
248 else
249 BSDLIB_CMT=
250 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
251 LIB_EXT=.so
252 [case "$host_os" in
253 darwin*)
254 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
255 LIB_EXT=.dylib
256 ;;
257 esac]
258 echo "Enabling BSD shared libraries"
259 fi
260 ,
261 MAKEFILE_BSDLIB=/dev/null
262 BSDLIB_CMT=#
263 echo "Disabling BSD shared libraries by default"
264 )
265 AC_SUBST(BSDLIB_CMT)
266 AC_SUBST_FILE(MAKEFILE_BSDLIB)
267 dnl
268 dnl handle --enable-profile
269 dnl
270 AC_ARG_ENABLE([profile],
271 [ --enable-profile build profiling libraries],
272 if test "$enableval" = "no"
273 then
274 PROFILE_CMT=#
275 MAKEFILE_PROFILE=/dev/null
276 echo "Disabling profiling libraries"
277 else
278 PROFILE_CMT=
279 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
280 PROFILED_LIB_EXT=_p.a
281 echo "Building profiling libraries"
282 fi
283 ,
284 PROFILE_CMT=#
285 MAKEFILE_PROFILE=/dev/null
286 echo "Disabling profiling libraries by default"
287 )
288 AC_SUBST(PROFILE_CMT)
289 AC_SUBST_FILE(MAKEFILE_PROFILE)
290 dnl
291 dnl handle --enable-checker
292 dnl
293 AC_ARG_ENABLE([checker],
294 [ --enable-checker build checker libraries],
295 if test "$enableval" = "no"
296 then
297 CHECKER_CMT=#
298 MAKEFILE_CHECKER=/dev/null
299 echo "Disabling checker libraries"
300 else
301 CHECKER_CMT=
302 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
303 echo "Building checker libraries"
304 fi
305 ,
306 CHECKER_CMT=#
307 MAKEFILE_CHECKER=/dev/null
308 echo "Disabling checker libraries by default"
309 )
310 AC_SUBST(CHECKER_CMT)
311 AC_SUBST_FILE(MAKEFILE_CHECKER)
312 dnl
313 dnl Substitute library extensions
314 dnl
315 AC_SUBST(LIB_EXT)
316 AC_SUBST(STATIC_LIB_EXT)
317 AC_SUBST(PROFILED_LIB_EXT)
318 dnl
319 dnl handle --enable-jbd-debug
320 dnl
321 AC_ARG_ENABLE([jbd-debug],
322 [ --enable-jbd-debug enable journal debugging],
323 if test "$enableval" = "no"
324 then
325 echo "Disabling journal debugging"
326 else
327 AC_DEFINE(CONFIG_JBD_DEBUG)
328 echo "Enabling journal debugging"
329 fi
330 ,
331 echo "Disabling journal debugging by default"
332 )
333 dnl
334 dnl handle --enable-blkid-debug
335 dnl
336 AC_ARG_ENABLE([blkid-debug],
337 [ --enable-blkid-debug enable blkid debugging],
338 if test "$enableval" = "no"
339 then
340 echo "Disabling blkid debugging"
341 else
342 AC_DEFINE(CONFIG_BLKID_DEBUG)
343 echo "Enabling blkid debugging"
344 fi
345 ,
346 echo "Disabling blkid debugging by default"
347 )
348 dnl
349 dnl handle --enable-testio-debug
350 dnl
351 AC_ARG_ENABLE([testio-debug],
352 [ --enable-testio-debug enable the use of the test I/O manager for debugging],
353 if test "$enableval" = "no"
354 then
355 echo "Disabling testio debugging"
356 else
357 AC_DEFINE(CONFIG_TESTIO_DEBUG)
358 echo "Enabling testio debugging"
359 fi
360 ,
361 echo "Disabling testio debugging by default"
362 )
363 dnl
364 dnl handle --enable-debugfs
365 dnl
366 AC_ARG_ENABLE([debugfs],
367 [ --disable-debugfs disable support of debugfs program],
368 if test "$enableval" = "no"
369 then
370 echo "Disabling debugfs support"
371 DEBUGFS_CMT="#"
372 else
373 DEBUGFS_CMT=
374 echo "Enabling debugfs support"
375 fi
376 ,
377 echo "Enabling debugfs support by default"
378 DEBUGFS_CMT=
379 )
380 AC_SUBST(DEBUGFS_CMT)
381 dnl
382 dnl handle --enable-imager
383 dnl
384 AC_ARG_ENABLE([imager],
385 [ --disable-imager disable support of e2image program],
386 if test "$enableval" = "no"
387 then
388 echo "Disabling e2image support"
389 IMAGER_CMT="#"
390 else
391 IMAGER_CMT=
392 echo "Enabling e2image support"
393 fi
394 ,
395 echo "Enabling e2image support by default"
396 IMAGER_CMT=
397 )
398 AC_SUBST(IMAGER_CMT)
399 dnl
400 dnl handle --enable-resizer
401 dnl
402 AC_ARG_ENABLE([resizer],
403 [ --disable-resizer disable support of e2resize program],
404 if test "$enableval" = "no"
405 then
406 echo "Disabling e2resize support"
407 RESIZER_CMT="#"
408 else
409 RESIZER_CMT=
410 echo "Enabling e2resize support"
411 fi
412 ,
413 echo "Enabling e2resize support by default"
414 RESIZER_CMT=
415 )
416 AC_SUBST(RESIZER_CMT)
417 dnl
418 dnl handle --enable-dynamic-e2fsck
419 dnl
420 AC_ARG_ENABLE([dynamic-e2fsck],
421 [ --enable-dynamic-e2fsck build e2fsck dynamically],
422 if test "$enableval" = "no"
423 then
424 E2FSCK_TYPE=static
425 echo "Building e2fsck statically"
426 else
427 E2FSCK_TYPE=shared
428 echo "Building e2fsck dynamically"
429 fi
430 ,
431 E2FSCK_TYPE=static
432 echo "Building e2fsck statically by default"
433 )
434 AC_SUBST(E2FSCK_TYPE)
435 dnl
436 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
437 dnl
438 AC_ARG_ENABLE([fsck],
439 [ --enable-fsck build fsck wrapper program],
440 [if test "$enableval" = "no"
441 then
442 FSCK_PROG='' FSCK_MAN=''
443 echo "Not building fsck wrapper"
444 else
445 FSCK_PROG=fsck FSCK_MAN=fsck.8
446 echo "Building fsck wrapper"
447 fi]
448 ,
449 [case "$host_os" in
450 gnu*)
451 FSCK_PROG='' FSCK_MAN=''
452 echo "Not building fsck wrapper by default"
453 ;;
454 *)
455 FSCK_PROG=fsck FSCK_MAN=fsck.8
456 echo "Building fsck wrapper by default"
457 esac]
458 )
459 AC_SUBST(FSCK_PROG)
460 AC_SUBST(FSCK_MAN)
461 dnl
462 dnl See whether to install the `e2initrd-helper' program
463 dnl
464 AC_ARG_ENABLE([e2initrd-helper],
465 [ --enable-e2initrd-helper build e2initrd-helper program],
466 [if test "$enableval" = "no"
467 then
468 E2INITRD_PROG='' E2INITRD_MAN=''
469 echo "Not building e2initrd helper"
470 else
471 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
472 echo "Building e2initrd helper"
473 fi]
474 ,
475 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
476 echo "Building e2initrd helper by default"
477 )
478 AC_SUBST(E2INITRD_PROG)
479 AC_SUBST(E2INITRD_MAN)
480 dnl handle --enable-blkid-devmapper
481 dnl
482 AC_ARG_ENABLE([blkid-devmapper],
483 [ --enable-blkid-devmapper build with device-mapper support],
484 [if test "$enableval" = "no"
485 then
486 echo "Disabling device-mapper support"
487 DEVMAPPER_REQ=''
488 DEVMAPPER_LIBS=''
489 STATIC_DEVMAPPER_LIBS=''
490 else
491 AC_DEFINE(HAVE_DEVMAPPER)
492 echo "Enabling device-mapper support"
493
494 DEVMAPPER_REQ='libselinux libsepol'
495 DEVMAPPER_PC_LIBS='-ldevmapper'
496 DEVMAPPER_LIBS='-ldevmapper -lselinux -lsepol -lpthread'
497 STATIC_DEVMAPPER_LIBS='/usr/lib/libdevmapper.a /usr/lib/libselinux.a /usr/lib/libsepol.a -lpthread'
498
499 fi]
500 ,
501 echo "Disabling device-mapper support by default"
502 )
503 AC_SUBST(DEVMAPPER_REQ)
504 AC_SUBST(DEVMAPPER_PC_LIBS)
505 AC_SUBST(DEVMAPPER_LIBS)
506 AC_SUBST(STATIC_DEVMAPPER_LIBS)
507 dnl
508 dnl
509 dnl
510 AC_ARG_ENABLE([tls],
511 [ --disable-tls disable use of thread local support],
512 [if test "$enableval" = "no"
513 then
514 try_tls=""
515 echo "Disabling thread local support"
516 else
517 try_tls="yes"
518 echo "Enabling thread local support"
519 fi]
520 ,
521 try_tls="yes"
522 echo "Try using thread local support by default"
523 )
524 if test "$try_tls" = "yes"
525 then
526 AX_TLS
527 fi
528 dnl
529 dnl
530 dnl
531 AC_ARG_ENABLE([uuidd],
532 [ --disable-uuidd disable building the uuid daemon],
533 [if test "$enableval" = "no"
534 then
535 echo "Not building uuidd"
536 UUIDD_CMT="#"
537 else
538 AC_DEFINE(USE_UUIDD)
539 UUIDD_CMT=""
540 echo "Building uuidd"
541 fi]
542 ,
543 AC_DEFINE(USE_UUIDD)
544 UUIDD_CMT=""
545 echo "Building uuidd by default"
546 )
547 AC_SUBST(UUIDD_CMT)
548 dnl
549 dnl
550 dnl
551 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
552 AC_SUBST_FILE(MAKEFILE_LIBRARY)
553 dnl
554 dnl Add internationalization support, using gettext.
555 dnl
556 GETTEXT_PACKAGE=e2fsprogs
557 PACKAGE=e2fsprogs
558 VERSION="$E2FSPROGS_VERSION"
559 VERSION=0.14.1
560 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
561 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
562 AC_SUBST(GETTEXT_PACKAGE)
563 AC_SUBST(PACKAGE)
564 AC_SUBST(VERSION)
565
566 AM_GNU_GETTEXT
567 dnl
568 dnl End of configuration options
569 dnl
570 AC_SUBST(BINARY_TYPE)
571 AC_PROG_MAKE_SET
572 AC_PATH_PROG(LN, ln, ln)
573 AC_PROG_LN_S
574 AC_PATH_PROG(MV, mv, mv)
575 AC_PATH_PROG(CP, cp, cp)
576 AC_PATH_PROG(RM, rm, rm)
577 AC_PATH_PROG(CHMOD, chmod, :)
578 AC_PROG_AWK
579 AC_PROG_EGREP
580 AC_PATH_PROG(SED, sed, sed)
581 AC_PATH_PROG(PERL, perl, perl)
582 AC_PATH_PROG(LDCONFIG, ldconfig, :)
583 AC_CHECK_TOOL(AR, ar, ar)
584 AC_CHECK_TOOL(RANLIB, ranlib, :)
585 AC_CHECK_TOOL(STRIP, strip, :)
586 AC_PROG_INSTALL
587 # See if we need a separate native compiler.
588 if test $cross_compiling = no; then
589 BUILD_CC="$CC"
590 AC_SUBST(BUILD_CC)
591 else
592 AC_CHECK_PROGS(BUILD_CC, gcc cc)
593 fi
594 AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h stdint.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mman.h sys/mkdev.h sys/prctl.h sys/queue.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h sys/syscall.h net/if_dl.h netinet/in.h utime.h)
595 AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
596 [[
597 #if HAVE_SYS_QUEUE_H
598 #include <sys/queue.h>
599 #endif
600 ]])
601 AC_CHECK_HEADERS(net/if.h,,,
602 [[
603 #if HAVE_SYS_TYPES_H
604 #include <sys/types.h>
605 #endif
606 #if HAVE_SYS_SOCKET
607 #include <sys/socket.h>
608 #endif
609 ]])
610 AC_FUNC_VPRINTF
611 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
612 dnl is not decleared.
613 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
614 [#include <dirent.h>])
615 dnl Check to see if ssize_t was decleared
616 AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
617 [#include <sys/types.h>])
618 dnl
619 dnl Check to see if llseek() is declared in unistd.h. On some libc's
620 dnl it is, and on others it isn't..... Thank you glibc developers....
621 dnl
622 AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
623 [#include <unistd.h>])
624 dnl
625 dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
626 dnl are so convoluted that I can't tell whether it will always be defined,
627 dnl and if it isn't defined while lseek64 is defined in the library,
628 dnl disaster will strike.
629 dnl
630 dnl Warning! Use of --enable-gcc-wall may throw off this test.
631 dnl
632 dnl
633 AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
634 [#define _LARGEFILE_SOURCE
635 #define _LARGEFILE64_SOURCE
636 #include <unistd.h>])
637 dnl
638 dnl Word sizes...
639 dnl
640 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
641 # if cross-compiling, with no cached values, just assume something common.
642 ac_cv_sizeof_short=2
643 ac_cv_sizeof_int=4
644 ac_cv_sizeof_long=4
645 ac_cv_sizeof_long_long=8
646 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4, long long=8])
647 fi
648 AC_CHECK_SIZEOF(short)
649 AC_CHECK_SIZEOF(int)
650 AC_CHECK_SIZEOF(long)
651 AC_CHECK_SIZEOF(long long)
652 SIZEOF_SHORT=$ac_cv_sizeof_short
653 SIZEOF_INT=$ac_cv_sizeof_int
654 SIZEOF_LONG=$ac_cv_sizeof_long
655 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
656 AC_SUBST(SIZEOF_SHORT)
657 AC_SUBST(SIZEOF_INT)
658 AC_SUBST(SIZEOF_LONG)
659 AC_SUBST(SIZEOF_LONG_LONG)
660 AC_C_BIGENDIAN
661 BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
662 ASM_TYPES_HEADER=./asm_types.h
663 AC_SUBST_FILE(ASM_TYPES_HEADER)
664 dnl
665 dnl See if we have inttypes.h and if intptr_t is defined
666 dnl
667 AC_CHECK_HEADERS([inttypes.h])
668 AC_CHECK_TYPES(intptr_t)
669 dnl
670 dnl See if struct stat has a st_flags field, in which case we can get file
671 dnl flags somewhat portably. Also check for the analogous setter, chflags().
672 dnl
673 AC_MSG_CHECKING(whether struct stat has a st_flags field)
674 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
675 AC_TRY_COMPILE([#include <sys/stat.h>],
676 [struct stat stat; stat.st_flags = 0;],
677 [e2fsprogs_cv_struct_st_flags=yes],
678 [e2fsprogs_cv_struct_st_flags=no]))
679 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
680 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
681 AC_MSG_CHECKING(whether st_flags field is useful)
682 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
683 AC_TRY_COMPILE([#include <sys/stat.h>],
684 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
685 [e2fsprogs_cv_struct_st_flags_immut=yes],
686 [e2fsprogs_cv_struct_st_flags_immut=no]))
687 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
688 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
689 AC_DEFINE(HAVE_STAT_FLAGS)
690 fi
691 fi
692 dnl
693 dnl Check for the presence of SA_LEN
694 dnl
695 AC_CHECK_MEMBER(struct sockaddr.sa_len,
696 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
697 [#include <sys/types.h>
698 #include <sys/socket.h>])
699 dnl
700 AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid)
701 dnl
702 dnl Check to see if -lsocket is required (solaris) to make something
703 dnl that uses socket() to compile; this is needed for the UUID library
704 dnl
705 SOCKET_LIB=''
706 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
707 AC_SUBST(SOCKET_LIB)
708 dnl
709 dnl Check to see if libdl exists for the sake of dlopen
710 dnl
711 DLOPEN_LIB=''
712 AC_CHECK_LIB(dl, dlopen,
713 [DLOPEN_LIB=-ldl
714 AC_DEFINE(HAVE_DLOPEN)])
715 AC_SUBST(DLOPEN_LIB)
716 dnl
717 dnl See if optreset exists
718 dnl
719 AC_MSG_CHECKING(for optreset)
720 AC_CACHE_VAL(ac_cv_have_optreset,
721 [AC_EGREP_HEADER(optreset, unistd.h,
722 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
723 AC_MSG_RESULT($ac_cv_have_optreset)
724 if test $ac_cv_have_optreset = yes; then
725 AC_DEFINE(HAVE_OPTRESET)
726 fi
727 dnl
728 dnl Check for unified diff
729 dnl
730 AC_MSG_CHECKING(for unified diff option)
731 if diff -u $0 $0 >& /dev/null ; then
732 UNI_DIFF_OPTS=-u
733 else
734 UNI_DIFF_OPTS=-c
735 fi
736 AC_MSG_RESULT($UNI_DIFF_OPTS)
737 AC_SUBST(UNI_DIFF_OPTS)
738 dnl
739 dnl We use the EXT2 ioctls only under Linux
740 dnl
741 case "$host_os" in
742 linux*)
743 AC_DEFINE(HAVE_EXT2_IOCTLS)
744 ;;
745 esac
746 dnl
747 dnl OS-specific uncomment control
748 dnl
749 LINUX_CMT="#"
750 CYGWIN_CMT="#"
751 UNIX_CMT=
752 case "$host_os" in
753 linux*)
754 LINUX_CMT=
755 ;;
756 cygwin)
757 CYGWIN_CMT=
758 UNIX_CMT="#"
759 ;;
760 esac
761 AC_SUBST(LINUX_CMT)
762 AC_SUBST(CYGWIN_CMT)
763 AC_SUBST(UNIX_CMT)
764 dnl
765 dnl Linux and Hurd places root files in the / by default
766 dnl
767 case "$host_os" in
768 linux* | gnu* | k*bsd*-gnu)
769 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
770 root_prefix="";
771 echo "On $host_os systems, root_prefix defaults to ''"
772 fi
773 ;;
774 esac
775 dnl
776 dnl On Linux/hurd, force the prefix to be /usr
777 dnl
778 case "$host_os" in
779 linux* | gnu* | k*bsd*-gnu)
780 if test "$prefix" = NONE ; then
781 prefix="/usr";
782 echo "On $host_os systems, prefix defaults to /usr"
783 if test "$mandir" = '${prefix}/man' ; then
784 echo "...and mandir defaults to /usr/share/man"
785 mandir=/usr/share/man
786 fi
787 fi
788 ;;
789 esac
790 if test "$root_prefix" = NONE ; then
791 if test "$prefix" = NONE ; then
792 root_prefix="$ac_default_prefix"
793 else
794 root_prefix="$prefix"
795 fi
796 root_bindir=$bindir
797 root_sbindir=$sbindir
798 root_libdir=$libdir
799 root_sysconfdir=$sysconfdir
800 else
801 root_bindir='${root_prefix}/bin'
802 root_sbindir='${root_prefix}/sbin'
803 root_libdir='${root_prefix}/lib'
804 root_sysconfdir='${root_prefix}/etc'
805 fi
806 AC_SUBST(root_prefix)
807 AC_SUBST(root_bindir)
808 AC_SUBST(root_sbindir)
809 AC_SUBST(root_libdir)
810 AC_SUBST(root_sysconfdir)
811 dnl
812 dnl See if -static works.
813 dnl
814 AC_MSG_CHECKING([whether linker accepts -static])
815 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
816 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
817 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
818 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
819 LDFLAGS=$SAVE_LDFLAGS])
820 dnl
821 dnl Regardless of how the test turns out, Solaris doesn't handle -static
822 dnl This is caused by the socket library requiring the nsl library, which
823 dnl requires the -dl library, which only works for dynamically linked
824 dnl programs. It basically means you can't have statically linked programs
825 dnl which use the network under Solaris.
826 dnl
827 case "$host_os" in
828 solaris2.*)
829 ac_cv_e2fsprogs_use_static=no
830 ;;
831 esac
832 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
833 LDFLAG_STATIC=
834 if test $ac_cv_e2fsprogs_use_static = yes; then
835 LDFLAG_STATIC=-static
836 fi
837 AC_SUBST(LDFLAG_STATIC)
838 dnl
839 dnl Work around mysterious Darwin / GNU libintl problem
840 dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
841 dnl Apple hacked gcc somehow?)
842 dnl
843 case "$host_os" in
844 darwin*)
845 echo "Using Apple Darwin / GNU libintl workaround"
846 AC_DEFINE(_INTL_REDIRECT_MACROS)
847 ;;
848 esac
849 dnl
850 dnl Make the ss and et directories work correctly.
851 dnl
852 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
853 ET_DIR=`cd ${srcdir}/lib/et; pwd`
854 AC_SUBST(SS_DIR)
855 AC_SUBST(ET_DIR)
856 dnl
857 dnl Only try to run the test suite if we're not cross compiling.
858 dnl
859 if test "$cross_compiling" = yes ; then
860 DO_TEST_SUITE=
861 else
862 DO_TEST_SUITE=check
863 fi
864 AC_SUBST(DO_TEST_SUITE)
865 dnl
866 dnl Only include the intl include files if we're building with them
867 dnl
868 INTL_FLAGS=
869 if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
870 INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
871 fi
872 AC_SUBST(INTL_FLAGS)
873 dnl
874 dnl Build CFLAGS
875 dnl
876 if test $cross_compiling = no; then
877 BUILD_CFLAGS="$CFLAGS"
878 BUILD_LDFLAGS="$LDFLAGS"
879 else
880 BUILD_CFLAGS=
881 BUILD_LDFLAGS=
882 fi
883 AC_SUBST(BUILD_CFLAGS)
884 AC_SUBST(BUILD_LDFLAGS)
885 dnl
886 dnl Make our output files, being sure that we create the some miscellaneous
887 dnl directories
888 dnl
889 test -d lib || mkdir lib
890 test -d include || mkdir include
891 test -d include/linux || mkdir include/linux
892 test -d include/asm || mkdir include/asm
893 for i in MCONFIG Makefile e2fsprogs.spec \
894 util/Makefile util/subst.conf util/gen-tarball \
895 lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
896 lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
897 lib/uuid/Makefile lib/uuid/uuid_types.h \
898 lib/blkid/Makefile lib/blkid/blkid_types.h \
899 lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
900 lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
901 misc/Makefile ext2ed/Makefile e2fsck/Makefile \
902 debugfs/Makefile tests/Makefile tests/progs/Makefile \
903 resize/Makefile doc/Makefile intl/Makefile po/Makefile.in ; do
904 if test -d `dirname ${srcdir}/$i` ; then
905 outlist="$outlist $i"
906 fi
907 done
908 AC_OUTPUT($outlist)
909 if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi
910