]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - mount/swap.configure
Imported from util-linux-2.9i tarball.
[thirdparty/util-linux.git] / mount / swap.configure
index a557e18713cbcfddcbd2d56b3674380d8b0ac0bd..ebd67ced669223c210b5c2576364d678dea9005d 100644 (file)
@@ -1,24 +1,36 @@
 # Find out whether we can include <sys/swap.h>
 # and whether libc thinks that swapon() has two arguments.
-# Of course this will fail if <sys/swap.h> exists but belongs
-# to a libc that is not in use at present.
+
+# 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=
-if [ -f /usr/include/sys/swap.h ]; then SWAPH="#include <sys/swap.h>"; fi
-echo $SWAPH > conftest.c
+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 && ./conftest 2>/dev/null; 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.
-Define SWAPON_NEEDS_TWO_ARGS in swapon.c if you want to use priorities.
 " 1>&2
 fi
 rm -f conftest conftest.c