Whamcloud - gitweb
Update EVMS plugin to support EVMS ABI 1.2
[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 fi
141 ,
142 HTREE_CMT=
143 AC_DEFINE(ENABLE_HTREE)
144 echo "Enabling 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-emvs-10
168 dnl
169 EVMS_ABI_CODE=120
170 AC_ARG_ENABLE([evms-10],
171 [  --enable-evms-10       use EVMS 1.0 ABI (instead of EVMS 1.2)],
172 if test "$enableval" != "no"
173 then
174         EVMS_ABI_CODE=100
175         echo "Enabling EVMS 1.0.0 ABI"
176 fi
177 )
178 dnl
179 dnl handle --enable-emvs-11
180 dnl
181 AC_ARG_ENABLE([evms-11],
182 [  --enable-evms-11       use EVMS 1.1 ABI (instead of EVMS 1.1)],
183 if test "$enableval" != "no"
184 then
185         EVMS_ABI_CODE=110
186         echo "Enabling EVMS 1.1.0 ABI"
187 fi
188 )
189 if test "$EVMS_ABI_CODE" = "120"
190 then
191         echo "Using EVMS 1.2.0 ABI by default"
192 fi
193 AC_SUBST(EVMS_ABI_CODE)
194 dnl
195 dnl handle --enable-dll-shlibs
196 dnl
197 AC_ARG_ENABLE([dll-shlibs],
198 [  --enable-dll-shlibs    select DLL libraries],
199 if test "$enableval" = "no"
200 then
201         DLL_CMT=#
202         MAKEFILE_DLL=/dev/null
203         echo "Disabling DLL shared libraries"
204 else
205         DLL_CMT=
206         MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
207         BINARY_TYPE=dllbin
208         LIB_EXT=.sa
209         echo "Enabling DLL shared libraries"
210 fi
211 ,
212 MAKEFILE_DLL=/dev/null
213 DLL_CMT=#
214 echo "Disabling DLL shared libraries by default"
215 )
216 AC_SUBST(DLL_CMT)
217 AC_SUBST_FILE(MAKEFILE_DLL)
218 dnl
219 dnl handle --enable-elf-shlibs
220 dnl
221 AC_ARG_ENABLE([elf-shlibs],
222 [  --enable-elf-shlibs    select ELF shared libraries],
223 if test "$enableval" = "no"
224 then
225         ELF_CMT=#
226         MAKEFILE_ELF=/dev/null
227         echo "Disabling ELF shared libraries"
228 else
229         ELF_CMT=
230         MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
231         [case "$host_os" in
232         solaris2.*)
233                 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
234         ;;
235         esac]
236         BINARY_TYPE=elfbin
237         LIB_EXT=.so
238         echo "Enabling ELF shared libraries"
239 fi
240 ,
241 MAKEFILE_ELF=/dev/null
242 ELF_CMT=#
243 echo "Disabling ELF shared libraries by default"
244 )
245 AC_SUBST(ELF_CMT)
246 AC_SUBST_FILE(MAKEFILE_ELF)
247 dnl
248 dnl handle --enable-bsd-shlibs
249 dnl
250 AC_ARG_ENABLE([bsd-shlibs],
251 [  --enable-bsd-shlibs    select BSD shared libraries],
252 if test "$enableval" = "no"
253 then
254         BSDLIB_CMT=#
255         MAKEFILE_BSDLIB=/dev/null
256         echo "Disabling BSD shared libraries"
257 else
258         BSDLIB_CMT=
259         MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
260         LIB_EXT=.so
261         echo "Enabling BSD shared libraries"
262 fi
263 ,
264 MAKEFILE_BSDLIB=/dev/null
265 BSDLIB_CMT=#
266 echo "Disabling BSD shared libraries by default"
267 )
268 AC_SUBST(BSDLIB_CMT)
269 AC_SUBST_FILE(MAKEFILE_BSDLIB)
270 dnl
271 dnl handle --enable-profile
272 dnl
273 AC_ARG_ENABLE([profile],
274 [  --enable-profile       build profiling libraries],
275 if test "$enableval" = "no"
276 then
277         PROFILE_CMT=#
278         MAKEFILE_PROFILE=/dev/null
279         echo "Disabling profiling libraries"
280 else
281         PROFILE_CMT=
282         MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
283         PROFILED_LIB_EXT=_p.a
284         echo "Building profiling libraries"
285 fi
286 ,
287 PROFILE_CMT=#
288 MAKEFILE_PROFILE=/dev/null
289 echo "Disabling profiling libraries by default"
290 )
291 AC_SUBST(PROFILE_CMT)
292 AC_SUBST_FILE(MAKEFILE_PROFILE)
293 dnl
294 dnl handle --enable-checker
295 dnl
296 AC_ARG_ENABLE([checker],
297 [  --enable-checker       build checker libraries],
298 if test "$enableval" = "no"
299 then
300         CHECKER_CMT=#
301         MAKEFILE_CHECKER=/dev/null
302         echo "Disabling checker libraries"
303 else
304         CHECKER_CMT=
305         MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
306         echo "Building checker libraries"
307 fi
308 ,
309 CHECKER_CMT=#
310 MAKEFILE_CHECKER=/dev/null
311 echo "Disabling checker libraries by default"
312 )
313 AC_SUBST(CHECKER_CMT)
314 AC_SUBST_FILE(MAKEFILE_CHECKER)
315 dnl
316 dnl Substitute library extensions
317 dnl
318 AC_SUBST(LIB_EXT)
319 AC_SUBST(STATIC_LIB_EXT)
320 AC_SUBST(PROFILED_LIB_EXT)
321 dnl
322 dnl handle --enable-jfs-debug
323 dnl
324 AC_ARG_ENABLE([jfs-debug],
325 [  --enable-jfs-debug     enable journal debugging],
326 if test "$enableval" = "no"
327 then
328         echo "Disabling journal debugging"
329 else
330         AC_DEFINE(CONFIG_JBD_DEBUG)
331         echo "Enabling journal debugging"
332 fi
333 ,
334 echo "Disabling journal debugging by default"
335 )
336 dnl
337 dnl handle --enable-swapfs
338 dnl
339 AC_ARG_ENABLE([swapfs],
340 [  --disable-swapfs       disable support of legacy byte-swapped filesystems],
341 if test "$enableval" = "no"
342 then
343         echo "Disabling swapfs support"
344 else
345         AC_DEFINE(ENABLE_SWAPFS)
346         echo "Enabling swapfs support"
347 fi
348 ,
349 echo "Enabling swapfs support by default"
350 AC_DEFINE(ENABLE_SWAPFS)
351 )
352 dnl
353 dnl handle --enable-debugfs
354 dnl
355 AC_ARG_ENABLE([debugfs],
356 [  --disable-debugfs      disable support of debugfs program],
357 if test "$enableval" = "no"
358 then
359         echo "Disabling debugfs support"
360         DEBUGFS_CMT="#"
361 else
362         DEBUGFS_CMT=
363         echo "Enabling debugfs support"
364 fi
365 ,
366 echo "Enabling debugfs support by default"
367 DEBUGFS_CMT=
368 )
369 AC_SUBST(DEBUGFS_CMT)
370 dnl
371 dnl handle --enable-imager
372 dnl
373 AC_ARG_ENABLE([imager],
374 [  --disable-imager       disable support of e2image program],
375 if test "$enableval" = "no"
376 then
377         echo "Disabling e2image support"
378         IMAGER_CMT="#"
379 else
380         IMAGER_CMT=
381         echo "Enabling e2image support"
382 fi
383 ,
384 echo "Enabling e2image support by default"
385 IMAGER_CMT=
386 )
387 AC_SUBST(IMAGER_CMT)
388 dnl
389 dnl handle --enable-resizer
390 dnl
391 AC_ARG_ENABLE([resizer],
392 [  --disable-resizer      disable support of e2resize program],
393 if test "$enableval" = "no"
394 then
395         echo "Disabling e2resize support"
396         RESIZER_CMT="#"
397 else
398         RESIZER_CMT=
399         echo "Enabling e2resize support"
400 fi
401 ,
402 echo "Enabling e2resize support by default"
403 RESIZER_CMT=
404 )
405 AC_SUBST(RESIZER_CMT)
406 dnl
407 dnl handle --enable-dynamic-e2fsck
408 dnl
409 AC_ARG_ENABLE([dynamic-e2fsck],
410 [  --enable-dynamic-e2fsck build e2fsck dynamically],
411 if test "$enableval" = "no"
412 then
413         E2FSCK_TYPE=static
414         echo "Building e2fsck statically"
415 else
416         E2FSCK_TYPE=shared
417         echo "Building e2fsck dynamically"
418 fi
419 ,
420 E2FSCK_TYPE=static
421 echo "Building e2fsck statically by default"
422 )
423 AC_SUBST(E2FSCK_TYPE)
424 dnl
425 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
426 dnl
427 AC_ARG_ENABLE([fsck],
428 [  --enable-fsck           build fsck wrapper program],
429 [if test "$enableval" = "no"
430 then
431         FSCK_PROG='' FSCK_MAN=''
432         echo "Not building fsck wrapper"
433 else
434         FSCK_PROG=fsck FSCK_MAN=fsck.8
435         echo "Building fsck wrapper"
436 fi]
437 ,
438 [case "$host_os" in
439   gnu*)
440     FSCK_PROG='' FSCK_MAN=''
441     echo "Not building fsck wrapper by default"
442     ;;
443   *)
444     FSCK_PROG=fsck FSCK_MAN=fsck.8
445     echo "Building fsck wrapper by default"
446 esac]
447 )
448 AC_SUBST(FSCK_PROG)
449 AC_SUBST(FSCK_MAN)
450 dnl
451 dnl
452 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
453 AC_SUBST_FILE(MAKEFILE_LIBRARY)
454 dnl
455 dnl
456 AC_ARG_ENABLE([old-bitops],
457 [  --enable-old-bitops    Use old (non-standard but native) bitmask operations],
458 if test "$enableval" = "no"
459 then
460         echo "Using new (standard) bitmask operations"
461 else
462         AC_DEFINE(EXT2_OLD_BITOPS)
463         echo "Using old (native) bitmask operations"
464
465 fi
466 ,
467 echo "Using standard bitmask operations by default"
468 )
469 dnl
470 dnl Add internationalization support, using gettext.
471 dnl
472 PACKAGE=e2fsprogs
473 VERSION="$E2FSPROGS_VERSION"
474 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
475 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
476 AC_SUBST(PACKAGE)
477 AC_SUBST(VERSION)
478
479 ALL_LINGUAS="it nyc tr"
480 AM_GNU_GETTEXT
481 dnl
482 dnl End of configuration options
483 dnl
484 AC_SUBST(BINARY_TYPE)
485 AC_PROG_MAKE_SET
486 AC_PATH_PROG(LN, ln, ln)
487 AC_PROG_LN_S
488 AC_PATH_PROG(MV, mv, mv)
489 AC_PATH_PROG(CP, cp, cp)
490 AC_PATH_PROG(RM, rm, rm)
491 AC_PATH_PROG(CHMOD, chmod, :)
492 AC_PATH_PROG(AWK, awk, awk)
493 AC_PATH_PROG(SED, sed, sed)
494 AC_PATH_PROG(PERL, perl, perl)
495 AC_PATH_PROG(LDCONFIG, ldconfig, :)
496 AC_CHECK_TOOL(AR, ar, ar)
497 AC_CHECK_TOOL(RANLIB, ranlib, :)
498 AC_CHECK_TOOL(STRIP, strip, :)
499 AC_PROG_INSTALL
500 # See if we need a separate native compiler.
501 if test $cross_compiling = no; then
502   BUILD_CC="$CC"
503   AC_SUBST(BUILD_CC)
504 else
505   AC_CHECK_PROGS(BUILD_CC, gcc cc)
506 fi
507 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)
508 AC_FUNC_VPRINTF
509 dnl
510 dnl Check to see if llseek() is declared in unistd.h.  On some libc's 
511 dnl it is, and on others it isn't..... Thank you glibc developers....
512 dnl
513 dnl Warning!  Use of --enable-gcc-wall may throw off this test.
514 dnl
515 dnl
516 AC_MSG_CHECKING(whether llseek declared in unistd.h)
517 AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
518         AC_TRY_COMPILE(
519 [#include <unistd.h>], [extern int llseek(int);],
520         [e2fsprogs_cv_have_llseek_prototype=no],
521         [e2fsprogs_cv_have_llseek_prototype=yes]))
522 AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
523 if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
524    AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
525 fi
526 dnl
527 dnl Check to see if lseek64() is declared in unistd.h.  Glibc's header files
528 dnl are so convoluted that I can't tell whether it will always be defined,
529 dnl and if it isn't defined while lseek64 is defined in the library, 
530 dnl disaster will strike.  
531 dnl
532 dnl Warning!  Use of --enable-gcc-wall may throw off this test.
533 dnl
534 dnl
535 AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
536 AC_CACHE_VAL(e2fsprogs_cv_have_lseek64_prototype,
537         AC_TRY_COMPILE(
538 [#define _LARGEFILE_SOURCE
539 #define _LARGEFILE64_SOURCE
540 #include <unistd.h>], [extern int lseek64(int);],
541         [e2fsprogs_cv_have_lseek64_prototype=no],
542         [e2fsprogs_cv_have_lseek64_prototype=yes]))
543 AC_MSG_RESULT($e2fsprogs_cv_have_lseek64_prototype)
544 if test "$e2fsprogs_cv_have_lseek64_prototype" = yes; then
545    AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)
546 fi
547 dnl
548 dnl Word sizes...
549 dnl
550 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
551   # if cross-compiling, with no cached values, just assume something common. 
552   ac_cv_sizeof_short=2
553   ac_cv_sizeof_int=4
554   ac_cv_sizeof_long=4
555   ac_cv_sizeof_long_long=8
556   AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4, long long=8])
557 fi
558 AC_CHECK_SIZEOF(short)
559 AC_CHECK_SIZEOF(int)
560 AC_CHECK_SIZEOF(long)
561 AC_CHECK_SIZEOF(long long)
562 SIZEOF_SHORT=$ac_cv_sizeof_short
563 SIZEOF_INT=$ac_cv_sizeof_int
564 SIZEOF_LONG=$ac_cv_sizeof_long
565 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
566 AC_SUBST(SIZEOF_SHORT)
567 AC_SUBST(SIZEOF_INT)
568 AC_SUBST(SIZEOF_LONG)
569 AC_SUBST(SIZEOF_LONG_LONG)
570 AC_C_BIGENDIAN
571 dnl
572 dnl See if struct stat has a st_flags field, in which case we can get file
573 dnl flags somewhat portably.  Also check for the analogous setter, chflags().
574 dnl
575 AC_MSG_CHECKING(whether struct stat has a st_flags field)
576 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
577         AC_TRY_COMPILE([#include <sys/stat.h>],
578                 [struct stat stat; stat.st_flags = 0;],
579                 [e2fsprogs_cv_struct_st_flags=yes],
580                 [e2fsprogs_cv_struct_st_flags=no]))
581 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
582 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
583   AC_MSG_CHECKING(whether st_flags field is useful)
584   AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
585         AC_TRY_COMPILE([#include <sys/stat.h>],
586                 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
587                 [e2fsprogs_cv_struct_st_flags_immut=yes],
588                 [e2fsprogs_cv_struct_st_flags_immut=no]))
589   AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
590   if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
591           AC_DEFINE(HAVE_STAT_FLAGS)
592   fi
593 fi
594 AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 getmntinfo strcasecmp srandom fchown mallinfo fdatasync strnlen sysconf pathconf)
595 dnl
596 dnl Check to see if -lsocket is required (solaris) to make something
597 dnl that uses socket() to compile; this is needed for the UUID library
598 dnl
599 SOCKET_LIB=''
600 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
601 AC_SUBST(SOCKET_LIB)
602 dnl
603 dnl See if optreset exists
604 dnl
605 AC_MSG_CHECKING(for optreset)
606 AC_CACHE_VAL(ac_cv_have_optreset,
607 [AC_EGREP_HEADER(optreset, unistd.h,
608   ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
609 AC_MSG_RESULT($ac_cv_have_optreset)
610 if test $ac_cv_have_optreset = yes; then
611   AC_DEFINE(HAVE_OPTRESET)
612 fi
613 dnl
614 dnl We use the EXT2 ioctls only under Linux
615 dnl
616 case "$host_os" in
617 linux*)
618         AC_DEFINE(HAVE_EXT2_IOCTLS)
619         ;;
620 esac
621 dnl
622 dnl Uncomment only if Linux
623 dnl
624 LINUX_CMT="#"
625 case "$host_os" in
626 linux*)
627         LINUX_CMT=
628         ;;
629 esac
630 AC_SUBST(LINUX_CMT)
631 dnl
632 dnl Linux and Hurd places root files in the / by default
633 dnl
634 case "$host_os" in
635 linux* | gnu*)
636         if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
637                 root_prefix="";
638                 echo "On $host_os systems, root_prefix defaults to ''"
639         fi
640         ;;
641 esac
642 dnl
643 dnl On Linux/hurd, force the prefix to be /usr
644 dnl
645 case "$host_os" in
646 linux* | gnu*)
647         if test "$prefix" = NONE ; then
648                 prefix="/usr";
649                 echo "On $host_os systems, prefix defaults to /usr"
650                 if test "$mandir" = '${prefix}/man' ; then
651                         echo "...and mandir defaults to /usr/share/man"
652                         mandir=/usr/share/man
653                 fi
654         fi
655 ;;
656 esac
657 if test "$root_prefix" = NONE ; then
658         if test "$prefix" = NONE ; then
659                 root_prefix="$ac_default_prefix"
660         else
661                 root_prefix="$prefix"
662         fi
663         root_bindir=$bindir
664         root_sbindir=$sbindir
665         root_libdir=$libdir
666         root_sysconfdir=$sysconfdir
667 else
668         root_bindir='${root_prefix}/bin'
669         root_sbindir='${root_prefix}/sbin'
670         root_libdir='${root_prefix}/lib'
671         root_sysconfdir='${root_prefix}/etc'
672 fi
673 AC_SUBST(root_prefix)
674 AC_SUBST(root_bindir)
675 AC_SUBST(root_sbindir)
676 AC_SUBST(root_libdir)
677 AC_SUBST(root_sysconfdir)
678 dnl
679 dnl See if -static works.
680 dnl
681 AC_MSG_CHECKING([whether linker accepts -static])
682 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
683 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
684 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
685  ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
686 LDFLAGS=$SAVE_LDFLAGS])
687 dnl
688 dnl Regardless of how the test turns out, Solaris doesn't handle -static
689 dnl This is caused by the socket library requiring the nsl library, which
690 dnl requires the -dl library, which only works for dynamically linked 
691 dnl programs.  It basically means you can't have statically linked programs
692 dnl which use the network under Solaris.  
693 dnl
694 case "$host_os" in
695 solaris2.*)
696         ac_cv_e2fsprogs_use_static=no   
697 ;;
698 esac
699 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
700 LDFLAG_STATIC=
701 if test $ac_cv_e2fsprogs_use_static = yes; then
702         LDFLAG_STATIC=-static
703 fi
704 AC_SUBST(LDFLAG_STATIC)
705 dnl
706 dnl Make the ss and et directories work correctly.
707 dnl
708 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
709 ET_DIR=`cd ${srcdir}/lib/et; pwd`
710 AC_SUBST(SS_DIR)
711 AC_SUBST(ET_DIR)
712 dnl
713 dnl Only try to run the test suite if we're not cross compiling.
714 dnl
715 if test "$cross_compiling" = yes ; then
716   DO_TEST_SUITE=
717 else
718   DO_TEST_SUITE=check
719 fi
720 AC_SUBST(DO_TEST_SUITE)
721 dnl
722 dnl Make our output files, being sure that we create the some miscellaneous 
723 dnl directories
724 dnl
725 test -d lib || mkdir lib
726 test -d include || mkdir include
727 test -d include/linux || mkdir include/linux
728 test -d include/asm || mkdir include/asm
729 rmakefile=
730 if test -d ${srcdir}/resize ; then
731    rmakefile=resize/Makefile
732 fi
733 AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile 
734         lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile
735         lib/evms/Makefile
736         misc/Makefile ext2ed/Makefile e2fsck/Makefile debugfs/Makefile \
737         tests/Makefile tests/progs/Makefile $rmakefile doc/Makefile 
738         intl/Makefile po/Makefile.in)