summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5cc9bd7)
raw | patch | inline | side by side (parent: 5cc9bd7)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 1 Nov 2006 15:12:14 +0000 (16:12 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 1 Nov 2006 15:12:14 +0000 (16:12 +0100) |
The check provided by `autoconf' has been completely removed, since it doesn't
provide the information we need and it's internals seem to change more often
than is practical.
provide the information we need and it's internals seem to change more often
than is practical.
configure.in | patch | blob | history | |
src/utils_mount.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index b0177dde938dfcd03eb62677a550a543296193e1..bae54892bc611f6d2253f7b68d67d41654bcd71d 100644 (file)
--- a/configure.in
+++ b/configure.in
AC_CHECK_FUNCS(getifaddrs)
# For mount interface
-AC_CHECK_FUNCS(getfsent getvfsent listmntent)
-AC_CHECK_FUNCS(getfsstat getvfsstat)
+#AC_CHECK_FUNCS(getfsent getvfsent)
-# Check for different versions of `getmntent' here..
-AC_FUNC_GETMNTENT
-if test "x$ac_cv_lib_sun_getmntent" = "xyes"
-then
- AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
- [Define if the function getmntent exists. It's the version from libsun.])
+have_getfsstat="no"
+AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
+have_getvfsstat="no"
+AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
+have_listmntent="no"
+AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
+
+have_getmntent="no"
+AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
+if test "x$have_getmntent" = "xno"; then
+ AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
fi
-if test "x$ac_cv_lib_seq_getmntent" = "xyes"
-then
- AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
- [Define if the function getmntent exists. It's the version from libseq.])
+if test "x$have_getmntent" = "xno"; then
+ AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
fi
-if test "x$ac_cv_lib_gen_getmntent" = "xyes"
-then
- AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
- [Define if the function getmntent exists. It's the version from libgen.])
+if test "x$have_getmntent" = "xno"; then
+ AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
fi
-if test "x$ac_cv_func_getmntent" = "xyes"; then
- saveCFLAGS="$CFLAGS"
- CFLAGS="-Wall -Werror $CFLAGS"
+if test "x$have_getmntent" = "xc"; then
AC_CACHE_CHECK([whether getmntent takes one argument],
- [fu_cv_getmntent1],
+ [have_one_getmntent],
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
+#include <mntent.h>
#include "$srcdir/src/utils_mount.h"]],
- [[(void)getmntent((FILE *)NULL);]]
+ [[
+ FILE *fh;
+ struct mntent *me;
+ fh = setmntent ("/etc/mtab", "r");
+ me = getmntent (fh);
+ ]]
),
- [fu_cv_getmntent1=yes],
- [fu_cv_getmntent1=no]
+ [have_one_getmntent="yes"],
+ [have_one_getmntent="no"]
)
)
- if test "x$fu_cv_getmntent1" = "xno"; then
- AC_CACHE_CHECK([whether getmntent takes two arguments],
- [fu_cv_getmntent2],
- AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
+ AC_CACHE_CHECK([whether getmntent takes two arguments],
+ [have_two_getmntent],
+ AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
+#include <sys/mnttab.h>
#include "$srcdir/src/utils_mount.h"]],
- [[(void)getmntent((FILE *)NULL,
- (struct mnttab *)NULL);]]
- ),
- [fu_cv_getmntent2=yes],
- [fu_cv_getmntent2=no]
- )
+ [[
+ FILE *fh;
+ struct mnttab mt;
+ int status;
+ fh = fopen ("/etc/mnttab", "r");
+ status = getmntent (fh, &mt);
+ ]]
+ ),
+ [have_two_getmntent="yes"],
+ [have_two_getmntent="no"]
)
+ )
+fi
+
+# Check for different versions of `getmntent' here..
+
+if test "x$have_getmntent" = "xc"; then
+ if test "x$have_one_getmntent" = "xyes"; then
+ AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
+ [Define if the function getmntent exists and takes one argument.])
+ fi
+ if test "x$have_two_getmntent" = "xyes"; then
+ AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
+ [Define if the function getmntent exists and takes two arguments.])
fi
- CFLAGS="$saveCFLAGS"
-fi
-if test "x$fu_cv_getmntent1" = "xyes"; then
- AC_DEFINE(HAVE_GETMNTENT1,
- 1,
- [Define if there is a function named getmntent
- for reading the list of mounted filesystems, and
- that function takes a single argument. (4.3BSD,
- SunOS, HP-UX, Dynix, Irix, Linux)]
- )
fi
-if test "x$fu_cv_getmntent2" = "xyes"; then
- AC_DEFINE(HAVE_GETMNTENT2,
- 1,
- [Define if there is a function named getmntent
- for reading the list of mounted filesystems, and
- that function takes two arguments. (SVR4)]
- )
+if test "x$have_getmntent" = "xsun"; then
+ AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
+ [Define if the function getmntent exists. It's the version from libsun.])
+fi
+if test "x$have_getmntent" = "xseq"; then
+ AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
+ [Define if the function getmntent exists. It's the version from libseq.])
+fi
+if test "x$have_getmntent" = "xgen"; then
+ AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
+ [Define if the function getmntent exists. It's the version from libgen.])
fi
# Check for structures
diff --git a/src/utils_mount.c b/src/utils_mount.c
index 38ec24f09daed58cfbd0de7069dd18855f20d93b..a02e5690d8a65a7dd4c71d44530a8766fdc43580 100644 (file)
--- a/src/utils_mount.c
+++ b/src/utils_mount.c
/* #endif HAVE_GETVFSSTAT || HAVE_GETFSSTAT */
/* Solaris (SunOS 10): int getmntent(FILE *fp, struct mnttab *mp); */
-#elif HAVE_GEN_GETMNTENT
+#elif HAVE_TWO_GETMNTENT || HAVE_GEN_GETMNTENT || HAVE_SUN_GETMNTENT
static cu_mount_t *cu_mount_gen_getmntent (void)
{
struct mnttab mt;
return (first);
} /* static cu_mount_t *cu_mount_gen_getmntent (void) */
-/* #endif HAVE_GEN_GETMNTENT */
+/* #endif HAVE_TWO_GETMNTENT || HAVE_GEN_GETMNTENT || HAVE_SUN_GETMNTENT */
#elif HAVE_SEQ_GETMNTENT
#warn "This version of `getmntent' hat not yet been implemented!"
/* #endif HAVE_SEQ_GETMNTENT */
-#elif HAVE_SUN_GETMNTENT
-#warn "This version of `getmntent' hat not yet been implemented!"
-/* #endif HAVE_SUN_GETMNTENT */
-
-#elif HAVE_GETMNTENT
+#elif HAVE_ONE_GETMNTENT
static cu_mount_t *cu_mount_getmntent (void)
{
FILE *fp;
return (first);
}
-#endif /* HAVE_GETMNTENT */
+#endif /* HAVE_ONE_GETMNTENT */
/* *** *** *** ******************************************** *** *** *** */
/* *** *** *** *** *** *** public functions *** *** *** *** *** *** */
new = cu_mount_getfsstat ();
#elif HAVE_GEN_GETMNTENT
new = cu_mount_gen_getmntent ();
-#elif HAVE_GETMNTENT
+#elif HAVE_ONE_GETMNTENT
new = cu_mount_getmntent ();
#else
new = NULL;