~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to m4/cs_ccm.m4

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-01 17:43:32 UTC
  • mto: (6.1.7 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20111101174332-tl4vk45no0x3emc3
Tags: upstream-2.1.0
ImportĀ upstreamĀ versionĀ 2.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl--------------------------------------------------------------------------------
 
2
dnl
 
3
dnl This file is part of Code_Saturne, a general-purpose CFD tool.
 
4
dnl
 
5
dnl Copyright (C) 1998-2011 EDF S.A.
 
6
dnl
 
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
 
10
dnl version.
 
11
dnl
 
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
 
15
dnl details.
 
16
dnl
 
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.
 
20
dnl
 
21
dnl--------------------------------------------------------------------------------
 
22
 
 
23
# CS_AC_TEST_CCM
 
24
#---------------
 
25
# modifies or sets cs_have_ccm, CCM_CPPFLAGS, CCM_LDFLAGS, and CCM_LIBS
 
26
# depending on libraries found
 
27
 
 
28
AC_DEFUN([CS_AC_TEST_CCM], [
 
29
 
 
30
cs_have_ccm=no
 
31
cs_have_ccm_headers=no
 
32
 
 
33
AC_ARG_WITH(ccm,
 
34
            [AS_HELP_STRING([--with-ccm=DIR],
 
35
                            [specify prefix directory for CCMIO])],
 
36
            [if test "x$withval" = "x"; then
 
37
               with_ccm=yes
 
38
             fi],
 
39
            [with_ccm=check])
 
40
 
 
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
 
45
               with_ccm=yes
 
46
             fi
 
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"
 
51
             fi])
 
52
 
 
53
AC_ARG_WITH(ccm-lib,
 
54
            [AS_HELP_STRING([--with-ccm-lib=DIR],
 
55
                            [specify directory for CCMIO library])],
 
56
            [if test "x$with_ccm" = "xcheck"; then
 
57
               with_ccm=yes
 
58
             fi
 
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"
 
67
             fi])
 
68
 
 
69
# ADF may be provided directly (patched ADF with libccmio)
 
70
# or through CGNS
 
71
 
 
72
if test "x$with_ccm" != "xno" -a "x$cs_have_adf" = "xno" -a "x$cs_have_cgns" = "xno"
 
73
then
 
74
  if test "x$with_ccm" = "xcheck"; then
 
75
    with_ccm=no
 
76
    AC_MSG_WARN([no ADF library found; will not search for CCM])
 
77
  else
 
78
    AC_MSG_ERROR([no ADF library found; required for CCM])
 
79
  fi
 
80
fi
 
81
 
 
82
if test "x$with_ccm" != "xno" ; then
 
83
 
 
84
  saved_CPPFLAGS="$CPPFLAGS"
 
85
  saved_LDFLAGS="$LDFLAGS"
 
86
  saved_LIBS="$LIBS"
 
87
 
 
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
 
93
    CCM_LIBS="-lccmio"
 
94
    CPPFLAGS="${CPPFLAGS} ${CCM_CPPFLAGS}"
 
95
    LDFLAGS="${LDFLAGS} ${CCM_LDFLAGS} $CGNS_LDFLAGS $HDF5_LDFLAGS"
 
96
  fi
 
97
  LIBS="${LIBS} ${CCM_LIBS} $CGNS_LIBS $HDF5_LIBS"
 
98
 
 
99
# Check that CCMIO header files exist
 
100
 
 
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
 
106
                    ],
 
107
                    [AC_MSG_RESULT([CCMIO headers not found])
 
108
                    ])
 
109
 
 
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])
 
113
                   cs_have_ccm=yes
 
114
                 ], 
 
115
                 [if test "x$with_ccm" != "xcheck" ; then
 
116
                    AC_MSG_FAILURE([CCM support is requested, but test for CCM failed!])
 
117
                  else
 
118
                    AC_MSG_WARN([no CCM file support])
 
119
                  fi
 
120
                 ],
 
121
                 )
 
122
  fi
 
123
 
 
124
  if test "x$cs_have_ccm" != "xyes"; then
 
125
    CCM_LIBS=""
 
126
  fi
 
127
 
 
128
  CPPFLAGS="$saved_CPPFLAGS"
 
129
  LDFLAGS="$saved_LDFLAGS"
 
130
  LIBS="$saved_LIBS"
 
131
 
 
132
  unset saved_CPPFLAGS
 
133
  unset saved_LDFLAGS
 
134
  unset saved_LIBS
 
135
 
 
136
fi
 
137
 
 
138
AM_CONDITIONAL(HAVE_CCM, test x$cs_have_ccm = xyes)
 
139
 
 
140
AC_SUBST(cs_have_ccm)
 
141
AC_SUBST(CCM_CPPFLAGS)
 
142
AC_SUBST(CCM_LDFLAGS)
 
143
AC_SUBST(CCM_LIBS)
 
144
AC_SUBST(CCMRUNPATH)
 
145
 
 
146
])dnl
 
147