diff --git a/configure b/configure index f023d1a6d73058e11f384d3e0a6b89b33bfe073a..2fdfb29a71d2304d74b183cea1565dbdc83a57ea 100755 --- a/configure +++ b/configure @@ -730,6 +730,7 @@ enable_gsl enable_xdrfile enable_boost_graph enable_boost_serialization +enable_asmjit enable_fftw enable_python enable_openmp @@ -1408,6 +1409,7 @@ Optional Features: --enable-boost_graph enable search for boost graph, default: no --enable-boost_serialization enable search for boost serialization, default: no + --enable-asmjit enable search for asmjit, default: no --enable-fftw enable search for fftw, default: no --enable-python enable search for python, default: yes --disable-openmp do not use OpenMP @@ -2985,6 +2987,24 @@ fi +asmjit= +# Check whether --enable-asmjit was given. +if test "${enable_asmjit+set}" = set; then : + enableval=$enable_asmjit; case "${enableval}" in + (yes) asmjit=true ;; + (no) asmjit=false ;; + (*) as_fn_error $? "wrong argument to --enable-asmjit" "$LINENO" 5 ;; + esac +else + case "no" in + (yes) asmjit=true ;; + (no) asmjit=false ;; + esac + +fi + + + fftw= # Check whether --enable-fftw was given. if test "${enable_fftw+set}" = set; then : @@ -8080,6 +8100,74 @@ $as_echo "$as_me: WARNING: cannot enable __PLUMED_HAS_BOOST_SERIALIZATION" >&2;} # notice: macports install libraries with -mt suffix fi +if test $asmjit == true ; then + + found=ko + __PLUMED_HAS_ASMJIT=no + if test "${libsearch}" == true ; then + testlibs="asmjit" + else + testlibs="" + fi + for testlib in "" $testlibs + do + save_LIBS="$LIBS" + if test -n "$testlib" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking asmjit with -l$testlib" >&5 +$as_echo_n "checking asmjit with -l$testlib... " >&6; } + LIBS="-l$testlib $LIBS" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking asmjit without extra libs" >&5 +$as_echo_n "checking asmjit without extra libs... " >&6; } + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <asmjit/asmjit.h> +#include <stdio.h> +using namespace asmjit; +typedef int (*Func)(void); +int main(int argc, char* argv[]) { + JitRuntime rt; + X86Assembler a(&rt); + a.mov(x86::eax, 1); + a.ret(); + Func fn; + fn=(int (*)(void)) a.make(); + int result = fn(); + printf("%d\n", result); + return 0; +} + +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + found=ok + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $found == ok ; then + break + fi + LIBS="$save_LIBS" + done + if test $found == ok ; then + $as_echo "#define __PLUMED_HAS_ASMJIT 1" >>confdefs.h + + __PLUMED_HAS_ASMJIT=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable __PLUMED_HAS_ASMJIT" >&5 +$as_echo "$as_me: WARNING: cannot enable __PLUMED_HAS_ASMJIT" >&2;} + LIBS="$save_LIBS" + fi + +fi + if test $fftw == true ; then found=ko diff --git a/configure.ac b/configure.ac index dd98ab5c13ba3d6f31ac166349a1fbcba220ffd0..c01686bd8683ccb0551bb8672946856c9a70dcf4 100644 --- a/configure.ac +++ b/configure.ac @@ -254,6 +254,7 @@ PLUMED_CONFIG_ENABLE([gsl],[search for gsl],[yes]) PLUMED_CONFIG_ENABLE([xdrfile],[search for xdrfile],[yes]) PLUMED_CONFIG_ENABLE([boost_graph],[search for boost graph],[no]) PLUMED_CONFIG_ENABLE([boost_serialization],[search for boost serialization],[no]) +PLUMED_CONFIG_ENABLE([asmjit],[search for asmjit],[no]) PLUMED_CONFIG_ENABLE([fftw],[search for fftw],[no]) PLUMED_CONFIG_ENABLE([python],[search for python],[yes]) @@ -648,6 +649,26 @@ int main() { # notice: macports install libraries with -mt suffix fi +if test $asmjit == true ; then + PLUMED_CHECK_CXX_PACKAGE([asmjit],[ +#include <asmjit/asmjit.h> +#include <stdio.h> +using namespace asmjit; +typedef int (*Func)(void); +int main(int argc, char* argv[[]]) { + JitRuntime rt; + X86Assembler a(&rt); + a.mov(x86::eax, 1); + a.ret(); + Func fn; + fn=(int (*)(void)) a.make(); + int result = fn(); + printf("%d\n", result); + return 0; +} + ], [__PLUMED_HAS_ASMJIT],[asmjit]) +fi + if test $fftw == true ; then PLUMED_CHECK_PACKAGE([fftw3.h],[fftw_execute],[__PLUMED_HAS_FFTW],[fftw3]) fi