forked from alisw/yoda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
204 lines (172 loc) · 7.42 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
## Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([YODA],[1.7.0],[yoda@projects.hepforge.org],[YODA])
## Check and block installation into the src/build dir
if test "$prefix" = "$PWD"; then
AC_MSG_ERROR([Installation into the build directory is not supported: use a different --prefix argument])
fi
## Force default prefix to have a path value rather than NONE
if test "$prefix" = "NONE"; then
prefix=/usr/local
fi
AC_CONFIG_SRCDIR([src/Counter.cc])
AM_INIT_AUTOMAKE([subdir-objects -Wall dist-bzip2 1.10])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([include/YODA/Config/DummyConfig.h include/YODA/Config/YodaConfig.h include/YODA/Config/BuildConfig.h])
AC_DEFINE_UNQUOTED(YODA_VERSION, "$PACKAGE_VERSION", "YODA version string")
AC_DEFINE_UNQUOTED(YODA_NAME, "$PACKAGE_NAME", "YODA name string")
AC_DEFINE_UNQUOTED(YODA_STRING, "$PACKAGE_STRING", "YODA name and version string")
AC_DEFINE_UNQUOTED(YODA_TARNAME, "$PACKAGE_TARNAME", "YODA short name string")
AC_DEFINE_UNQUOTED(YODA_BUGREPORT, "$PACKAGE_BUGREPORT", "YODA contact email address")
## OS X
AC_CEDAR_OSX
## Set default compiler flags
if test "x$CXXFLAGS" = "x"; then CXXFLAGS="-O3"; fi
## Compiler setup
AC_LANG(C++)
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
AC_PROG_INSTALL
AC_PROG_LN_S
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
## Work out library suffix for the build
LIB_SUFFIX=\\\"$shrext_cmds\\\"
AC_SUBST([LIB_SUFFIX])
## Set default build flags
AC_CEDAR_CHECKCXXFLAG([-pedantic], [AM_CXXFLAGS="$AM_CXXFLAGS -pedantic"])
AC_CEDAR_CHECKCXXFLAG([-Wall], [AM_CXXFLAGS="$AM_CXXFLAGS -Wall -Wno-format"])
dnl AC_CEDAR_CHECKCXXFLAG([-std=c++98], [AM_CXXFLAGS="$AM_CXXFLAGS -std=c++98"])
dnl AC_CEDAR_CHECKCXXFLAG([-Wno-unused-variable], [AM_CXXFLAGS="$AM_CXXFLAGS -Wno-unused-variable"])
## Debug flag (default=none)
AC_ARG_ENABLE([debug], [AC_HELP_STRING(--enable-debug, [build with debugging symbols @<:@default=no@:>@])], [], [enable_debug=no])
if test x$enable_debug = xyes; then
[AM_CXXFLAGS="$AM_CXXFLAGS -g"]
fi
## Optional zlib support for gzip-compressed data streams/files
AX_CHECK_ZLIB
## Optional ROOT compatibility
AC_ARG_ENABLE([root], [AC_HELP_STRING(--disable-root,
[don't try to build YODA interface to PyROOT (needs root-config) @<:@default=yes@:>@])], [], [enable_root=yes])
if test "x$enable_root" = "xyes"; then
AC_PATH_PROG(ROOTCONFIG, [root-config])
if test "x$ROOTCONFIG" = "x"; then
AC_MSG_WARN([root-config not found -- not building extra ROOT compatibility tools])
enable_root=no;
else
AC_MSG_CHECKING([ROOT version])
ROOT_VERSION=`$ROOTCONFIG --version`
ROOT_MAJOR_VERSION=`echo $ROOT_VERSION | cut -d. -f1`
ROOT_MINOR_VERSION=`echo $ROOT_VERSION | cut -d. -f2 | cut -d/ -f1`
ROOT_MICRO_VERSION=`echo $ROOT_VERSION | cut -d. -f2 | cut -d/ -f2`
AC_MSG_RESULT([$ROOT_VERSION ($ROOT_MAJOR_VERSION,$ROOT_MINOR_VERSION,$ROOT_MICRO_VERSION)])
if test "$ROOT_MAJOR_VERSION" -lt 5; then
enable_root=no;
AC_MSG_WARN([ROOT major version is < 5 -- not building extra ROOT compatibility tools])
elif test "$ROOT_MAJOR_VERSION" -eq 5; then
if test "$ROOT_MINOR_VERSION" -lt 33; then
enable_root=no;
AC_MSG_WARN([ROOT version is less than 5.33 -- not building extra ROOT compatibility tools])
elif test "$ROOT_MINOR_VERSION" -eq 33 && test "$ROOT_MICRO_VERSION" -lt 2; then
enable_root=no;
AC_MSG_WARN([ROOT version is less than 5.33/02 -- not building extra ROOT compatibility tools])
fi
fi
# TODO: Test for existence of TPython, instance_from_void API, etc.
#AM_CXXFLAGS="$AM_CXXFLAGS -Wno-long-long"
ROOT_CXXFLAGS=`$ROOTCONFIG --cflags`
ROOT_LDFLAGS=`$ROOTCONFIG --ldflags`
ROOT_LIBS=`$ROOTCONFIG --libs`
AC_SUBST(ROOT_CXXFLAGS)
AC_SUBST(ROOT_LDFLAGS)
AC_SUBST(ROOT_LIBS)
fi
fi
AM_CONDITIONAL(ENABLE_ROOT, [test x$enable_root = xyes])
if test x$enable_root = xyes; then
AC_MSG_NOTICE([Building extra ROOT compatibility tools])
else
AC_MSG_NOTICE([Not building extra ROOT compatibility tools])
fi
## Python extension
AC_ARG_ENABLE(pyext, [AC_HELP_STRING(--disable-pyext,
[don't build Python module (default=build)])],
[], [enable_pyext=yes])
## Basic Python checks
if test x$enable_pyext = xyes; then
AX_PYTHON_DEVEL([>= '2.7.3'])
AC_SUBST(PYTHON_VERSION)
YODA_PYTHONPATH=`$PYTHON -c "from __future__ import print_function; import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(prefix='$prefix', plat_specific=True));"`
AC_SUBST(YODA_PYTHONPATH)
if test -z "$PYTHON"; then
AC_MSG_ERROR([Can't build Python extension since python can't be found])
enable_pyext=no
fi
if test -z "$PYTHON_CPPFLAGS"; then
AC_MSG_ERROR([Can't build Python extension since Python.h header file cannot be found])
enable_pyext=no
fi
fi
AM_CONDITIONAL(ENABLE_PYEXT, [test x$enable_pyext == xyes])
## Cython checks
if test x$enable_pyext == xyes; then
AM_CHECK_CYTHON([0.23.5], [:], [:])
if test x$CYTHON_FOUND = xyes; then
AC_MSG_NOTICE([Cython >= 0.23.5 found: Python extension source can be rebuilt (for developers)])
fi
AC_CHECK_FILE([pyext/yoda/core.cpp],
[],
[if test "x$CYTHON_FOUND" != "xyes"; then
AC_MSG_ERROR([Cython is required for --enable-pyext, no pre-built core.cpp was found.])
fi])
## Set extra Python extension build flags (to cope with Cython output code oddities)
PYEXT_CXXFLAGS=$CXXFLAGS
AC_CEDAR_CHECKCXXFLAG([-Wno-unused-but-set-variable], [PYEXT_CXXFLAGS="$PYEXT_CXXFLAGS -Wno-unused-but-set-variable"])
AC_CEDAR_CHECKCXXFLAG([-Wno-sign-compare], [PYEXT_CXXFLAGS="$PYEXT_CXXFLAGS -Wno-sign-compare"])
AC_CEDAR_CHECKCXXFLAG([-Wno-strict-prototypes], [PYEXT_CXXFLAGS="$PYEXT_CXXFLAGS -Wno-strict-prototypes"])
AC_SUBST(PYEXT_CXXFLAGS)
AC_MSG_NOTICE([All Python build checks successful: 'yoda' Python extension will be built])
fi
AM_CONDITIONAL(WITH_CYTHON, [test x$CYTHON_FOUND = xyes])
## Extend and substitute the default build flags after lib testing
AM_CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include"
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS)
dnl
dnl setup.py puts its build artifacts into a labelled path
dnl this helps the test scripts to find them locally instead of
dnl having to install first
dnl
YODA_SETUP_PY_PATH=$(${PYTHON} -c 'from __future__ import print_function; import distutils.util as u, sys; vi=sys.version_info; print("lib.%s-%s.%s" % (u.get_platform(),vi.major, vi.minor))')
AC_SUBST(YODA_SETUP_PY_PATH)
## Build Doxygen if possible
AC_PATH_PROG(DOXYGEN, doxygen)
AM_CONDITIONAL(WITH_DOXYGEN, test "$DOXYGEN")
## Build file output
AC_EMPTY_SUBST
AC_CONFIG_FILES([Makefile Doxyfile])
AC_CONFIG_FILES([include/Makefile include/YODA/Makefile])
AC_CONFIG_FILES([src/Makefile
src/tinyxml/Makefile
src/yamlcpp/Makefile
])
AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([pyext/Makefile
pyext/setup.py
pyext/yoda/Makefile
])
AC_CONFIG_FILES([bin/Makefile bin/yoda-config])
AC_CONFIG_FILES([yodaenv.sh yoda.pc])
AC_OUTPUT
if test x$enable_pyext == xyes; then
cat <<EOF
************************************************************
YODA CONFIGURED!
Now build and install (to the $prefix tree) with e.g.
make -j2 && make -j2 install
************************************************************
EOF
fi