[PATCH] configure.ac : remove enable_foo checks for non-linux OSs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, 

I implemented this idea from the TODO list, basically it sets some enable_foo 
constants for non-linux systems to "no" at start and then we can skip if-tests 
on different places. 

From the todo: 

build-sys
--------

 - we use something like

        AC_ARG_ENABLE(...., enable_foo=check)
        build_foo=yes
        if test "x$enable_foo" = xcheck; then
                if test "x$linux_os" = xno; then
                        build_foo=no
                fi
        fi
        AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_foo" = xyes)

   for Linux-only utils in configure.ac. It would be nice to set all defaults
   for all $enable_ variables at begin of the configure script according to
   $linux_os. Something like:

        if test "x$linux_os" = xno
                enable_mount=no
                enable_libmount=no
                enable_lsblk=no
        fi

   then we can remove all "if test "x$enable_foo" = xcheck;" stuff from the 
rest
   of the configure script.


Thanks, Marek

PS: The TODO list is a good thing, if you write the task more detailed (like 
this one), more people can easily implement it. 



Signed-off-by: Marek Otahal <markotahal@xxxxxxxxx>
---
diff -Nruw util-linux/configure.ac util-linux-mmm/configure.ac

--- util-linux/configure.ac     2011-02-01 00:26:23.603333351 +0100
+++ util-linux-mmm/configure.ac 2011-02-01 11:20:08.860000019 +0100
@@ -334,13 +334,52 @@
   AS_HELP_STRING([--disable-mount], [do not build mount utilities]),
   [], enable_mount=check
 )
-build_mount=yes
-if test "x$enable_mount" = xcheck; then
-  if test "x$linux_os" = xno; then
+
+AC_ARG_ENABLE([libmount],
+  AS_HELP_STRING([--disable-libmount], [do not build libmount]),
+  [], enable_libmount=check
+)
+
+C_ARG_ENABLE([switch_root],
+  AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
+  [], enable_switch_root=check
+)
+
+AC_ARG_ENABLE([pivot_root],
+  AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
+  [], enable_pivot_root=check
+)
+
+AC_ARG_ENABLE([fallocate],
+  AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
+  [], enable_fallocate=check
+)
+
+AC_ARG_ENABLE([unshare],
+  AS_HELP_STRING([--disable-unshare], [do not build unshare]),
+  [], enable_unshare=check
+)
+
+
+# we do not build these for non-linux os
+if test "x$linux_os" = xno
     AC_MSG_WARN([non-linux system; do not build mount utilities])
     build_mount=no
+  AC_MSG_WARN([non-linux system; do not build libmount])
+  build_libmount=no
+  AC_MSG_WARN([non-linux system; do not build switch_root])
+  build_switch_root=no
+  AC_MSG_WARN([non-linux system; do not build pivot_root])
+  build_pivot_root=no
+  AC_MSG_WARN([non-linux system; do not build fallocate])
+  build_fallocate=no
+  AC_MSG_WARN([non-linux system; do not build unshare])
+  build_unshare=no
   fi
-elif test "x$enable_mount" = xno; then
+
+
+build_mount=yes
+if test "x$enable_mount" = xno; then
     build_mount=no
 fi
 AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes)
@@ -459,17 +498,8 @@
 AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with 
blkid])
 
 
-AC_ARG_ENABLE([libmount],
-  AS_HELP_STRING([--disable-libmount], [do not build libmount]),
-  [], enable_libmount=check
-)
 build_libmount=yes
-if test "x$enable_libmount" = xcheck; then
-  if test "x$linux_os" = xno; then
-    AC_MSG_WARN([non-linux system; do not build libmount])
-    build_libmount=no
-  fi
-elif test "x$enable_libmount" = xno; then
+if test "x$enable_libmount" = xno; then
     build_libmount=no
 fi
 
@@ -872,19 +902,10 @@
 AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
 
 
-AC_ARG_ENABLE([switch_root],
-  AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
-  [], enable_switch_root=check
-)
+build_switch_root=yes
 if test "x$enable_switch_root" = xno; then
   build_switch_root=no
-else
-  build_switch_root=yes
-  case $enable_switch_root:$linux_os in
-  yes:no) AC_MSG_ERROR([switch_root selected for non-linux system]);;
-  check:no) AC_MSG_WARN([non-linux system; do not build switch_root])
-            build_switch_root=no;;
-  esac
+fi
   if test "x$build_switch_root" = xyes; then
     case $enable_switch_root:$have_openat in
     yes:no) AC_MSG_ERROR([switch_root selected but openat() function not 
found]);;
@@ -892,23 +913,13 @@
               build_switch_root=no;;
     esac
   fi
-fi
 AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
 
 
-AC_ARG_ENABLE([pivot_root],
-  AS_HELP_STRING([--disable-pivot_root], [do not build pivot_root]),
-  [], enable_pivot_root=check
-)
+build_pivot_root=yes
 if test "x$enable_pivot_root" = xno; then
   build_pivot_root=no
-else
-  build_pivot_root=yes
-  case $enable_pivot_root:$linux_os in
-  yes:no) AC_MSG_ERROR([pivot_root selected for non-linux system]);;
-  check:no) AC_MSG_WARN([non-linux system; do not build pivot_root])
-            build_pivot_root=no;;
-  esac
+fi
   if test "x$build_pivot_root" = xyes; then
     case $enable_pivot_root:$util_cv_syscall_pivot_root in
     yes:no) AC_MSG_ERROR([pivot_root selected but pivot_root syscall not 
found]);;
@@ -916,23 +927,13 @@
               build_pivot_root=no;;
     esac
   fi
-fi
 AM_CONDITIONAL(BUILD_PIVOT_ROOT, test "x$build_pivot_root" = xyes)
 
 
-AC_ARG_ENABLE([fallocate],
-  AS_HELP_STRING([--disable-fallocate], [do not build fallocate]),
-  [], enable_fallocate=check
-)
+build_fallocate=yes
 if test "x$enable_fallocate" = xno; then
   build_fallocate=no
-else
-  build_fallocate=yes
-  case $enable_fallocate:$linux_os in
-  yes:no) AC_MSG_ERROR([fallocate selected for non-linux system]);;
-  check:no) AC_MSG_WARN([non-linux system; do not build fallocate])
-            build_fallocate=no;;
-  esac
+fi
   if test "x$build_fallocate" = xyes; then
     case $enable_fallocate:$util_cv_syscall_fallocate in
     yes:no) AC_MSG_ERROR([fallocate selected but fallocate syscall not 
found]);;
@@ -940,23 +941,13 @@
               build_fallocate=no;;
     esac
   fi
-fi
 AM_CONDITIONAL(BUILD_FALLOCATE, test "x$build_fallocate" = xyes)
 
 
-AC_ARG_ENABLE([unshare],
-  AS_HELP_STRING([--disable-unshare], [do not build unshare]),
-  [], enable_unshare=check
-)
+build_unshare=yes
 if test "x$enable_unshare" = xno; then
   build_unshare=no
-else
-  build_unshare=yes
-  case $enable_unshare:$linux_os in
-  yes:no) AC_MSG_ERROR([unshare selected for non-linux system]);;
-  check:no) AC_MSG_WARN([non-linux system; do not build unshare])
-            build_unshare=no;;
-  esac
+fi
   if test "x$build_unshare" = xyes; then
     case $enable_unshare:$util_cv_syscall_unshare in
     yes:no) AC_MSG_ERROR([unshare selected but unshare syscall not found]);;
@@ -964,11 +955,9 @@
               build_unshare=no;;
     esac
   fi
-fi
 AM_CONDITIONAL(BUILD_UNSHARE, test "x$build_unshare" = xyes)
 
 
-
 AC_ARG_ENABLE([elvtune],
   AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 
2.4 kernels)]),
   [], enable_elvtune=no

-- 
Marek Otahal :o)

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux