File: cs_ple.m4

package info (click to toggle)
code-saturne 4.3.3+repack-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 77,992 kB
  • sloc: ansic: 281,257; f90: 122,305; python: 56,490; makefile: 3,915; xml: 3,285; cpp: 3,183; sh: 1,139; lex: 176; yacc: 101; sed: 16
file content (186 lines) | stat: -rw-r--r-- 6,415 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
dnl--------------------------------------------------------------------------------
dnl
dnl This file is part of Code_Saturne, a general-purpose CFD tool.
dnl
dnl Copyright (C) 1998-2016 EDF S.A.
dnl
dnl This program is free software; you can redistribute it and/or modify it under
dnl the terms of the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any later
dnl version.
dnl
dnl This program is distributed in the hope that it will be useful, but WITHOUT
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dnl FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
dnl details.
dnl
dnl You should have received a copy of the GNU General Public License along with
dnl this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
dnl Street, Fifth Floor, Boston, MA 02110-1301, USA.
dnl
dnl--------------------------------------------------------------------------------

# CS_AC_TEST_PLE(Minimal Release string, [Maximal Release string])
#-----------------------------------------------------------------
# Check for PLE version ; defines PLE_CPPFLAGS, PLE_LDFLAGS, and PLE_LIBS
# locally (i.e. as simple variables, not AC_SUBST)

AC_DEFUN([CS_AC_TEST_PLE], [

cs_have_internal_ple=yes

AC_ARG_WITH(ple,
            [AS_HELP_STRING([--with-ple=PATH],
                            [specify prefix directory for PLE])],
            [if test "x$withval" = "x"; then
               with_ple=yes
             fi],
            [with_ple=no])

AC_ARG_WITH(ple-exec,
            [AS_HELP_STRING([--with-ple-exec=PATH],
                            [specify directory for PLE executables])],
            [ple_config="$with_ple_exec/ple-config"],
            [if test "x$with_ple" != "xyes"; then
               ple_config="$with_ple/bin/ple-config"
             else
               ple_config="ple-config"
             fi])

AC_ARG_WITH(ple-include,
            [AS_HELP_STRING([--with-ple-include=PATH],
                            [specify directory for PLE include files])],
            [PLE_CPPFLAGS="-I$with_ple_include"],
            [if test "x$with_ple" != "xno" -a "x$with_ple" != "xyes"; then
               PLE_CPPFLAGS="-I$with_ple/include"
             fi])

AC_ARG_WITH(ple-lib,
            [AS_HELP_STRING([--with-ple-lib=PATH],
                            [specify directory for PLE library])],
            [PLE_LDFLAGS="-L$with_ple_lib"],
            [if test "x$with_ple" != "xno" -a "x$with_ple" != "xyes"; then
               PLE_LDFLAGS="-L$with_ple/lib"
             fi])

AC_ARG_WITH(ple-doc,
            [AS_HELP_STRING([--with-ple-doc=PATH],
                            [specify directory for PLE documentation])],
            [ple_docdir="$with_ple_doc"],
            [if test "x$with_ple" = "xno" ; then
               ple_docdir="$datarootdir/doc/ple"
             elif test "x$with_ple" != "xyes"; then
               ple_docdir="$with_ple/share/doc/ple"
             fi])

PLE_LIBS="-lple"

if test "x$with_ple" != "xno" ; then

  type "$ple_config" > /dev/null 2>&1
  if test "$?" = "0" ; then
    PLE_CPPFLAGS="$PLE_CPPFLAGS `$ple_config --cppflags`"
    PLE_LDFLAGS="$PLE_LDFLAGS `$ple_config --ldflags`"
    PLE_LIBS="$PLE_LIBS `$ple_config --libs`"
    PLE_MPI_LDFLAGS="`$ple_config --ldflags mpi`"
    PLE_MPI_LIBS="`$ple_config --libs mpi`"
  fi

  ple_version_min=$1
  ple_version_max=$2

  if test "x$ple_version_min" != "x" ; then
    if test "x$ple_version_max" != "x" ; then
      AC_MSG_CHECKING([for ple version >= $1 and <= $2])
    else
      AC_MSG_CHECKING([for ple version >= $1])
    fi
  else
    ple_version_min="0.0.0"
  fi

  ple_version_major_min=`echo "$ple_version_min" | cut -f1 -d.`
  ple_version_minor_min=`echo "$ple_version_min" | cut -f2 -d.`
  ple_version_release_min=`echo "$ple_version_min" | cut -f3 -d.`
  if test    "$ple_version_major_min" = "" \
          -o "$ple_version_minor_min" = "" \
          -o "$ple_version_release_min" = ""; then
    AC_MSG_FAILURE([bad PLE version definition in configure.ac: $ple_version_min])
  fi

  if test "x$ple_version_max" != "x" ; then
    ple_version_major_max=`echo "$ple_version_max" | cut -f1 -d.`
    ple_version_minor_max=`echo "$ple_version_max" | cut -f2 -d.`
    ple_version_release_max=`echo "$ple_version_max" | cut -f3 -d.`
    if test    "$ple_version_major_max" = "" \
            -o "$ple_version_minor_max" = "" \
            -o "$ple_version_release_max" = ""; then
      AC_MSG_FAILURE([bad PLE version definition in configure.ac: $ple_version_max])
    fi
  else
    ple_version_major_max=99999999
    ple_version_minor_max=99999999
    ple_version_release_max=99999999
  fi

  saved_CPPFLAGS=$CPPFLAGS
  saved_LDFLAGS=$LDFLAGS
  saved_LIBS=$LIBS

  CPPFLAGS="${CPPFLAGS} $PLE_CPPFLAGS"
  LDFLAGS="$PLE_LDFLAGS $PLE_MPI_LDFLAGS ${LDFLAGS}"
  LIBS="$PLE_LIBS $PLE_MPI_LIBS ${LIBS}"

  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ple_config.h>
  ]],
  [[#if PLE_MAJOR_VERSION < $ple_version_major_min
#  error PLE major version < $ple_version_major_min
#elif PLE_MAJOR_VERSION == $ple_version_major_min
#  if PLE_MINOR_VERSION < $ple_version_minor_min
#    error PLE minor version < $ple_version_minor_min
#  elif PLE_MINOR_VERSION == $ple_version_minor_min
#    if PLE_RELEASE_VERSION < $ple_version_release_min
#      error PLE release version < $ple_version_release_min
#    endif
#  endif
#endif
#if PLE_MAJOR_VERSION > $ple_version_major_max
#  error PLE major version > $ple_version_major_max
#elif PLE_MAJOR_VERSION == $ple_version_major_max
#  if PLE_MINOR_VERSION > $ple_version_minor_max
#    error PLE minor version > $ple_version_minor_max
#  elif PLE_MINOR_VERSION == $ple_version_minor_max
#    if PLE_RELEASE_VERSION > $ple_version_release_max
#      error PLE release version < $ple_version_release_max
#    endif
#  endif
#endif
  ]])],
                 [cs_have_internal_ple=no
                  AC_MSG_RESULT([using external PLE library])],
                 [AC_MSG_RESULT([external PLE library not found, using internal])])

  CPPFLAGS=$saved_CPPFLAGS
  LDFLAGS=$saved_LDFLAGS
  LIBS=$saved_LIBS

  unset saved_CPPFLAGS
  unset saved_LDFLAGS
  unset saved_LIBS

  ple_type="external"

else

  ple_type="internal"

fi

AC_SUBST(ple_type)
AC_SUBST(ple_docdir)
AC_SUBST(PLE_CPPFLAGS)
AC_SUBST(PLE_LDFLAGS)
AC_SUBST(PLE_LIBS)

])dnl