From 94ad86b3e0c342f21ee9cac435621db7191575a4 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Wed, 4 Mar 2020 21:25:20 -0500 Subject: [PATCH] check for valid swig in configure script (#1144) * check for valid swig in configure script * tweak --- configure.ac | 11 +++++++++++ python/Makefile.am | 1 - scheme/Makefile.am | 1 - 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5d2fbaabf..eb7b8c95f 100644 --- a/configure.ac +++ b/configure.ac @@ -511,10 +511,21 @@ AC_TRY_COMPILE([], [_Pragma("ivdep")], [], [AC_DEFINE([_Pragma],[],[define to no # checks for python ############################################################################## + AC_ARG_WITH(python, [AC_HELP_STRING([--without-python], [compile without Python interface])], with_python=$withval,with_python=yes) +AC_CHECK_PROG(SWIG, swig, swig, echo) +if test "$USE_MAINTAINER_MODE" = yes && (test "x$with_python" = "xyes" || test "x$with_scheme" = "xyes") && test "x$SWIG" = xecho; then + AC_MSG_ERROR([SWIG not found; configure --without-python --without-scheme or use a release tarball]) +fi +if test "$USE_MAINTAINER_MODE" = yes && test "x$with_python" = "xyes"; then + if ($SWIG -version | grep "SWIG Version 4" > /dev/null 2>&1); then + AC_MSG_ERROR([SWIG version 4 is not supported for Python; configure --without-python or use a release tarball]) + fi +fi + if test "x$with_python" = xno; then have_python=no else diff --git a/python/Makefile.am b/python/Makefile.am index 97a042bdb..c7b5fa027 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -137,7 +137,6 @@ endif ################################################## if MAINTAINER_MODE -SWIG ?= swig SWIG_VERSION = $(shell $(SWIG) -version | grep Version | awk '{print $$3}') MEEP_SWIG_SRC = meep.i numpy.i vec.i diff --git a/scheme/Makefile.am b/scheme/Makefile.am index df9b38966..79c6d3a9e 100644 --- a/scheme/Makefile.am +++ b/scheme/Makefile.am @@ -23,7 +23,6 @@ meep_wrap.o: meep_wrap.cxx $(srcdir)/meep-ctl-swig.hpp $(CTLHDRS) if WITH_LIBCTL if MAINTAINER_MODE -SWIG ?= swig meep_wrap.cxx: meep.i meep_op_renames.i meep_enum_renames.i meep_renames.i ctl-io.i meep-ctl-swig.hpp meep_swig_bug_workaround.i $(LIBHDRS) $(SWIG) -I$(top_srcdir)/src -c++ -guile -o $@ $(srcdir)/meep.i patch -p0 $@ < $(srcdir)/meep_wrap.patch