From b34258064dd36e6b22b0ea8bf3ad4365cc078057 Mon Sep 17 00:00:00 2001 From: Stepan Kasal Date: Tue, 15 May 2007 20:46:20 +0200 Subject: [PATCH] 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 --- configure.ac | 23 +++++++++++++++++++++++ mount/Makefile.am | 10 +--------- mount/swap.configure | 36 ------------------------------------ mount/swapon.c | 6 +++++- 4 files changed, 29 insertions(+), 46 deletions(-) delete mode 100644 mount/swap.configure diff --git a/configure.ac b/configure.ac index 62d293cc..a457cc13 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 +#endif +]) + +AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[ +#ifdef HAVE_ASM_PAGE_H +# include +#endif +#ifdef HAVE_SYS_SWAP_H +# include +#endif +#include +]], +[[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 18a5c60e..96ecc323 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 42a8b1c0..00000000 --- a/mount/swap.configure +++ /dev/null @@ -1,36 +0,0 @@ -# Find out whether we can include -# 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 " - if [ -f /usr/include/asm/page.h ]; then - PAGEH="#include " - fi -fi -echo $PAGEH > conftest.c -echo $SWAPH >> conftest.c -echo '#include -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 7337e32c..a6e6b509 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -13,7 +13,6 @@ #include #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 +# include +#endif + #define SWAPON_NEEDS_TWO_ARGS #define QUIET 1 -- 2.39.5