From 3bb7d9596e9b852b2e13185386cc0b71c952e84d Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 6 Dec 2009 10:36:14 +0100 Subject: Updated autofoo stuff; swig is now optional and can be disabled. Use --without-swig to prevent building the swig extensions even if swig is installed. [#93 state:resolved] Signed-off-by: Matt Colyer --- configure.ac | 47 ++++++++++++++++++++++++++++++++++++++++++++++- m4/ac_pkg_swig.m4 | 8 ++++---- m4/ax_swig_enable_cxx.m4 | 4 +++- swig/Makefile.am | 3 +++ 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 7c59171..32a55f7 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,24 @@ AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([strcasecmp strdup strerror strndup]) +python_bindings=yes +AC_ARG_WITH([swig], + [AS_HELP_STRING([--without-swig], + [build Python bindings using swig (default is yes)])], + [build_swig=false], + [build_swig=true]) +if test "$build_swig" = "true" -a "$SWIG" != "false" ; then + SWIG_SUB=swig +else + SWIG_SUB= + python_bindings=no +fi + +AM_CONDITIONAL([HAVE_SWIG],[test "x$SWIG_SUB" = "xswig"]) + +AC_SUBST([DEV_SUB]) + + AC_ARG_ENABLE([dev-tools], [AS_HELP_STRING([--enable-dev-tools], [build development helper tools (default is no)])], @@ -57,8 +75,10 @@ if test "$build_dev_tools" = true; then [], [AC_MSG_ERROR([Please install readline development headers])] ) + building_dev_tools=yes else DEV_SUB= + building_dev_tools=no fi AM_CONDITIONAL([ENABLE_DEVTOOLS],[test "x$DEV_SUB" = "xdev"]) @@ -71,7 +91,10 @@ AC_ARG_ENABLE([debug-code], [no_debug_code=false], [no_debug_code=true]) if test "$no_debug_code" = true; then + building_debug_code=no AC_DEFINE(STRIP_DEBUG_CODE,1,[Strip debug reporting code]) +else + building_debug_code=yes fi AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") @@ -106,4 +129,26 @@ AC_SUBST(LFS_CFLAGS) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) -AC_OUTPUT(Makefile src/Makefile include/Makefile fdi/Makefile dev/Makefile tools/Makefile swig/Makefile libiphone-1.0.pc) +AC_OUTPUT([ +Makefile +src/Makefile +include/Makefile +fdi/Makefile +dev/Makefile +tools/Makefile +swig/Makefile +libiphone-1.0.pc +]) + +echo " +Configuration for $PACKAGE $VERSION: +------------------------------------------- + + Install prefix: .........: $prefix + Debug code ..............: $building_debug_code + Dev tools ...............: $building_dev_tools + Python bindings .........: $python_bindings + + Now type 'make' to build $PACKAGE $VERSION, + and then 'make install' for installation. +" diff --git a/m4/ac_pkg_swig.m4 b/m4/ac_pkg_swig.m4 index 738f69d..97244bc 100644 --- a/m4/ac_pkg_swig.m4 +++ b/m4/ac_pkg_swig.m4 @@ -64,8 +64,8 @@ AC_DEFUN([AC_PROG_SWIG],[ AC_PATH_PROG([SWIG],[swig]) if test -z "$SWIG" ; then - AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org]) - SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' + AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org] or install your distribution specific swig package.) + SWIG=false elif test -n "$1" ; then AC_MSG_CHECKING([for SWIG version]) [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] @@ -107,7 +107,7 @@ AC_DEFUN([AC_PROG_SWIG],[ -o $available_minor -ne $required_minor \ -o $available_patch -lt $required_patch ; then AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org]) - SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' + SWIG=false else AC_MSG_NOTICE([SWIG executable is '$SWIG']) SWIG_LIB=`$SWIG -swiglib` @@ -115,7 +115,7 @@ AC_DEFUN([AC_PROG_SWIG],[ fi else AC_MSG_WARN([cannot determine SWIG version]) - SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' + SWIG=false fi fi AC_SUBST([SWIG_LIB]) diff --git a/m4/ax_swig_enable_cxx.m4 b/m4/ax_swig_enable_cxx.m4 index 722caeb..c1eca8c 100644 --- a/m4/ax_swig_enable_cxx.m4 +++ b/m4/ax_swig_enable_cxx.m4 @@ -47,5 +47,7 @@ AU_ALIAS([SWIG_ENABLE_CXX], [AX_SWIG_ENABLE_CXX]) AC_DEFUN([AX_SWIG_ENABLE_CXX],[ AC_REQUIRE([AC_PROG_SWIG]) AC_REQUIRE([AC_PROG_CXX]) - SWIG="$SWIG -c++" + if test "$SWIG" != "false"; then + SWIG="$SWIG -c++" + fi ]) diff --git a/swig/Makefile.am b/swig/Makefile.am index a38534d..ef87733 100644 --- a/swig/Makefile.am +++ b/swig/Makefile.am @@ -1,5 +1,6 @@ INCLUDES = -I$(top_srcdir)/include $(libplist_CFLAGS) $(SWIG_PYTHON_CPPFLAGS) -I$(oldincludedir) +if HAVE_SWIG BUILT_SOURCES = iphone_wrap.cxx SWIG_SOURCES = iphone.i @@ -29,3 +30,5 @@ _iphone_la_LIBADD = $(top_builddir)/src/libiphone.la $(libplistmm_LIBS) iphone_wrap.cxx : $(SWIG_SOURCES) $(SWIG) $(SWIG_PYTHON_OPT) $(INCLUDES) -I$(top_srcdir)/src -o $@ $< +endif # HAVE_SWIG + -- cgit v1.1-32-gdbae