3
# ot_check_openturns.m4
5
# (C) Copyright 2005-2007 EDF-EADS-Phimeca
7
# This library is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU Lesser General Public
9
# License as published by the Free Software Foundation; either
10
# version 2.1 of the License.
12
# This library is distributed in the hope that it will be useful
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# Lesser General Public License for more details.
17
# You should have received a copy of the GNU Lesser General Public
18
# License along with this library; if not, write to the Free Software
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
# @author: $LastChangedBy: dutka $
22
# @date: $LastChangedDate: 2008-09-22 11:34:11 +0200 (Mon, 22 Sep 2008) $
23
# Id: $Id: ot_check_openturns.m4 941 2008-09-22 09:34:11Z dutka $
27
# This file is intended to be include in configure.in file
28
# of any project that embed Open TURNS. It allows the correct
29
# detection of Open TURNS by the embedding project without
30
# it knowing its intrinsics.
32
# OT_CHECK_OPENTURNS( [OPENTURNS_INSTALL_PATH = /usr] )
33
# -----------------------------------------------------
35
AC_DEFUN([OT_CHECK_OPENTURNS],
37
AC_ARG_WITH([openturns],
38
AC_HELP_STRING([--with-openturns=<path>],
39
[add Open TURNS support. <Path> should point to a actual install path of Open TURNS library and headers. If ommitted, assume that Open TURNS is installed in /usr, ie <path>=/usr. Default is to support Open TURNS.]),
44
# saving values for compilation variables
45
saved_CPPFLAGS=$CPPFLAGS
46
saved_LDFLAGS=$LDFLAGS
49
openturns_default_path=m4_default([$1], /usr)
50
if ! test x${withval} = xno
52
AC_CACHE_CHECK([for Open TURNS install path], [ot_cv_openturns_install_path], [])
53
AC_CACHE_CHECK([for Open TURNS include flags], [ot_cv_openturns_cppflags], [])
54
AC_CACHE_CHECK([for Open TURNS library flags], [ot_cv_openturns_ldflags], [])
55
AC_CACHE_CHECK([for Open TURNS libraries], [ot_cv_openturns_libs], [])
56
AC_CACHE_CHECK([for Open TURNS wrapper include flags], [ot_cv_openturns_wrapper_cppflags], [])
57
AC_CACHE_CHECK([for Open TURNS wrapper library flags], [ot_cv_openturns_wrapper_ldflags], [])
58
AC_CACHE_CHECK([for Open TURNS wrapper library], [ot_cv_openturns_wrapper_libs], [])
59
AC_CACHE_CHECK([for Open TURNS wrapper DTD path], [ot_cv_openturns_wrapper_dtd_path], [])
61
if test -z "$ot_cv_openturns_install_path" || test -z "$ot_cv_openturns_cppflags" || test -z "$ot_cv_openturns_ldflags" || test -z "$ot_cv_openturns_libs" || test -z "$ot_cv_openturns_wrapper_cppflags" || test -z "$ot_cv_openturns_wrapper_ldflags" || test -z "$ot_cv_openturns_wrapper_libs"
63
# ask for Open TURNS support
64
AC_MSG_NOTICE([checking whether Open TURNS library and headers are here and working])
66
# we're trying to find the correct Open TURNS installation path
67
openturns_install_path=$openturns_default_path
68
test x${withval} = xyes || openturns_install_path=$withval
70
AC_MSG_CHECKING([Open TURNS install path])
71
test -d ${openturns_install_path} || AC_MSG_ERROR([$openturns_install_path: incorrect path])
72
AC_MSG_RESULT([$openturns_install_path])
75
# we test the header file presence and usability
76
openturns_cppflags="-I$openturns_install_path/include/openturns"
77
CPPFLAGS="${CPPFLAGS} ${openturns_cppflags}"
78
AC_CHECK_HEADER([OT.hxx],
79
[openturns_header_found=yes],
80
[openturns_header_found=no],
82
test x${openturns_header_found} = xno && AC_MSG_ERROR([Open TURNS include file NOT FOUND])
84
# we test the library file presence and usability
85
openturns_ldflags="-L$openturns_install_path/lib/openturns"
87
LDFLAGS="${LDFLAGS} ${openturns_ldflags}"
89
[openturns_library_ok],
90
[openturns_lib_found=yes],
91
[openturns_lib_found=no],
93
test x${openturns_lib_found} = xno && AC_MSG_ERROR([Open TURNS library NOT FOUND])
97
# we test the wrapper header file presence and usability
98
openturns_wrapper_cppflags="-I$openturns_install_path/include/openturns"
99
CPPFLAGS="${CPPFLAGS} ${openturns_wrapper_cppflags}"
100
AC_CHECK_HEADER([WrapperCommon.h],
101
[openturns_wrapper_header_found=yes],
102
[openturns_wrapper_header_found=no],
104
test x${openturns_wrapper_header_found} = xno && AC_MSG_ERROR([Open TURNS wrapper include file NOT FOUND])
106
openturns_wrapper_ldflags=
107
openturns_wrapper_libs=
110
# we look for the file wrapper.dtd to set its path
111
for ot_dir in $openturns_install_path/share/openturns/wrappers
113
if test -f $ot_dir/wrapper.dtd
115
openturns_wrapper_dtd_path=$ot_dir
120
# We write the values into the cache file
121
OT_SET_OPENTURNS_CACHE_VALUES
124
# we reset the values of Open TURNS flags from the cached values
125
OPENTURNS_INSTALL_PATH=$ot_cv_openturns_install_path
126
AC_SUBST(OPENTURNS_INSTALL_PATH)
128
OPENTURNS_CPPFLAGS=$ot_cv_openturns_cppflags
129
OPENTURNS_LDFLAGS=$ot_cv_openturns_ldflags
130
OPENTURNS_LIBS=$ot_cv_openturns_libs
131
AC_SUBST(OPENTURNS_CPPFLAGS)
132
AC_SUBST(OPENTURNS_LDFLAGS)
133
AC_SUBST(OPENTURNS_LIBS)
135
OPENTURNS_WRAPPER_CPPFLAGS=$ot_cv_openturns_wrapper_cppflags
136
OPENTURNS_WRAPPER_LDFLAGS=$ot_cv_openturns_wrapper_ldflags
137
OPENTURNS_WRAPPER_LIBS=$ot_cv_openturns_wrapper_libs
138
AC_SUBST(OPENTURNS_WRAPPER_CPPFLAGS)
139
AC_SUBST(OPENTURNS_WRAPPER_LDFLAGS)
140
AC_SUBST(OPENTURNS_WRAPPER_LIBS)
142
OPENTURNS_WRAPPER_DTD_PATH=$ot_cv_openturns_wrapper_dtd_path
143
AC_SUBST(OPENTURNS_WRAPPER_DTD_PATH)
145
# after all tests are successful, we support Open TURNS
147
AC_MSG_NOTICE([Open TURNS support is OK])
150
# no Open TURNS support
151
AC_MSG_NOTICE([No Open TURNS support])
154
# Propagate test into Makefiles
155
AM_CONDITIONAL(WITH_OPENTURNS, test $WITH_OPENTURNS = 1)
157
# restoring saved values
158
CPPFLAGS=$saved_CPPFLAGS
159
LDFLAGS=$saved_LDFLAGS
164
# OT_SET_OPENTURNS_CACHE_VALUES
165
# ------------------------------
167
AC_DEFUN([OT_SET_OPENTURNS_CACHE_VALUES],
169
AC_CACHE_CHECK([for Open TURNS install path], [ot_cv_openturns_install_path], [ot_cv_openturns_install_path=$openturns_install_path])
170
AC_CACHE_CHECK([for Open TURNS include flags], [ot_cv_openturns_cppflags], [ot_cv_openturns_cppflags=$openturns_cppflags])
171
AC_CACHE_CHECK([for Open TURNS library flags], [ot_cv_openturns_ldflags], [ot_cv_openturns_ldflags=$openturns_ldflags])
172
AC_CACHE_CHECK([for Open TURNS libraries], [ot_cv_openturns_libs], [ot_cv_openturns_libs=$openturns_libs])
174
AC_CACHE_CHECK([for Open TURNS wrapper include flags], [ot_cv_openturns_wrapper_cppflags], [ot_cv_openturns_wrapper_cppflags=$openturns_wrapper_cppflags])
175
AC_CACHE_CHECK([for Open TURNS wrapper library flags], [ot_cv_openturns_wrapper_ldflags], [ot_cv_openturns_wrapper_ldflags=$openturns_wrapper_ldflags])
176
AC_CACHE_CHECK([for Open TURNS wrapper library], [ot_cv_openturns_wrapper_libs], [ot_cv_openturns_wrapper_libs=$openturns_wrapper_libs])
178
AC_CACHE_CHECK([for Open TURNS wrapper DTD path], [ot_cv_openturns_wrapper_dtd_path], [ot_cv_openturns_wrapper_dtd_path=$openturns_wrapper_dtd_path])