build: add --without-swig to override swig check 18/12518/5
authorMichael Meffie <mmeffie@sinenomine.net>
Fri, 10 Feb 2017 15:39:09 +0000 (10:39 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sun, 12 Feb 2017 05:14:39 +0000 (00:14 -0500)
Add the --without-swig option to disable the automatic swig detection
and disable the optional features which depend on swig.  This allows
builders to avoid swig even if present on the build system.

Also, add the --with-swig option to force the check and fail if not
detected.  This allows builders to declare the swig features are
mandatory.

The default continues to be to check for swig, and if present, build the
optional features which require swig.

To disable the automatic check for swig and disable the features which
depend on swig:

    ./configure --without-swig     # or --with-swig=no

To force the check and fail if swig is not present on the system:

    ./configure --with-swig        # or --with-swig=yes

If --with-swig is given and swig is not detected, then configure will
fail with the message:

    configure: error: swig requested but not found

The Perl 5 bindings for libuafs is the only feature which requires swig
at this time.

Change-Id: I0726658a9cc7b1b2a9d5e5d306adb6e36ad3c0f6
Reviewed-on: https://gerrit.openafs.org/12518
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/cf/swig.m4

index 7f615ad..81a8999 100644 (file)
@@ -1,11 +1,26 @@
 dnl SWIG Autoconf glue. Build with SWIG-derived language bindings if SWIG
 dnl is available; if it's not, don't build the extra language bindings.
-
+dnl
+dnl Specify --without-swig (or --with-swig=no) to override the SWIG check and
+dnl disable features which require SWIG. Specify --with-swig=yes to force the
+dnl SWIG check and fail if not detected.
+dnl
 AC_DEFUN([OPENAFS_SWIG],
-[AC_CHECK_PROG([SWIG], [swig], [swig])
+
+[AC_ARG_WITH([swig],
+  [AS_HELP_STRING([--with-swig],
+    [use swig to generate language bindings (defaults to autodetect)])],
+  [],
+  [with_swig=check])
+
 LIBUAFS_BUILD_PERL=
-if test "x$SWIG" = "xswig" ; then
-       LIBUAFS_BUILD_PERL=LIBUAFS_BUILD_PERL
-fi
+AS_IF([test "x$with_swig" != "xno"],
+  [AC_CHECK_PROG([SWIG], [swig], [swig])
+  AS_IF([test "x$SWIG" = "xswig"],
+    [LIBUAFS_BUILD_PERL=LIBUAFS_BUILD_PERL])
+  AS_IF([test "x$with_swig" = "xyes"],
+    [AS_IF([test "x$SWIG" != "xswig"],
+      [AC_MSG_ERROR([swig requested but not found])])])])
+
 AC_SUBST(LIBUAFS_BUILD_PERL)
 ])