]> err.no Git - util-linux/commitdiff
build-sys: remove swapargs.h, move the tests to main configure.ac
authorStepan Kasal <skasal@redhat.com>
Tue, 15 May 2007 18:46:20 +0000 (20:46 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 May 2007 09:43:30 +0000 (11:43 +0200)
Do not use header swapargs.h, generated by script swap.configure;
use the standard AC_DEFINE method in configure.ac.

Signed-off-by: Stepan Kasal <skasal@redhat.com>
configure.ac
mount/Makefile.am
mount/swap.configure [deleted file]
mount/swapon.c

index 62d293ccbe6a0f36775ffa55ade48713cc1f0490..a457cc130de04a559b34a565bb3da3353fa1b58a 100644 (file)
@@ -162,6 +162,29 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 ])
 
 
+AC_CHECK_HEADERS([asm/page.h sys/swap.h], [], [], [
+#ifdef HAVE_ASM_PAGE_H
+# include <asm/page.h>
+#endif
+])
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[
+#ifdef HAVE_ASM_PAGE_H
+# include <asm/page.h>
+#endif
+#ifdef HAVE_SYS_SWAP_H
+# include <sys/swap.h>
+#endif
+#include <unistd.h>
+]],
+[[swapon("/dev/null", 0);]])],
+[AC_DEFINE(SWAPON_HAS_TWO_ARGS, 1, [Is swapon() declared with two parameters?])
+],
+[AC_MSG_NOTICE([Your libc thinks that swapon has 1 arg only.])
+])
+
+
 case "$host" in
   i?86-*)  intel=true ;;
   m68*)    m68k=true ;;
index 18a5c60ee1c374c359aa72de4f96e8fcabf29a5a..96ecc3238ddab82171be5eba045f6d631b5d2a94 100644 (file)
@@ -1,6 +1,6 @@
 include $(top_srcdir)/config/include-Makefile.am
 
-EXTRA_DIST = README.mount swap.configure
+EXTRA_DIST = README.mount
 
 bin_PROGRAMS = mount umount
 sbin_PROGRAMS = losetup swapon
@@ -54,14 +54,6 @@ noinst_PROGRAMS = mtab_lock_test
 mtab_lock_test_SOURCES = fstab.c sundries.c xmalloc.c $(MNTHDRS)
 mtab_lock_test_CPPFLAGS = -DMAIN_TEST_MTABLOCK $(AM_CPPFLAGS)
 
-swapon.c: swapargs.h
-
-swapargs.h:
-       sh swap.configure
-
-clean-local:
-       rm -f swapargs.h
-
 install-exec-hook:
        chmod 4755 $(DESTDIR)$(bindir)/mount
        chmod 4755 $(DESTDIR)$(bindir)/umount
diff --git a/mount/swap.configure b/mount/swap.configure
deleted file mode 100644 (file)
index 42a8b1c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Find out whether we can include <sys/swap.h>
-# and whether libc thinks that swapon() has two arguments.
-
-# Prepare test
-CC=${CC-cc}
-compile="$CC -o conftest conftest.c >/dev/null 2>&1"
-rm -f conftest conftest.c swapargs.h
-
-# What include files shall we try?
-# Unfortunately, recent versions of swap.h use PAGE_SIZE and hence need page.h
-# It is used only in mkswap, not in swapon/swapoff, so we might just pick any
-# random value (like #define PAGE_SIZE 4096) instead of including page.h.
-SWAPH=
-PAGEH=
-if [ -f /usr/include/sys/swap.h ]; then
-       SWAPH="#include <sys/swap.h>"
-       if [ -f /usr/include/asm/page.h ]; then
-               PAGEH="#include <asm/page.h>"
-       fi
-fi
-echo $PAGEH > conftest.c
-echo $SWAPH >> conftest.c
-echo '#include <unistd.h>
-main(){ exit(0); swapon("/dev/null", 0); }' >> conftest.c
-eval $compile
-if test -s conftest; then
-       echo "#define SWAPON_HAS_TWO_ARGS" > swapargs.h
-       echo $PAGEH >> swapargs.h
-       echo $SWAPH >> swapargs.h
-else
-       echo > swapargs.h
-       echo "
-Your libc thinks that swapon has 1 arg only.
-" 1>&2
-fi
-rm -f conftest conftest.c
index 7337e32cbac6cd31d5fd77d2cd434009abfc713b..a6e6b509be67b4645b3108e3c6a4f96bb6ff74ed 100644 (file)
@@ -13,7 +13,6 @@
 #include <sys/stat.h>
 #include "xmalloc.h"
 #include "swap_constants.h"
-#include "swapargs.h"
 #include "nls.h"
 #include "mount_blkid.h"
 #include "mount_by_label.h"
 #define        _PATH_FSTAB     "/etc/fstab"
 #define PROC_SWAPS      "/proc/swaps"
 
+#ifdef SWAPON_HAS_TWO_ARGS
+# include <asm/page.h>
+# include <sys/swap.h>
+#endif
+
 #define SWAPON_NEEDS_TWO_ARGS
 
 #define QUIET  1