]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
autoconf: refactor ostype.m4
authorMichael Meffie <mmeffie@sinenomine.net>
Sat, 30 Dec 2017 17:12:59 +0000 (12:12 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 9 Feb 2018 13:33:16 +0000 (08:33 -0500)
Further refactoring of the autoconf macros. Move more linux and solaris
specific checks into their own files.

This is a non-functional change. Care has been taken preserve the
ordering of the autoconf tests. Except for whitespace, the generated
configure file has not been changed by this refactoring.  This has been
verified with a 'diff -u -w -B' comparison of the generated configure
file before and after applying this commit.

Reviewed-on: https://gerrit.openafs.org/12843
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 3c2e39bab7d927aa5f20d02a5e327927a4b2b553)

Change-Id: I4d91753afd90e4735ab61413e757f6852750a3de
Reviewed-on: https://gerrit.openafs.org/12877
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/cf/linux-guess-version.m4 [new file with mode: 0644]
src/cf/linux-kernel-path.m4 [new file with mode: 0644]
src/cf/ostype.m4
src/cf/solaris-ostype.m4 [new file with mode: 0644]

diff --git a/src/cf/linux-guess-version.m4 b/src/cf/linux-guess-version.m4
new file mode 100644 (file)
index 0000000..365051a
--- /dev/null
@@ -0,0 +1,14 @@
+AC_DEFUN([OPENAFS_LINUX_GUESS_VERSION],[
+GUESS_LINUX_VERSION=
+if test "x$enable_kernel_module" = "xyes"; then
+    GUESS_LINUX_VERSION=${LINUX_VERSION}
+else
+    GUESS_LINUX_VERSION=`uname -r`
+fi
+case "$GUESS_LINUX_VERSION" in
+    2.2.*) AFS_SYSKVERS=22 ;;
+    2.4.*) AFS_SYSKVERS=24 ;;
+    [2.6.* | [3-9]* | [1-2][0-9]*]) AFS_SYSKVERS=26 ;;
+    *) AC_MSG_ERROR(Couldn't guess your Linux version [2]) ;;
+esac
+])
diff --git a/src/cf/linux-kernel-path.m4 b/src/cf/linux-kernel-path.m4
new file mode 100644 (file)
index 0000000..ac43a85
--- /dev/null
@@ -0,0 +1,70 @@
+AC_DEFUN([OPENAFS_LINUX_KERNEL_PATH],[
+if test "x$with_linux_kernel_headers" != "x"; then
+  LINUX_KERNEL_PATH="$with_linux_kernel_headers"
+else
+  for utsdir in "/lib/modules/`uname -r`/build" \
+                "/lib/modules/`uname -r`/source" \
+                "/usr/src/linux-2.4" \
+                "/usr/src/linux"; do
+    LINUX_KERNEL_PATH="$utsdir"
+    for utsfile in "include/generated/utsrelease.h" \
+                   "include/linux/utsrelease.h" \
+                   "include/linux/version.h" \
+                   "include/linux/version-up.h"; do
+      if grep "UTS_RELEASE" "$utsdir/$utsfile" >/dev/null 2>&1; then
+        break 2
+      fi
+    done
+  done
+fi
+if test "x$with_linux_kernel_build" != "x"; then
+  LINUX_KERNEL_BUILD="$with_linux_kernel_build"
+else
+  LINUX_KERNEL_BUILD=$LINUX_KERNEL_PATH
+fi
+if test -f "$LINUX_KERNEL_BUILD/include/generated/utsrelease.h"; then
+  linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/generated/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
+  LINUX_VERSION="$linux_kvers"
+else
+  if test -f "$LINUX_KERNEL_BUILD/include/linux/utsrelease.h"; then
+    linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
+    LINUX_VERSION="$linux_kvers"
+  else
+    if test -f "$LINUX_KERNEL_BUILD/include/linux/version.h"; then
+      linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
+      if test "x$linux_kvers" = "x"; then
+        if test -f "$LINUX_KERNEL_BUILD/include/linux/version-up.h"; then
+          linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
+          if test "x$linux_kvers" = "x"; then
+            AC_MSG_ERROR(Linux headers lack version definition [2])
+            exit 1
+          else
+            LINUX_VERSION="$linux_kvers"
+          fi
+        else
+          AC_MSG_ERROR(Linux headers lack version definition)
+          exit 1
+        fi
+      else
+        LINUX_VERSION="$linux_kvers"
+      fi
+    else
+      enable_kernel_module="no"
+    fi
+  fi
+fi
+if test ! -f "$LINUX_KERNEL_BUILD/include/generated/autoconf.h" &&
+   test ! -f "$LINUX_KERNEL_BUILD/include/linux/autoconf.h"; then
+    enable_kernel_module="no"
+fi
+if test "x$enable_kernel_module" = "xno"; then
+ if test "x$with_linux_kernel_headers" != "x"; then
+  AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
+  exit 1
+ else
+  AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
+ fi
+fi
+dnl do we need to determine SUBARCH from autoconf.h
+SUBARCH=default
+])
index f65d26d4c10f663023afe6f6b30f4495a731b830..ae4da4633c59227f6d8ac511dcf5b021e52425e4 100644 (file)
@@ -3,105 +3,20 @@ AC_MSG_CHECKING(your OS)
 system=$host
 case $system in
         *-linux*)
-
                 MKAFS_OSTYPE=LINUX
                 if test "x$enable_redhat_buildsys" = "xyes"; then
-                 AC_DEFINE(ENABLE_REDHAT_BUILDSYS, 1, [define if you have redhat buildsystem])
+                    AC_DEFINE(ENABLE_REDHAT_BUILDSYS, 1, [define if you have redhat buildsystem])
                 fi
                 if test "x$enable_kernel_module" = "xyes"; then
-                 if test "x$with_linux_kernel_headers" != "x"; then
-                   LINUX_KERNEL_PATH="$with_linux_kernel_headers"
-                 else
-                   for utsdir in "/lib/modules/`uname -r`/build" \
-                                 "/lib/modules/`uname -r`/source" \
-                                 "/usr/src/linux-2.4" \
-                                 "/usr/src/linux"; do
-                     LINUX_KERNEL_PATH="$utsdir"
-                     for utsfile in "include/generated/utsrelease.h" \
-                                    "include/linux/utsrelease.h" \
-                                    "include/linux/version.h" \
-                                    "include/linux/version-up.h"; do
-                       if grep "UTS_RELEASE" "$utsdir/$utsfile" >/dev/null 2>&1; then
-                         break 2
-                       fi
-                     done
-                   done
-                 fi
-                 if test "x$with_linux_kernel_build" != "x"; then
-                         LINUX_KERNEL_BUILD="$with_linux_kernel_build"
-                 else
-                   LINUX_KERNEL_BUILD=$LINUX_KERNEL_PATH
-                 fi
-                 if test -f "$LINUX_KERNEL_BUILD/include/generated/utsrelease.h"; then
-                   linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/generated/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
-                   LINUX_VERSION="$linux_kvers"
-                 else
-                   if test -f "$LINUX_KERNEL_BUILD/include/linux/utsrelease.h"; then
-                     linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
-                     LINUX_VERSION="$linux_kvers"
-                   else
-                     if test -f "$LINUX_KERNEL_BUILD/include/linux/version.h"; then
-                       linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
-                       if test "x$linux_kvers" = "x"; then
-                         if test -f "$LINUX_KERNEL_BUILD/include/linux/version-up.h"; then
-                           linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
-                           if test "x$linux_kvers" = "x"; then
-                             AC_MSG_ERROR(Linux headers lack version definition [2])
-                             exit 1
-                           else
-                             LINUX_VERSION="$linux_kvers"
-                           fi
-                         else
-                           AC_MSG_ERROR(Linux headers lack version definition)
-                           exit 1
-                         fi
-                       else
-                         LINUX_VERSION="$linux_kvers"
-                       fi
-                     else
-                       enable_kernel_module="no"
-                     fi
-                   fi
-                 fi
-                 if test ! -f "$LINUX_KERNEL_BUILD/include/generated/autoconf.h" &&
-                    test ! -f "$LINUX_KERNEL_BUILD/include/linux/autoconf.h"; then
-                     enable_kernel_module="no"
-                 fi
-                 if test "x$enable_kernel_module" = "xno"; then
-                  if test "x$with_linux_kernel_headers" != "x"; then
-                   AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
-                   exit 1
-                  else
-                   AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
-                  fi
-                 fi
-                 dnl do we need to determine SUBARCH from autoconf.h
-                 SUBARCH=default
+                    OPENAFS_LINUX_KERNEL_PATH
                 fi
                 AC_MSG_RESULT(linux)
-                GUESS_LINUX_VERSION=
-                if test "x$enable_kernel_module" = "xyes"; then
-                 GUESS_LINUX_VERSION=${LINUX_VERSION}
-                else
-                 GUESS_LINUX_VERSION=`uname -r`
-                fi
-                case "$GUESS_LINUX_VERSION" in
-                  2.2.*) AFS_SYSKVERS=22 ;;
-                  2.4.*) AFS_SYSKVERS=24 ;;
-                  [2.6.* | [3-9]* | [1-2][0-9]*]) AFS_SYSKVERS=26 ;;
-                  *) AC_MSG_ERROR(Couldn't guess your Linux version [2]) ;;
-                esac
+                OPENAFS_LINUX_GUESS_VERSION
                 ;;
         *-solaris*)
                 MKAFS_OSTYPE=SOLARIS
                 AC_MSG_RESULT(sun4)
-                SOLARIS_PATH_CC
-                SOLARIS_CC_TAKES_XVECTOR_NONE
-                AC_SUBST(SOLARIS_CC_KOPTS)
-                SOLARIS_UFSVFS_HAS_DQRWLOCK
-                SOLARIS_FS_HAS_FS_ROLLED
-                SOLARIS_SOLOOKUP_TAKES_SOCKPARAMS
-                SOLARIS_HAVE_VN_RENAMEPATH
+                OPENAFS_SOLARIS_OSTYPE
                 ;;
         *-sunos*)
                 MKAFS_OSTYPE=SUNOS
diff --git a/src/cf/solaris-ostype.m4 b/src/cf/solaris-ostype.m4
new file mode 100644 (file)
index 0000000..2fdfc6b
--- /dev/null
@@ -0,0 +1,9 @@
+AC_DEFUN([OPENAFS_SOLARIS_OSTYPE],[
+SOLARIS_PATH_CC
+SOLARIS_CC_TAKES_XVECTOR_NONE
+AC_SUBST(SOLARIS_CC_KOPTS)
+SOLARIS_UFSVFS_HAS_DQRWLOCK
+SOLARIS_FS_HAS_FS_ROLLED
+SOLARIS_SOLOOKUP_TAKES_SOCKPARAMS
+SOLARIS_HAVE_VN_RENAMEPATH
+])