From 31a50f393db0f1e9df6817cb238959f2cc02e6dc Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Fri, 20 Dec 2013 18:29:14 +0100
Subject: [PATCH] Added search for molfile

---
 autoconf/configure    | 60 +++++++++++++++++++++++++++++++++++++++++++
 autoconf/configure.ac | 12 +++++++++
 2 files changed, 72 insertions(+)

diff --git a/autoconf/configure b/autoconf/configure
index ff69e8236..7f2435358 100755
--- a/autoconf/configure
+++ b/autoconf/configure
@@ -4846,6 +4846,66 @@ fi
 
     fi
 
+
+# molfile:
+save_LIBS="$LIBS"
+found=ko
+ac_fn_cxx_check_header_mongrel "$LINENO" "libmolfile_plugin.h" "ac_cv_header_libmolfile_plugin_h" "$ac_includes_default"
+if test "x$ac_cv_header_libmolfile_plugin_h" = xyes; then :
+  ac_fn_cxx_check_header_mongrel "$LINENO" "molfile_plugin.h" "ac_cv_header_molfile_plugin_h" "$ac_includes_default"
+if test "x$ac_cv_header_molfile_plugin_h" = xyes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for molfile_gromacsplugin_init in -lmolfile_plugin" >&5
+$as_echo_n "checking for molfile_gromacsplugin_init in -lmolfile_plugin... " >&6; }
+if ${ac_cv_lib_molfile_plugin_molfile_gromacsplugin_init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmolfile_plugin  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char molfile_gromacsplugin_init ();
+int
+main ()
+{
+return molfile_gromacsplugin_init ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_lib_molfile_plugin_molfile_gromacsplugin_init=yes
+else
+  ac_cv_lib_molfile_plugin_molfile_gromacsplugin_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_molfile_plugin_molfile_gromacsplugin_init" >&5
+$as_echo "$ac_cv_lib_molfile_plugin_molfile_gromacsplugin_init" >&6; }
+if test "x$ac_cv_lib_molfile_plugin_molfile_gromacsplugin_init" = xyes; then :
+  LIBS="-lmolfile_plugin $LIBS" found=ok
+
+fi
+
+fi
+
+
+fi
+
+
+if test $found == ok ; then
+ $as_echo "#define __PLUMED_HAS_MOLFILE 1" >>confdefs.h
+
+fi
+
 # check for zlib
 # PLUMED_CHECK_PACKAGE([zlib.h],[gzopen],[__PLUMED_HAS_ZLIB],[z])
 # this can be used to enable openmp:
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 9caa75929..758aa2e12 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -168,6 +168,18 @@ PLUMED_CHECK_PACKAGE([mpi.h],[MPI_Init],[__PLUMED_MPI])
 PLUMED_CHECK_PACKAGE([regex.h],[regcomp],[__PLUMED_HAS_CREGEX])
 PLUMED_CHECK_PACKAGE([dlfcn.h],[dlopen],[__PLUMED_HAS_DLOPEN])
 PLUMED_CHECK_PACKAGE([execinfo.h],[backtrace],[__PLUMED_HAS_EXECINFO])
+
+# molfile:
+save_LIBS="$LIBS"
+found=ko
+AC_CHECK_HEADER( [libmolfile_plugin.h],
+  AC_CHECK_HEADER(  [molfile_plugin.h],
+  AC_CHECK_LIB(  molfile_plugin,molfile_gromacsplugin_init, [LIBS="-lmolfile_plugin $LIBS"] [found=ok]
+  )))
+if test $found == ok ; then
+ AC_DEFINE([__PLUMED_HAS_MOLFILE])
+fi
+
 # check for zlib
 # PLUMED_CHECK_PACKAGE([zlib.h],[gzopen],[__PLUMED_HAS_ZLIB],[z])
 # this can be used to enable openmp:
-- 
GitLab