comparison src/configure.ac @ 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 5b2a3d09f524
children 194f8c66b45a
comparison
equal deleted inserted replaced
216:a28b50969020 217:5292e0614efc
1 AC_PREREQ([2.67]) 1 AC_PREREQ([2.67])
2 AC_INIT([Msh Package], [1.0]) 2 AC_INIT([Fem-fenics Package], [0.0.1])
3 3
4 AC_USE_SYSTEM_EXTENSIONS 4 AC_USE_SYSTEM_EXTENSIONS
5 5
6 AC_PROG_CXX 6 AC_PROG_CXX
7 AC_LANG(C++) 7 AC_LANG(C++)
8
9 PKG_PROG_PKG_CONFIG
8 10
9 # Get Dense include locations 11 # Get Dense include locations
10 AC_ARG_WITH([eigen-includedir], 12 AC_ARG_WITH([eigen-includedir],
11 [AS_HELP_STRING([--with-eigen-includedir=DIR], 13 [AS_HELP_STRING([--with-eigen-includedir=DIR],
12 [location of the Eigen headers, defaults to /usr/include/])], 14 [location of the Eigen headers, defaults to /usr/include/])],
13 [DENSE_CPPFLAGS="-I$withval"], 15 [DENSE_CPPFLAGS="-I$withval"],
14 [DENSE_CPPFLAGS='-I/usr/include/']) 16 [DENSE_CPPFLAGS='-I/usr/include/'])
15 AC_SUBST(DENSE_CPPFLAGS) 17 AC_SUBST(DENSE_CPPFLAGS)
16 echo $DENSE_CPPFLAGS 18 echo $DENSE_CPPFLAGS
17 19
18 CPPFLAGS="$DENSE_CPPFLAGS $CPPFLAGS" 20 ## Check for Eigen
21 AC_MSG_CHECKING([for eigen3])
19 22
20 # Check for Dense and dolfin 23 EIGEN_CPPFLAGS=
21 have_dense_ok=no 24 EIGEN_LDFLAGS=
22 AC_CHECK_HEADERS([Eigen/Dense],[have_dense_ok=yes;break],[],[]) 25 EIGEN_LIBS=
23 26
24 if test $have_dense_ok = no; then 27 PKG_CHECK_EXISTS([eigen3],
25 AC_MSG_WARN([Dense headers could not be found, 28 [EIGEN_CPPFLAGS=`$PKG_CONFIG --cflags-only-I eigen3`
26 some functionalities will be disabled, 29 EIGEN_LDFLAGS=`$PKG_CONFIG --libs-only-L eigen3`
27 don't worry your package will still be 30 EIGEN_LIBS=`$PKG_CONFIG --libs-only-l eigen3`
28 working, though.]) 31 AC_MSG_RESULT([yes])],
29 fi 32 [AC_MSG_RESULT([no])
33 AC_MSG_ERROR([eigen3 required to install $PACKAGE_NAME])]
34 )
30 35
31 have_dolfin_ok=no 36 AC_SUBST(EIGEN_CPPFLAGS)
32 AC_CHECK_HEADERS([dolfin.h], [have_dolfin_ok=yes; break], [], 37 AC_SUBST(EIGEN_LDFLAGS)
33 [#ifdef HAVE_DOLFIN_H 38 AC_SUBST(EIGEN_LIBS)
34 #include<dolfin.h> 39
35 #endif]) 40 ## Check for dolfin
36 if test $have_dolfin_ok = no; then 41 AC_MSG_CHECKING([for dolfin])
37 AC_MSG_WARN([dolfin headers could not be found, 42
38 some functionalities will be disabled, 43 DOLFIN_CPPFLAGS=
39 don't worry your package will still be 44 DOLFIN_LDFLAGS=
40 working, though.]) 45 DOLFIN_LIBS=
41 fi 46
47 PKG_CHECK_EXISTS([dolfin],
48 [DOLFIN_CPPFLAGS=`$PKG_CONFIG --cflags-only-I dolfin`
49 DOLFIN_LDFLAGS=`$PKG_CONFIG --libs-only-L dolfin`
50 DOLFIN_LIBS=`$PKG_CONFIG --libs-only-l dolfin`
51 AC_MSG_RESULT([yes])],
52 [AC_MSG_RESULT([no])
53 AC_MSG_ERROR([dolfin required to install $PACKAGE_NAME])]
54 )
55
56 AC_SUBST(DOLFIN_CPPFLAGS)
57 AC_SUBST(DOLFIN_LDFLAGS)
58 AC_SUBST(DOLFIN_LIBS)
59
42 60
43 AC_CHECK_PROG([HAVE_FFC], [ffc], [yes], [no]) 61 AC_CHECK_PROG([HAVE_FFC], [ffc], [yes], [no])
44 if [test $HAVE_FFC = "no"]; then 62 if [test $HAVE_FFC = "no"]; then
45 AC_MSG_ERROR([ffc required to install $PACKAGE_NAME]) 63 AC_MSG_ERROR([ffc required to install $PACKAGE_NAME])
46 fi 64 fi