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