changeset 217:5292e0614efc

New patches submitted from eg123 for the automatization of the configuration process. Use of pkg-config to find dolfin and eigen3 includes and libs * src/Makefile.in: make variables (CPPFLAGS, LDFLAGS, LIBS) are defined substituting the Autoconf ones * src/configure.ac: dolfin and eigen3 compile and link flags are looked for through pkg-config macros * DESCRIPTION: added pkg-config as a build-dependency configure fails if dependencies are not met.
author gedeone-octave <marcovass89@hotmail.it>
date Mon, 10 Mar 2014 08:58:56 +0000
parents a28b50969020
children 8a3361bfa434
files DESCRIPTION src/Makefile.in src/configure.ac
diffstat 3 files changed, 46 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/DESCRIPTION	Wed Mar 05 11:59:02 2014 +0000
+++ b/DESCRIPTION	Mon Mar 10 08:58:56 2014 +0000
@@ -5,9 +5,9 @@
 Maintainer: Marco Vassallo <gedeone-octave@users.sourceforge.net>
 Title: fem-fenics
 Description: pkg for the resolution of partial differential equation based on fenics
-Depends: octave (>= 3.7.5)
+Depends: octave (>= 3.8.0)
 SystemRequirements: dolfin (>=1.3.0), ffc (>=1.3.0)
-BuildRequirements: dolfin (>=1.3.0), ffc (>=1.3.0)
+BuildRequirements: dolfin (>=1.3.0), ffc (>=1.3.0), pkg-config
 Autoload: no
 License: GPLv3+
 Url: http://octave.sf.net
--- a/src/Makefile.in	Wed Mar 05 11:59:02 2014 +0000
+++ b/src/Makefile.in	Mon Mar 10 08:58:56 2014 +0000
@@ -1,6 +1,10 @@
 MKOCTFILE ?= mkoctfile
 FFC ?= ffc
 
+CPPFLAGS=@DENSE_CPPFLAGS@ @DOLFIN_CPPFLAGS@ @EIGEN_CPPFLAGS@
+LDFLAGS=@EIGEN_LDFLAGS@ @DOLFIN_LDFLAGS@
+LIBS=@EIGEN_LIBS@ @DOLFIN_LIBS@
+
 OCTFILES= Mesh.oct \
              DirichletBC.oct \
              Expression.oct \
--- a/src/configure.ac	Wed Mar 05 11:59:02 2014 +0000
+++ b/src/configure.ac	Mon Mar 10 08:58:56 2014 +0000
@@ -1,11 +1,13 @@
 AC_PREREQ([2.67])
-AC_INIT([Msh Package], [1.0])
+AC_INIT([Fem-fenics Package], [0.0.1])
 
 AC_USE_SYSTEM_EXTENSIONS
 
 AC_PROG_CXX
 AC_LANG(C++)
 
+PKG_PROG_PKG_CONFIG
+
 # Get Dense include locations
 AC_ARG_WITH([eigen-includedir],
   [AS_HELP_STRING([--with-eigen-includedir=DIR],
@@ -15,30 +17,46 @@
 AC_SUBST(DENSE_CPPFLAGS)
 echo $DENSE_CPPFLAGS
 
-CPPFLAGS="$DENSE_CPPFLAGS $CPPFLAGS"
+## Check for Eigen
+AC_MSG_CHECKING([for eigen3])
+
+EIGEN_CPPFLAGS=
+EIGEN_LDFLAGS=
+EIGEN_LIBS=
 
-# Check for Dense and dolfin
-have_dense_ok=no
-AC_CHECK_HEADERS([Eigen/Dense],[have_dense_ok=yes;break],[],[])
+PKG_CHECK_EXISTS([eigen3],
+  [EIGEN_CPPFLAGS=`$PKG_CONFIG --cflags-only-I eigen3`
+   EIGEN_LDFLAGS=`$PKG_CONFIG --libs-only-L eigen3`
+   EIGEN_LIBS=`$PKG_CONFIG --libs-only-l eigen3`
+   AC_MSG_RESULT([yes])],
+  [AC_MSG_RESULT([no])
+   AC_MSG_ERROR([eigen3 required to install $PACKAGE_NAME])]
+  )
+
+AC_SUBST(EIGEN_CPPFLAGS)
+AC_SUBST(EIGEN_LDFLAGS)
+AC_SUBST(EIGEN_LIBS)
 
-if test $have_dense_ok = no; then
-  AC_MSG_WARN([Dense headers could not be found,
-                some functionalities will be disabled,
-                don't worry your package will still be
-                working, though.])
-fi
+## Check for dolfin
+AC_MSG_CHECKING([for dolfin])
+
+DOLFIN_CPPFLAGS=
+DOLFIN_LDFLAGS=
+DOLFIN_LIBS=
 
-have_dolfin_ok=no
-AC_CHECK_HEADERS([dolfin.h], [have_dolfin_ok=yes; break], [],
-  [#ifdef HAVE_DOLFIN_H
-   #include<dolfin.h>
-   #endif])
-if test $have_dolfin_ok = no; then
-  AC_MSG_WARN([dolfin headers could not be found,
-                some functionalities will be disabled,
-                don't worry your package will still be
-                working, though.])
-fi
+PKG_CHECK_EXISTS([dolfin],
+  [DOLFIN_CPPFLAGS=`$PKG_CONFIG --cflags-only-I dolfin`
+   DOLFIN_LDFLAGS=`$PKG_CONFIG --libs-only-L dolfin`
+   DOLFIN_LIBS=`$PKG_CONFIG --libs-only-l dolfin`
+   AC_MSG_RESULT([yes])],
+  [AC_MSG_RESULT([no])
+   AC_MSG_ERROR([dolfin required to install $PACKAGE_NAME])]
+  )
+
+AC_SUBST(DOLFIN_CPPFLAGS)
+AC_SUBST(DOLFIN_LDFLAGS)
+AC_SUBST(DOLFIN_LIBS)
+
 
 AC_CHECK_PROG([HAVE_FFC], [ffc], [yes], [no])
 if [test $HAVE_FFC = "no"]; then