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