From ecbcc3e020f0f128bdcbb3a0b3624c8e9e4c08dd Mon Sep 17 00:00:00 2001
From: Stefano Miccoli <mocme@icloud.com>
Date: Wed, 10 Sep 2014 08:51:15 +0200
Subject: [PATCH] enable perl5/php/python in module/ownet even if module/swig
 is disabled

---
 configure.ac             | 110 ++++++++++++++++++++++++-----------------------
 module/Makefile.am       |  31 +++++++------
 module/ownet/Makefile.am |  19 +++-----
 3 files changed, 78 insertions(+), 82 deletions(-)

diff --git a/configure.ac b/configure.ac
index eb9c9c0..0ddb41d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -508,6 +508,63 @@ AC_ARG_ENABLE(owcapi,
 AC_SUBST(ENABLE_OWCAPI)
 AM_CONDITIONAL(ENABLE_OWCAPI, test "${ENABLE_OWCAPI}" = "true")
 
+# perl 5 support
+PERL=""
+m4_include(module/swig/perl5/perl5.m4)
+AC_MSG_RESULT(Looking for location of Perl executable)
+SC_PATH_PERL5
+AC_SUBST(PERL5EXT)
+AC_SUBST(PERL5DYNAMICLINKING)
+AC_SUBST(PERL5LIB)
+AC_SUBST(PERL5DIR)
+AC_SUBST(PERL5NAME)
+AC_SUBST(PERL5CCFLAGS)
+AC_SUBST(PERL)
+if test -z "$PERL" ; then
+    ENABLE_PERL="false"
+else
+    ENABLE_PERL="true"
+fi
+AC_SUBST(ENABLE_PERL)
+AM_CONDITIONAL(ENABLE_PERL, test "${ENABLE_PERL}" = "true")
+
+# php support
+PHP=""
+m4_include(module/swig/php/php.m4)
+AC_MSG_RESULT(Looking for location of Php executable)
+SC_PATH_PHP
+AC_SUBST(PHPCONFIG)
+AC_SUBST(PHPINC)
+AC_SUBST(PHPEXT)
+AC_SUBST(PHPLIBDIR)
+AC_SUBST(PHP)
+if test -z "$PHP" ; then
+    ENABLE_PHP="false"
+else
+    ENABLE_PHP="true"
+fi
+AC_SUBST(ENABLE_PHP)
+AM_CONDITIONAL(ENABLE_PHP, test "${ENABLE_PHP}" = "true")
+
+# python support
+PYTHON=""
+m4_include(module/swig/python/python.m4)
+AC_MSG_RESULT(Looking for location of Python executable)
+SC_PATH_PYTHON
+AC_SUBST(PYCFLAGS)
+AC_SUBST(PYLDFLAGS)
+AC_SUBST(PYLIB)
+AC_SUBST(PYVERSION)
+AC_SUBST(PYSITEDIR)
+AC_SUBST(PYTHONDYNAMICLINKING)
+AC_SUBST(PYTHON)
+if test -z "$PYTHON" ; then
+    ENABLE_PYTHON="false"
+else
+    ENABLE_PYTHON="true"
+fi
+AC_SUBST(ENABLE_PYTHON)
+AM_CONDITIONAL(ENABLE_PYTHON, test "${ENABLE_PYTHON}" = "true")
 
 #Check swig
 AC_MSG_CHECKING(if swig is enabled)
@@ -575,17 +632,7 @@ AC_ARG_ENABLE(owperl,
 	fi
 ])
 
-PERL=""
 if test "${ENABLE_OWPERL}" = "true"; then
-	m4_include(module/swig/perl5/perl5.m4)
-	AC_MSG_RESULT(Looking for location of Perl executable)
-	SC_PATH_PERL5
-	AC_SUBST(PERL5EXT)
-	AC_SUBST(PERL5DYNAMICLINKING)
-	AC_SUBST(PERL5LIB)
-	AC_SUBST(PERL5DIR)
-	AC_SUBST(PERL5NAME)
-	AC_SUBST(PERL5CCFLAGS)
 	if test -z "${PERL}" ; then
 		AC_MSG_WARN([Cannot find perl binary.])
 		AC_MSG_WARN([OWPERL is disabled because perl binary is not found])
@@ -598,16 +645,8 @@ if test "${ENABLE_OWPERL}" = "true"; then
 		fi
 	fi
 fi
-AC_SUBST(PERL)
 AC_SUBST(ENABLE_OWPERL)
 AM_CONDITIONAL(ENABLE_OWPERL, test "${ENABLE_OWPERL}" = "true")
-if test -z "$PERL" ; then
-	ENABLE_PERL="false"
-else
-	ENABLE_PERL="true"
-fi
-AC_SUBST(ENABLE_PERL)
-AM_CONDITIONAL(ENABLE_PERL, test "${ENABLE_PERL}" = "true")
 
 #Check owphp
 AC_MSG_CHECKING(if owphp is enabled)
@@ -637,15 +676,7 @@ AC_ARG_ENABLE(owphp,
 	fi
 ])
 
-PHP=""
 if test "${ENABLE_OWPHP}" = "true" ; then
-	m4_include(module/swig/php/php.m4)
-	AC_MSG_RESULT(Looking for location of Php executable)
-	SC_PATH_PHP 		
-	AC_SUBST(PHPCONFIG)
-	AC_SUBST(PHPINC)
-	AC_SUBST(PHPEXT)
-	AC_SUBST(PHPLIBDIR)
 	if test -z "${PHP}" ; then
 		AC_MSG_WARN([Cannot find php binary. Install php or php5 package])
 		AC_MSG_WARN([OWPHP is disabled because php binary is not found])
@@ -668,17 +699,8 @@ if test "${ENABLE_OWPHP}" = "true" ; then
 		fi
 	fi
 fi
-AC_SUBST(PHP)
 AC_SUBST(ENABLE_OWPHP)
 AM_CONDITIONAL(ENABLE_OWPHP, test "${ENABLE_OWPHP}" = "true")
-if test -z "$PHP" ; then
-	ENABLE_PHP="false"
-else
-	ENABLE_PHP="true"
-fi
-AC_SUBST(ENABLE_PHP)
-AM_CONDITIONAL(ENABLE_PHP, test "${ENABLE_PHP}" = "true")
-
 
 #Check owpython
 AC_MSG_CHECKING(if owpython is enabled)
@@ -708,17 +730,7 @@ AC_ARG_ENABLE(owpython,
 	fi
 ])
 
-PYTHON=""
 if test "${ENABLE_OWPYTHON}" = "true" ; then
-	m4_include(module/swig/python/python.m4)
-	AC_MSG_RESULT(Looking for location of Python executable)
-	SC_PATH_PYTHON
-	AC_SUBST(PYCFLAGS)
-	AC_SUBST(PYLDFLAGS)
-	AC_SUBST(PYLIB)
-	AC_SUBST(PYVERSION)
-	AC_SUBST(PYSITEDIR)
-	AC_SUBST(PYTHONDYNAMICLINKING)
 	if test -z "${PYTHON}" ; then
 		AC_MSG_WARN([Cannot find python binary. Install python package.])
 		AC_MSG_WARN([OWPYTHON is disabled because python binary is not found])
@@ -739,14 +751,6 @@ if test "${ENABLE_OWPYTHON}" = "true" ; then
 fi
 AC_SUBST(ENABLE_OWPYTHON)
 AM_CONDITIONAL(ENABLE_OWPYTHON, test "${ENABLE_OWPYTHON}" = "true")
-AC_SUBST(PYTHON)
-if test -z "$PYTHON" ; then
-	ENABLE_PYTHON="false"
-else
-	ENABLE_PYTHON="true"
-fi
-AC_SUBST(ENABLE_PYTHON)
-AM_CONDITIONAL(ENABLE_PYTHON, test "${ENABLE_PYTHON}" = "true")
 
 #Check owtcl
 AC_MSG_CHECKING(if owtcl is enabled)
diff --git a/module/Makefile.am b/module/Makefile.am
index 1ce0730..1118bf3 100644
--- a/module/Makefile.am
+++ b/module/Makefile.am
@@ -1,54 +1,53 @@
+SUBDIRS =
+
 if ENABLE_OWSHELL
-  MODULE_SUBDIR_OWSHELL = owshell
+ SUBDIRS += owshell
 endif
 
 if ENABLE_OWLIB
-  MODULE_SUBDIR_OWLIB = owlib
+  SUBDIRS += owlib
 endif
 
 if ENABLE_OWHTTPD
-  MODULE_SUBDIR_OWHTTPD = owhttpd
+  SUBDIRS += owhttpd
 endif
 
 if ENABLE_OWSERVER
-  MODULE_SUBDIR_OWSERVER = owserver
+  SUBDIRS += owserver
 endif
 
 if ENABLE_OWEXTERNAL
-  MODULE_SUBDIR_OWSERVER = owserver
+  SUBDIRS += owserver
 endif
 
 if ENABLE_OWFS
-  MODULE_SUBDIR_OWFS = owfs
+  SUBDIRS += owfs
 endif
 
 if ENABLE_OWFTPD
-  MODULE_SUBDIR_OWFTPD = owftpd
+  SUBDIRS += owftpd
 endif
 
 if ENABLE_OWCAPI
-  MODULE_SUBDIR_OWCAPI = owcapi
+  SUBDIRS += owcapi
 endif
   
 if ENABLE_OWNET
-  MODULE_SUBDIR_OWNET = ownet
+  SUBDIRS += ownet
 endif
 
 if ENABLE_OWTAP
-  MODULE_SUBDIR_OWTAP = owtap
+  SUBDIRS += owtap
 endif
   
 if ENABLE_OWMON
-  MODULE_SUBDIR_OWMON = owmon
+  SUBDIRS += owmon
 endif
   
 if ENABLE_SWIG
-  MODULE_SUBDIR_SWIG = swig
+  SUBDIRS += swig
 endif
 
 if ENABLE_OWTCL
-  MODULE_SUBDIR_OWTCL = owtcl
+  SUBDIRS += owtcl
 endif
-	
-SUBDIRS = $(MODULE_SUBDIR_OWSHELL) $(MODULE_SUBDIR_OWNET) $(MODULE_SUBDIR_OWLIB) $(MODULE_SUBDIR_OWHTTPD) $(MODULE_SUBDIR_OWSERVER) $(MODULE_SUBDIR_OWFS) $(MODULE_SUBDIR_OWFTPD) $(MODULE_SUBDIR_OWCAPI) $(MODULE_SUBDIR_OWTAP) $(MODULE_SUBDIR_OWMON) $(MODULE_SUBDIR_SWIG) $(MODULE_SUBDIR_OWTCL)
-
diff --git a/module/ownet/Makefile.am b/module/ownet/Makefile.am
index 1fbe62e..75e5b28 100644
--- a/module/ownet/Makefile.am
+++ b/module/ownet/Makefile.am
@@ -1,24 +1,17 @@
-if ENABLE_OWPHP
+SUBDIRS =
+
 if ENABLE_PHP
-  OWNET_SUBDIRPHP = php
-endif
+  SUBDIRS += php
 endif
 
-if ENABLE_OWPYTHON
 if ENABLE_PYTHON
-  OWNET_SUBDIRPYTHON = python
-endif
+  SUBDIRS += python
 endif
 
-if ENABLE_OWPERL
 if ENABLE_PERL
-  OWNET_SUBDIRPERL = perl5
-endif
+  SUBDIRS += perl5
 endif
 
 if ENABLE_OWNETLIB
-  OWNET_SUBDIROWNETLIB = c
+  SUBDIRS += c
 endif
-
-SUBDIRS = $(OWNET_SUBDIROWNETLIB) $(OWNET_SUBDIRPHP) $(OWNET_SUBDIRPYTHON) $(OWNET_SUBDIRPERL)
-
-- 
1.8.5.2 (Apple Git-48)

