-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
163 lines (138 loc) · 4.84 KB
/
configure.ac
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([HPCMetaMorpheus], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_MACRO_DIR(m4)
m4_include([config/compiler_checks.m4])
# Checks for programs.
AC_PROG_CXX
AC_PROG_MAKE_SET
SUBCONFIGURE_FLAGS="CXX=$CXX "
AC_MSG_CHECKING([if want developer-level debugging flags])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([Enable debug flags for compilation (default=yes)]))
if test "$enable_debug" = yes ; then
SUBCONFIGURE_FLAGS="$SUBCONFIGURE_FLAGS --enable-debug"
AC_MSG_RESULT([yes])
CXXFLAGS="-g -O0"
CFLAGS="-g -O0"
elif test "$enable_debug" = no ; then
SUBCONFIGURE_FLAGS="$SUBCONFIGURE_FLAGS --disable-debug"
AC_MSG_RESULT([no])
CXXFLAGS="-O3"
CFLAGS="-O3"
else
AC_MSG_RESULT([not set (implicit yes)])
CXXFLAGS="-g -O0"
CFLAGS="-g -O0"
fi
AC_LANG_PUSH([C++])
GET_CXX_COMPILER_VENDOR(compiler_vendor)
if test "$compiler_vendor" = "gnu" ; then
CXXFLAGS="$CXXFLAGS -Wno-delete-non-virtual-dtor -std=gnu++17"
elif test "$compiler_vendor" = "intel" ; then
CXXFLAGS="$CXXFLAGS -std=c++17"
fi
PROG_CXX_CXX17_HELPER([],[have_cxx17_support])
if test "x$have_cxx17_support" = xno ; then
AC_MSG_WARN([HPCMetaMorpheus requires a C++ 2017 (or newer) compiler.])
AC_MSG_ERROR([Aborting.])
fi
# Checks for libraries.
dnl ==================================================
AC_MSG_CHECKING(for HPCMetaMorpheus main directory)
AC_ARG_WITH(metamorpheus_dir,
[ --with-metamorpheus-dir=dir Main HPCMetaMorpheus directory (default=$PWD)],
mmorpheus_dir="${withval}", mmorpheus_dir="")
if test "x$mmorpheus_dir" = "x" ; then
mmorpheus_dir=$PWD
fi
AC_MSG_RESULT(${mmorpheus_dir})
AC_SUBST(mmorpheus_dir)
dnl ==================================================
AC_CHECK_HEADER([boost/math/special_functions/gamma.hpp],
[],
[AC_MSG_ERROR(Couldn't find boost math library)])
AC_CHECK_HEADER_STDBOOL
AC_LANG_POP([C++])
AC_LANG_PUSH([C])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([fesetround floor pow sqrt])
# Checks for header files.
AC_CHECK_HEADER([zlib.h],
[],
[AC_MSG_ERROR(Couldn't find zlib.h)])
AC_CHECK_HEADER([math.h],
[],
[AC_MSG_ERROR(Couldn't find math.h)])
AC_LANG_POP([C])
AC_LANG_PUSH([C++])
dnl ==================================================
AC_MSG_CHECKING(for xsdcxx)
AC_ARG_WITH(xsdcxx_dir,
[ --with-xsdcxx-dir=dir xsdcxx directory (default=/usr/include)],
xsdcxx_dir="${withval}", xsdcxx_dir="")
if test "x$xsdcxx_dir" = "x" ; then
xsdcxx_dir=/usr/include
else
SUBCONFIGURE_FLAGS="$SUBCONFIGURE_FLAGS --with-xsdcxx-dir=${withval}"
fi
AC_MSG_RESULT(${xsdcxx_dir})
save_CXXFLAGS="$CXXFLAGS"
save_CPPFLAGS="$CPPFLAGS"
CXXFLAGS="$save_CXXFLAGS -I$xsdcxx_dir"
CPPFLAGS="$save_CPPFLAGS -I$xsdcxx_dir"
AC_CHECK_HEADER([xsd/cxx/config.hxx],
[],
[AC_MSG_ERROR(Couldn't find xsd/cxx/config.hxx)])
CXXFLAGS="$save_CXXFLAGS"
CPPFLAGS="$save_CPPFLAGS"
AC_SUBST(xsdcxx_dir)
dnl ==================================================
AX_XERCESC
dnl ==================================================
AC_MSG_CHECKING(for libxml2)
AC_ARG_WITH(libxml2_dir,
[ --with-libxml2-dir=dir libxml2 directory (default=/usr/include/libxml2/)],
libxml2_dir="${withval}", libxml2_dir="")
if test "x$libxml2_dir" = "x" ; then
libxml2_dir=/usr/include/libxml2
else
SUBCONFIGURE_FLAGS="$SUBCONFIGURE_FLAGS --with-libxml2-dir=${withval}"
fi
AC_MSG_RESULT(${libxml2_dir})
save_CXXFLAGS="$CXXFLAGS"
save_CPPFLAGS="$CPPFLAGS"
CXXFLAGS="$save_CXXFLAGS -I$libxml2_dir"
CPPFLAGS="$save_CPPFLAGS -I$libxml2_dir"
AC_CHECK_HEADER([libxml/xmlreader.h],
[],
[AC_MSG_ERROR(Couldn't find libxml/xmlreader.h)])
CXXFLAGS="$save_CXXFLAGS"
CPPFLAGS="$save_CPPFLAGS"
AC_SUBST(libxml2_dir)
dnl ==================================================
echo " "
AC_MSG_NOTICE(creating final output files)
#AC_CONFIG_FILES([Makefile.defs])
AC_SUBST(CXX)
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_OUTPUT(Makefile.defs)
dnl ==================================================
dnl configure mzlib subdirectory
echo " "
mzlib_dir="$mmorpheus_dir/mzlib"
mmorpheus_lib_dir="$mmorpheus_dir/lib"
AC_MSG_NOTICE(running configure in mzlib directory in $mzlib_dir )
SUBCONFIGURE_FLAGS="$SUBCONFIGURE_FLAGS --with-mzlib-dir=$mzlib_dir --with-mzlib-lib-dir=$mmorpheus_lib_dir"
eval cd ./mzlib && ./configure $SUBCONFIGURE_FLAGS && cd -
dnl done configuring mzlib
dnl ==================================================