1
dnl--------------------------------------------------------------------------------
3
dnl This file is part of Code_Saturne, a general-purpose CFD tool.
5
dnl Copyright (C) 1998-2011 EDF S.A.
7
dnl This program is free software; you can redistribute it and/or modify it under
8
dnl the terms of the GNU General Public License as published by the Free Software
9
dnl Foundation; either version 2 of the License, or (at your option) any later
12
dnl This program is distributed in the hope that it will be useful, but WITHOUT
13
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
dnl FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17
dnl You should have received a copy of the GNU General Public License along with
18
dnl this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
19
dnl Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
dnl--------------------------------------------------------------------------------
25
# modifies or sets cs_have_ccm, CCM_CPPFLAGS, CCM_LDFLAGS, and CCM_LIBS
26
# depending on libraries found
28
AC_DEFUN([CS_AC_TEST_CCM], [
31
cs_have_ccm_headers=no
34
[AS_HELP_STRING([--with-ccm=DIR],
35
[specify prefix directory for CCMIO])],
36
[if test "x$withval" = "x"; then
41
AC_ARG_WITH(ccm-include,
42
[AS_HELP_STRING([--with-ccm-include=DIR],
43
[specify directory for CCMIO include files])],
44
[if test "x$with_ccm" = "xcheck"; then
47
CCM_CPPFLAGS="-I$with_ccm_include"],
48
[if test "x$with_ccm" != "xno" -a "x$with_ccm" != "xyes" \
49
-a "x$with_ccm" != "xcheck"; then
50
CCM_CPPFLAGS="-I$with_ccm/include"
54
[AS_HELP_STRING([--with-ccm-lib=DIR],
55
[specify directory for CCMIO library])],
56
[if test "x$with_ccm" = "xcheck"; then
59
CCM_LDFLAGS="-L$with_ccm_lib"
60
# Add the libdir to the runpath as CCM is not libtoolized
61
CCMRUNPATH="-R$with_ccm_lib"],
62
[if test "x$with_ccm" != "xno" -a "x$with_ccm" != "xyes" \
63
-a "x$with_ccm" != "xcheck"; then
64
CCM_LDFLAGS="-L$with_ccm/lib"
65
# Add the libdir to the runpath as CCM is not libtoolized
66
CCMRUNPATH="-R$with_ccm/lib"
69
# ADF may be provided directly (patched ADF with libccmio)
72
if test "x$with_ccm" != "xno" -a "x$cs_have_adf" = "xno" -a "x$cs_have_cgns" = "xno"
74
if test "x$with_ccm" = "xcheck"; then
76
AC_MSG_WARN([no ADF library found; will not search for CCM])
78
AC_MSG_ERROR([no ADF library found; required for CCM])
82
if test "x$with_ccm" != "xno" ; then
84
saved_CPPFLAGS="$CPPFLAGS"
85
saved_LDFLAGS="$LDFLAGS"
88
if test "x$ADF_LIBS" != "x" ; then
89
CCM_LIBS="-lccmio $ADF_LIBS"
90
CPPFLAGS="${CPPFLAGS} ${CCM_CPPFLAGS}"
91
LDFLAGS="${LDFLAGS} ${CCM_LDFLAGS} $ADF_LDFLAGS"
92
elif test "x$CGNS_LIBS" != "x" ; then
94
CPPFLAGS="${CPPFLAGS} ${CCM_CPPFLAGS}"
95
LDFLAGS="${LDFLAGS} ${CCM_LDFLAGS} $CGNS_LDFLAGS $HDF5_LDFLAGS"
97
LIBS="${LIBS} ${CCM_LIBS} $CGNS_LIBS $HDF5_LIBS"
99
# Check that CCMIO header files exist
101
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
102
[[#include <libccmio/ccmio.h>]],
103
[[int i = kCCMIONoErr;]])],
104
[AC_MSG_RESULT([CCMIO headers found])
105
cs_have_ccm_headers=yes
107
[AC_MSG_RESULT([CCMIO headers not found])
110
if test "x$cs_have_ccm_headers" = "xyes"; then
111
AC_CHECK_LIB(ccmio, CCMIOOpenFile,
112
[ AC_DEFINE([HAVE_CCM], 1, [CCM file support])
115
[if test "x$with_ccm" != "xcheck" ; then
116
AC_MSG_FAILURE([CCM support is requested, but test for CCM failed!])
118
AC_MSG_WARN([no CCM file support])
124
if test "x$cs_have_ccm" != "xyes"; then
128
CPPFLAGS="$saved_CPPFLAGS"
129
LDFLAGS="$saved_LDFLAGS"
138
AM_CONDITIONAL(HAVE_CCM, test x$cs_have_ccm = xyes)
140
AC_SUBST(cs_have_ccm)
141
AC_SUBST(CCM_CPPFLAGS)
142
AC_SUBST(CCM_LDFLAGS)