1AC_DEFUN([RNA_ENABLE_SWIG_INTERFACES],[ 2 3 AC_ARG_VAR([SWIG], [Path to the 'swig' program to generate scripting language interfaces]) 4 5 AX_REQUIRE_DEFINED([AX_PKG_SWIG]) 6 7 RNA_ADD_PACKAGE([swig], 8 [SWIG scripting language interfaces], 9 [yes],[],[], 10 [${srcdir}/interfaces/Makefile.am]) 11 12 AS_IF([test "x$with_swig" != "xno"],[ 13 wants_swig="yes" 14 AX_PKG_SWIG(4.0.2, [has_swig="yes"], [has_swig="no"]) 15 ],[ 16 wants_swig="no" 17 ]) 18 19 AM_CONDITIONAL(HAS_SWIG, test "x$has_swig" != "xno") 20 RNA_ENABLE_SWIG_PERL 21 RNA_ENABLE_SWIG_PYTHON 22 RNA_ENABLE_SWIG_PYTHON3 23 24]) 25 26 27AC_DEFUN([RNA_ENABLE_SWIG_PERL],[ 28 29 RNA_ADD_PACKAGE([perl], 30 [Perl interface], 31 [yes],[],[], 32 [${srcdir}/interfaces/Perl/Makefile.am]) 33 34 35 ## check for perl requirements 36 AS_IF([test "x$with_perl" != "xno"],[ 37 AS_IF([test "x$wants_swig" = "xno"],[ 38 with_perl="no" 39 ], [ 40 ## if swig is not available, check whether we already have swig generated sources 41 if test "x$has_swig" != "xyes" 42 then 43 AC_RNA_TEST_FILE([${srcdir}/interfaces/Perl/RNA_wrap.cpp],[],[ 44 with_perl="no" 45 ]) 46 AC_RNA_TEST_FILE([${srcdir}/interfaces/Perl/RNA.pm],[],[ 47 with_perl="no" 48 ]) 49 fi 50 ]) 51 ]) 52 53 RNA_PACKAGE_IF_ENABLED([perl],[ 54 AX_PERL_EXT 55 if test "x$PERL" = "x"; then 56 AC_MSG_ERROR([Perl is required to build.]) 57 [enable_perl_status="Perl is required to build."] 58 fi 59 ]) 60 61 # prepare all files for perl interface 62 RNA_PACKAGE_IF_ENABLED([perl],[ 63 # Compose the correct installation path for perl modules 64 # 65 # here we actually have to account for INSTALLDIRS env variable, which can be 66 # 67 # site = where the local systems administrator installs packages to 68 # vendor = where system packages are installed to, or 69 # core = where perl core packages are installed 70 # 71 # The default selection is 'site', but upon packaging for a specific distribution 72 # we might want the user to set this to 'vendor' 73 # 74 AS_IF([ test "x$INSTALLDIRS" == "xvendor" ],[ 75 PERL_ARCH_RELATIVE_INSTALL_DIR=`echo ${PERL_EXT_VENDORARCH} | sed "s,${PERL_EXT_VENDORPREFIX},,"` 76 PERL_LIB_RELATIVE_INSTALL_DIR=`echo ${PERL_EXT_VENDORLIB} | sed "s,${PERL_EXT_VENDORPREFIX},,"` 77 ],[ 78 PERL_ARCH_RELATIVE_INSTALL_DIR=`echo ${PERL_EXT_SITEARCH} | sed "s,${PERL_EXT_SITEPREFIX},,"` 79 PERL_LIB_RELATIVE_INSTALL_DIR=`echo ${PERL_EXT_SITELIB} | sed "s,${PERL_EXT_SITEPREFIX},,"` 80 ]) 81 AC_SUBST(PERL_ARCH_RELATIVE_INSTALL_DIR) 82 AC_SUBST(PERL_LIB_RELATIVE_INSTALL_DIR) 83 84 AC_DEFINE([WITH_PERL_INTERFACE], [1], [Create the perl interface to RNAlib]) 85 AC_SUBST([PERL_INTERFACE], [Perl]) 86 AC_CONFIG_FILES([interfaces/Perl/Makefile interfaces/Perl/version.i]) 87 ]) 88 89]) 90 91AC_DEFUN([RNA_ENABLE_SWIG_PYTHON],[ 92 93 AX_REQUIRE_DEFINED([AX_PYTHON2_DEVEL]) 94 95 RNA_ADD_PACKAGE([python], 96 [Python interface], 97 [yes],[],[], 98 [${srcdir}/interfaces/Python/Makefile.am]) 99 100 101 ## check for python requirements 102 AS_IF([test "x$with_python" != "xno"],[ 103 AS_IF([test "x$wants_swig" = "xno"],[ 104 with_python="no" 105 ],[ 106 ## if swig is not available, check whether we already have swig generated sources 107 if test "x$has_swig" != "xyes" 108 then 109 AC_RNA_TEST_FILE([${srcdir}/interfaces/Python/RNA_wrap.cpp],[],[ 110 with_python="no" 111 ]) 112 AC_RNA_TEST_FILE([${srcdir}/interfaces/Python/RNA.py],[],[ 113 with_python="no" 114 ]) 115 fi 116 ]) 117 ]) 118 119 AS_IF([test "x$with_python" != "xno"],[ 120 121 ## check for python2 config 122 AX_PYTHON2_DEVEL 123 124 if test "x$python2_enabled_but_failed" != "x" 125 then 126 with_python="no" 127 else 128 AC_SUBST(PYTHON2DIR,$python2dir) 129 AC_SUBST(PKGPYTHON2DIR,$pkgpython2dir) 130 AC_SUBST(PYEXEC2DIR,$py2execdir) 131 AC_SUBST(PKGPYEXEC2DIR,$pkgpy2execdir) 132 133 AC_DEFINE([WITH_PYTHON2_INTERFACE], [1], [Create the python2 interface to RNAlib]) 134 AC_SUBST([PYTHON2_INTERFACE], [Python]) 135 AC_CONFIG_FILES([interfaces/Python/Makefile interfaces/Python/version.i]) 136 fi 137 ]) 138]) 139 140AC_DEFUN([RNA_ENABLE_SWIG_PYTHON3],[ 141 142 AX_REQUIRE_DEFINED([AX_PYTHON3_DEVEL]) 143 144 RNA_ADD_PACKAGE([python3], 145 [Python3 interface], 146 [yes],[],[], 147 [${srcdir}/interfaces/Python3/Makefile.am]) 148 149 150 ## check for python requirements 151 AS_IF([test "x$with_python3" != "xno"],[ 152 AS_IF([test "x$wants_swig" = "xno"],[ 153 with_python3="no" 154 ],[ 155 ## if swig is not available, check whether we already have swig generated sources 156 if test "x$has_swig" != "xyes" 157 then 158 AC_RNA_TEST_FILE([${srcdir}/interfaces/Python3/RNA_wrap.cpp],[],[ 159 with_python3="no" 160 ]) 161 AC_RNA_TEST_FILE([${srcdir}/interfaces/Python3/RNA.py],[],[ 162 with_python3="no" 163 ]) 164 fi 165 ]) 166 ]) 167 168 AS_IF([test "x$with_python3" != "xno"],[ 169 170 ## check for python3 config 171 AX_PYTHON3_DEVEL 172 173 if test "x$python3_enabled_but_failed" != "x" 174 then 175 with_python3="no" 176 else 177 AC_DEFINE([WITH_PYTHON3_INTERFACE], [1], [Create the Python3 interface to RNAlib]) 178 AC_SUBST([PYTHON3_INTERFACE], [Python3]) 179 fi 180 181 AC_CONFIG_FILES([interfaces/Python3/Makefile interfaces/Python3/version.i]) 182 ]) 183]) 184