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>
This commit is contained in:
Stepan Kasal 2007-05-15 20:46:20 +02:00 committed by Karel Zak
parent cf002530f8
commit b34258064d
4 changed files with 29 additions and 46 deletions

View 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 ;;

View 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

View File

@ -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

View 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"
@ -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