OSDN Git Service

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