summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStepan Kasal2007-05-15 20:46:20 +0200
committerKarel Zak2007-05-16 11:43:30 +0200
commitb34258064dd36e6b22b0ea8bf3ad4365cc078057 (patch)
treed1e77c57c8dd197510dba8fd64ddd1b7522615ad
parentbuild-sys: replace AC_TRY_* by AC_*_IFELSE (diff)
downloadkernel-qcow2-util-linux-b34258064dd36e6b22b0ea8bf3ad4365cc078057.tar.gz
kernel-qcow2-util-linux-b34258064dd36e6b22b0ea8bf3ad4365cc078057.tar.xz
kernel-qcow2-util-linux-b34258064dd36e6b22b0ea8bf3ad4365cc078057.zip
build-sys: remove swapargs.h, move the tests to main configure.ac
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>
-rw-r--r--configure.ac23
-rw-r--r--mount/Makefile.am10
-rw-r--r--mount/swap.configure36
-rw-r--r--mount/swapon.c6
4 files changed, 29 insertions, 46 deletions
diff --git a/configure.ac b/configure.ac
index 62d293ccb..a457cc130 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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 ;;
diff --git a/mount/Makefile.am b/mount/Makefile.am
index 18a5c60ee..96ecc3238 100644
--- a/mount/Makefile.am
+++ b/mount/Makefile.am
@@ -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
index 42a8b1c0b..000000000
--- a/mount/swap.configure
+++ /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
diff --git a/mount/swapon.c b/mount/swapon.c
index 7337e32cb..a6e6b509b 100644
--- a/mount/swapon.c
+++ b/mount/swapon.c
@@ -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"
@@ -24,6 +23,11 @@
#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