From a4f547cdfcac72c75d5e147fa4592652229fd0a1 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Wed, 21 Mar 2001 09:37:12 +0000 Subject: [PATCH] Configure magic for testing ext2_ino_t and s_journal_inum --- config.h.in | 6 +++ configure | 133 ++++++++++++++++++++++++++++++++++-------------- configure.in | 36 +++++++++++-- dump/itime.c | 4 +- dump/traverse.c | 9 ++-- 5 files changed, 139 insertions(+), 49 deletions(-) diff --git a/config.h.in b/config.h.in index 907e5d0..c08eced 100644 --- a/config.h.in +++ b/config.h.in @@ -45,6 +45,12 @@ /* Define if you want to include readline support. */ #undef HAVE_READLINE +/* Define if we have the ext2_ino_t type (from e2fsprogs 1.20+). */ +#undef HAVE_EXT2_INO_T + +/* Define if we have the s_journal_inum field in struct ext2_super_block. */ +#undef HAVE_EXT2_JOURNAL_INUM + /* Define this is you want old style F script (no arguments) */ #undef OLD_STYLE_FSCRIPT diff --git a/configure b/configure index e61f8d0..462ef78 100755 --- a/configure +++ b/configure @@ -1697,8 +1697,60 @@ if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then { echo "configure: error: You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs" 1>&2; exit 1; } fi +echo $ac_n "checking for ext2_ino_t type in ext2 headers""... $ac_c" 1>&6 +echo "configure:1702: checking for ext2_ino_t type in ext2 headers" >&5 +cat > conftest.$ac_ext < +#include +#include +int main() { +ext2_ino_t ino = 0; +; return 0; } +EOF +if { (eval echo configure:1713: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_EXT2_INO_T 1 +EOF +, echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking for s_journal_inum field in ext2_super_block struct""... $ac_c" 1>&6 +echo "configure:1728: checking for s_journal_inum field in ext2_super_block struct" >&5 +cat > conftest.$ac_ext < +#include +#include +int main() { +struct ext2_super_block es; es.s_journal_inum = 0; +; return 0; } +EOF +if { (eval echo configure:1739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_EXT2_JOURNAL_INUM 1 +EOF +, echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:1702: checking for tgetent in -ltermcap" >&5 +echo "configure:1754: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1706,7 +1758,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1746,17 +1798,17 @@ fi ac_safe=`echo "readline/readline.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for readline/readline.h""... $ac_c" 1>&6 -echo "configure:1750: checking for readline/readline.h" >&5 +echo "configure:1802: checking for readline/readline.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1760: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1779,7 +1831,7 @@ readline_h=no fi echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6 -echo "configure:1783: checking for readline in -lreadline" >&5 +echo "configure:1835: checking for readline in -lreadline" >&5 ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1787,7 +1839,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lreadline "-ltermcap" $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1827,17 +1879,17 @@ fi ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for zlib.h""... $ac_c" 1>&6 -echo "configure:1831: checking for zlib.h" >&5 +echo "configure:1883: checking for zlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1860,7 +1912,7 @@ zlib_h=no fi echo $ac_n "checking for compress2 in -lz""... $ac_c" 1>&6 -echo "configure:1864: checking for compress2 in -lz" >&5 +echo "configure:1916: checking for compress2 in -lz" >&5 ac_lib_var=`echo z'_'compress2 | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1868,7 +1920,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1914,12 +1966,12 @@ fi for ac_func in err errx verr verrx vwarn vwarnx warn warnx realpath lchown do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1918: checking for $ac_func" >&5 +echo "configure:1970: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1967,12 +2019,12 @@ fi done echo $ac_n "checking for glob""... $ac_c" 1>&6 -echo "configure:1971: checking for glob" >&5 +echo "configure:2023: checking for glob" >&5 if eval "test \"`echo '$''{'ac_cv_func_glob'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_glob=yes" else @@ -2015,9 +2067,11 @@ else fi +echo $ac_n "checking for extended glob routines""... $ac_c" 1>&6 +echo "configure:2072: checking for extended glob routines" >&5 if test "$ac_cv_func_glob" = "yes"; then cat > conftest.$ac_ext < @@ -2029,28 +2083,31 @@ EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then rm -rf conftest* - cat >> confdefs.h <<\EOF + + cat >> confdefs.h <<\EOF #define HAVE_GLOB 1 EOF + echo "$ac_t""yes" 1>&6 + else rm -rf conftest* - noglob=yes + + echo "$ac_t""no" 1>&6 + echo "Your system does not support extended glob, will use the internal routines" + fi rm -f conftest* - if test "$noglob" = "yes"; then - echo "Your system does not support extended glob, will use the internal routines" - fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2049: checking for ANSI C header files" >&5 +echo "configure:2106: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2058,7 +2115,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2062: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2119: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2075,7 +2132,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2093,7 +2150,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2114,7 +2171,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2125,7 +2182,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2149,12 +2206,12 @@ EOF fi echo $ac_n "checking for quad_t""... $ac_c" 1>&6 -echo "configure:2153: checking for quad_t" >&5 +echo "configure:2210: checking for quad_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_quad_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2182,12 +2239,12 @@ EOF fi echo $ac_n "checking for u_quad_t""... $ac_c" 1>&6 -echo "configure:2186: checking for u_quad_t" >&5 +echo "configure:2243: checking for u_quad_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_u_quad_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS diff --git a/configure.in b/configure.in index 768a92e..cd3b5da 100644 --- a/configure.in +++ b/configure.in @@ -273,6 +273,28 @@ if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs) fi +dnl +dnl Check for ext2_ino_t type +dnl +AC_MSG_CHECKING(for ext2_ino_t type in ext2 headers) +AC_TRY_COMPILE([#include +#include +#include ], +[ext2_ino_t ino = 0;], +[AC_DEFINE(HAVE_EXT2_INO_T), AC_MSG_RESULT(yes)], +AC_MSG_RESULT(no)) + +dnl +dnl Check for s_journal_inum field in ext2_super_block struct +dnl +AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct) +AC_TRY_COMPILE([#include +#include +#include ], +[struct ext2_super_block es; es.s_journal_inum = 0;], +[AC_DEFINE(HAVE_EXT2_JOURNAL_INUM), AC_MSG_RESULT(yes)], +AC_MSG_RESULT(no)) + dnl dnl Check for termcap libraries dnl @@ -316,6 +338,7 @@ AC_CHECK_FUNC(glob) dnl dnl Check for GLOB_ALTDIRFUNC dnl +AC_MSG_CHECKING(for extended glob routines) if test "$ac_cv_func_glob" = "yes"; then AC_EGREP_CPP(yes, [ @@ -323,10 +346,15 @@ if test "$ac_cv_func_glob" = "yes"; then # ifdef GLOB_ALTDIRFUNC yes # endif - ], AC_DEFINE(HAVE_GLOB), noglob=yes) - if test "$noglob" = "yes"; then - echo "Your system does not support extended glob, will use the internal routines" - fi + ], + [ + AC_DEFINE(HAVE_GLOB) + AC_MSG_RESULT(yes) + ], + [ + AC_MSG_RESULT(no) + echo "Your system does not support extended glob, will use the internal routines" + ]) fi dnl diff --git a/dump/itime.c b/dump/itime.c index 0a81d98..81d8dc7 100644 --- a/dump/itime.c +++ b/dump/itime.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: itime.c,v 1.17 2001/03/20 09:14:58 stelian Exp $"; + "$Id: itime.c,v 1.18 2001/03/21 09:37:13 stelian Exp $"; #endif /* not lint */ #include @@ -240,8 +240,6 @@ putdumptime(void) if (ftruncate(fd, ftell(df))) quit("ftruncate (%s): %s\n", dumpdates, strerror(errno)); (void) fclose(df); - msg("level %c dump on %s", level, - spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date)); } static void diff --git a/dump/traverse.c b/dump/traverse.c index 8e4a6b6..4bf70d5 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.28 2001/03/20 10:02:48 stelian Exp $"; + "$Id: traverse.c,v 1.29 2001/03/21 09:37:13 stelian Exp $"; #endif /* not lint */ #include @@ -102,13 +102,14 @@ static int exclude_ino __P((dump_ino_t ino)); extern dump_ino_t iexclude_list[IEXCLUDE_MAXNUM]; /* the inode exclude list */ extern int iexclude_num; /* number of elements in list */ -/* Temporary fix waiting for Andreas fixes... */ -#ifdef HAS_EXT2FS_EXT2_FS +#ifdef HAVE_EXT2_JOURNAL_INUM #define ext2_journal_ino(sb) (sb->s_journal_inum) #else -#define ext2_ino_t __u32 #define ext2_journal_ino(sb) (*((__u32 *)sb + 0x38)) #endif +#ifndef HAVE_EXT2_INO_T +#define ext2_ino_t __u32 +#endif #ifndef EXT3_FEATURE_COMPAT_HAS_JOURNAL #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 -- 2.39.2