1# -------------------------------------------------------------
2# fparser
3# -------------------------------------------------------------
4AC_DEFUN([CONFIGURE_FPARSER],
5[
6  AC_ARG_ENABLE([fparser],
7                AS_HELP_STRING([--disable-fparser],
8                               [build without C++ function parser support]),
9                [AS_CASE("${enableval}",
10                         [yes], [enablefparser=yes],
11                         [no],  [enablefparser=no],
12                         [AC_MSG_ERROR(bad value ${enableval} for --enable-fparser)])],
13                [enablefparser=$enableoptional])
14
15  AC_ARG_WITH([fparser],
16               AS_HELP_STRING([--with-fparser=<release|none|devel>],
17                              [Determine which version of the C++ function parser to use]),
18               [AS_CASE("${withval}",
19                        [release], [enablefparserdevel=no],
20                        [devel],   [enablefparserdevel=yes],
21                        [none],    [enablefparser=no],
22                        [AC_MSG_ERROR(bad value ${withval} for --with-fparser)])],
23               [enablefparserdevel=no])
24
25
26  AS_IF([test "x$enablefparser" = "xyes"],
27        [
28          AC_ARG_ENABLE(fparser-debugging,
29                        AS_HELP_STRING([--enable-fparser-debugging],
30                                       [Build fparser with bytecode debugging functions]),
31                        [AS_CASE("${enableval}",
32                                 [yes], [enablefparserdebugging=yes],
33                                 [no],  [enablefparserdebugging=no],
34                                 [AC_MSG_ERROR(bad value ${enableval} for --enable-fparser-debugging)])],
35                        [enablefparserdebugging=no])
36
37          dnl The FPARSER API is distributed with libmesh, so we don't have to guess
38          dnl where it might be installed...
39          AC_PROG_MKDIR_P
40          AC_PROG_SED
41          AC_PROG_YACC
42
43          FPARSER_INCLUDE="-I\$(top_srcdir)/contrib/fparser"
44          FPARSER_LIBRARY="\$(EXTERNAL_LIBDIR)/libfparser\$(libext)"
45          AC_DEFINE(HAVE_FPARSER, 1, [Flag indicating whether the library will be compiled with FPARSER support])
46
47          AS_IF([test "x$enablefparserdevel" = "xyes"],
48                [
49                  AC_DEFINE(HAVE_FPARSER_DEVEL, 1, [Flag indicating whether FPARSER will build the full development version])
50                  AC_MSG_RESULT(<<< Configuring library with fparser support (development version) >>>)
51                ],
52                [
53                  AC_DEFINE(HAVE_FPARSER_DEVEL, 0, [Flag indicating whether FPARSER will build the full development version])
54                  AC_MSG_RESULT(<<< Configuring library with fparser support (release version) >>>)
55                ])
56
57          dnl According to the autoconf docs, "the third argument must have no
58          dnl side effects except for setting the variable cache-id"
59          AC_CACHE_CHECK([for dlopen support], [ac_cv_cxx_dlopen], AX_CXX_DLOPEN)
60
61          dnl JIT requires dlopen, use the result of the AX_CXX_DLOPEN test.
62          AS_IF([test "x$ac_cv_cxx_dlopen" = "xyes"],
63                [
64                  AC_DEFINE(HAVE_FPARSER_JIT, 1, [Flag indicating whether FPARSER will be built with JIT compilation enabled])
65                  AC_MSG_RESULT(<<< Configuring library with fparser JIT compilation support >>>)
66                  enablefparserjit=yes
67                ],
68                [
69                  AC_MSG_RESULT(<<< dlopen() not found, configuring library without fparser JIT compilation support >>>)
70                  enablefparserjit=no
71                ])
72
73          dnl This define in libmesh_config.h is used internally in fparser.hh and various source files
74          AS_IF([test "x$enablefparserdebugging" = "xyes"],
75                [
76                  AC_DEFINE(FPARSER_SUPPORT_DEBUGGING, 1, [Enable fparser debugging functions])
77                  AC_MSG_RESULT(<<< Configuring library with fparser debugging functions >>>)
78                ])
79        ],
80        [
81          FPARSER_INCLUDE=""
82          FPARSER_LIBRARY=""
83          enablefparser=no
84        ])
85
86  AC_SUBST(FPARSER_INCLUDE)
87  AC_SUBST(FPARSER_LIBRARY)
88
89  AM_CONDITIONAL(FPARSER_RELEASE,              test x$enablefparserdevel = xno)
90  AM_CONDITIONAL(FPARSER_DEVEL,                test x$enablefparserdevel = xyes)
91  AM_CONDITIONAL(FPARSER_SUPPORT_DEBUGGING,    test x$enablefparserdebugging = xyes)
92  AM_CONDITIONAL(FPARSER_SUPPORT_JIT,    test x$enablefparserjit = xyes)
93  dnl Turn on the -Wno_psabi flag when compiling with GCC to avoid warning:
94  dnl "the ABI of passing structure with complex float member has changed in GCC 4.4"
95  AM_CONDITIONAL(FPARSER_NO_PSABI, test "$GXX" = "yes" && test "x$REAL_GXX" != "x")
96])
97