Add ert-detecting macro for building with ert support.

This is primarily intended for enabling eclipse-format output from simulators.
Also add missing header to Makefile.am, to fix 'make distcheck'.
This commit is contained in:
Atgeirr Flø Rasmussen 2012-11-26 10:58:18 +01:00
parent bcfcfdc930
commit 2f521169c5
3 changed files with 79 additions and 9 deletions

View File

@ -7,28 +7,29 @@ SUBDIRS = . examples
lib_LTLIBRARIES = libopmpolymer.la
libopmpolymer_la_SOURCES = \
opm/polymer/IncompTpfaPolymer.cpp \
opm/polymer/CompressibleTpfaPolymer.cpp \
opm/polymer/SimulatorPolymer.cpp \
opm/polymer/SimulatorCompressiblePolymer.cpp \
opm/polymer/TransportModelPolymer.cpp \
opm/polymer/TransportModelCompressiblePolymer.cpp \
opm/polymer/IncompTpfaPolymer.cpp \
opm/polymer/PolymerInflow.cpp \
opm/polymer/PolymerProperties.cpp \
opm/polymer/SimulatorCompressiblePolymer.cpp \
opm/polymer/SimulatorPolymer.cpp \
opm/polymer/TransportModelCompressiblePolymer.cpp \
opm/polymer/TransportModelPolymer.cpp \
opm/polymer/polymerUtilities.cpp
nobase_include_HEADERS = \
opm/polymer/CompressibleTpfaPolymer.hpp \
opm/polymer/GravityColumnSolverPolymer.hpp \
opm/polymer/GravityColumnSolverPolymer_impl.hpp \
opm/polymer/IncompPropertiesDefaultPolymer.hpp \
opm/polymer/IncompTpfaPolymer.hpp \
opm/polymer/CompressibleTpfaPolymer.hpp \
opm/polymer/PolymerBlackoilState.hpp \
opm/polymer/PolymerInflow.hpp \
opm/polymer/PolymerProperties.hpp \
opm/polymer/PolymerState.hpp \
opm/polymer/SinglePointUpwindTwoPhasePolymer.hpp \
opm/polymer/SimulatorPolymer.hpp \
opm/polymer/SimulatorCompressiblePolymer.hpp \
opm/polymer/SimulatorPolymer.hpp \
opm/polymer/SinglePointUpwindTwoPhasePolymer.hpp \
opm/polymer/TransportModelCompressiblePolymer.hpp \
opm/polymer/TransportModelPolymer.hpp \
opm/polymer/TransportModelCompressiblePolymer.hpp \
opm/polymer/polymerUtilities.hpp

View File

@ -39,6 +39,8 @@ AX_BOOST_DATE_TIME
AX_BOOST_FILESYSTEM
AX_BOOST_UNIT_TEST_FRAMEWORK
ERT
# Checks for header files.
AC_CHECK_HEADERS([opm/core/grid.h], [],
[AC_MSG_ERROR(

67
m4/ert.m4 Normal file
View File

@ -0,0 +1,67 @@
AC_DEFUN([_ERT_SOURCE_TEXT],
[
AC_LANG_PROGRAM(
[[
#include <stddef.h>
#include <ecl_util.h>
]],dnl
[[
int sz;
sz = ecl_util_get_sizeof_ctype(ECL_INT_TYPE);
]])[]dnl
])[]dnl
# ----------------------------------------------------------------------
AC_DEFUN([ERT],
[
AC_ARG_WITH([ert],
[AS_HELP_STRING([--with-ert=<root>], [Use ERT libraries])],
[], [with_ert=no])
use_ert=no
AS_IF([test x"${with_ert}" != x"no"],
[
_ert_LDFLAGS_SAVE="${LDFLAGS}"
_ert_LIBS_SAVE="${LIBS}"
_ert_CPPFLAGS_SAVE="${CPPFLAGS}"
_ert_CFLAGS_SAVE="${CFLAGS}"
ERT_CPPFLAGS=
ERT_LDFLAGS=
ERT_LIBS="-lecl -lgeometry -lert_util -lpthread -lz -lgomp"
AS_IF([test x"${with_ert}" != x"yes"],
[ERT_LDFLAGS="-L${with_ert}/lib"
ERT_CPPFLAGS="-I${with_ert}/include"], [:])[]dnl
CFLAGS="-std=gnu99"
CPPFLAGS="${ERT_CPPFLAGS} ${CPPFLAGS}"
LDFLAGS="${ERT_LDFLAGS} ${LDFLAGS}"
LIBS="${ERT_LIBS} ${LIBS}"
AC_LINK_IFELSE([_ERT_SOURCE_TEXT],
[use_ert=yes], [use_ert=no])
LIBS="${_ert_LIBS_SAVE}"
CPPFLAGS="${_ert_CPPFLAGS_SAVE}"
LDFLAGS="${_ert_LDFLAGS_SAVE}"
CFLAGS="${_ert_CFLAGS_SAVE}"
AS_IF([test x"${use_ert}" = x"yes"],
[AC_SUBST([ERT_CPPFLAGS])
AC_SUBST([ERT_LDFLAGS])
AC_SUBST([ERT_LIBS])
AC_DEFINE([HAVE_ERT], [1],
[Are the ERT libraries available for reading and writing ECLIPSE files.])],dnl
[:])[]dnl
], [:])[]dnl
AM_CONDITIONAL([HAVE_ERT], [test x"${use_ert}" != x"no"])
# AC_MSG_ERROR(
# [**** ERT_CPPFLAGS = ${ERT_CPPFLAGS} ****
# **** ERT_LDFLAGS = ${ERT_LDFLAGS} ****
# **** ERT_LIBS = ${ERT_LIBS} ****
# ])
])