-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfigure.ac
208 lines (176 loc) · 7.64 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
205
206
207
208
## Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([LHAPDF],[6.5.2],[lhapdf-support@cern.ch],[LHAPDF])
if test "$prefix" = "$PWD"; then
AC_MSG_ERROR([Installation into the build directory is not supported: use a different --prefix argument])
fi
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE()
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
## Library version flags (at least update the version comment with each new release version)
AC_DEFINE_UNQUOTED(LHAPDF_VERSION, "$PACKAGE_VERSION", "LHAPDF version string")
# TODO: improve this sed'ing so that it'll work with version digits > 9
#PACKAGE_VERSION_CODE=[`echo $PACKAGE_VERSION | sed -e 's/\./0/g' -e 's/\([0-9]\+\).*/\1/'`] # sed \+ doesn't work on OS X!
PACKAGE_VERSION_CODE=[`echo $PACKAGE_VERSION | sed -e 's/\./0/g' -e 's/\([0-9]*\).*/\1/'`]
PACKAGE_MAJOR_VERSION=[`echo $PACKAGE_VERSION | sed -e 's/^\(.\..\).*/\1/'`]
AC_DEFINE_UNQUOTED(LHAPDF_VERSION_CODE, $PACKAGE_VERSION_CODE, "LHAPDF version as an int")
## Mac OS X compatibility
AC_CHECK_TOOL(SWVERS, sw_vers)
if test x$SWVERS != x; then
PROD_NAME=$($SWVERS -productName | cut -f 2 -d:)
fi
AM_CONDITIONAL(WITH_OSX, [test "$PROD_NAME" == "Mac OS X"])
if test "$PROD_NAME" == "Mac OS X"; then
MACOSX_DEPLOYMENT_TARGET=$($SWVERS -productVersion | cut -f 1,2 -d.)
AC_MSG_NOTICE([MACOSX_DEPLOYMENT_TARGET = $MACOSX_DEPLOYMENT_TARGET])
AM_CXXFLAGS="$AM_CXXFLAGS -Dunix"
AM_CXXFLAGS="$AM_CXXFLAGS -flat_namespace"
fi
## Checks and config headers
AC_LANG(C++)
AC_CONFIG_SRCDIR([src/GridPDF.cc])
AC_CONFIG_HEADERS([config/config.h include/LHAPDF/Version.h])
## Set default C++ optimisation level to -O3 and drop the -g debug flag
if test -z $CXXFLAGS; then
CXXFLAGS='-O3'
fi
## MPI support wanted?
AC_ARG_ENABLE([mpi],
AC_HELP_STRING([--enable-mpi], [enable MPI-safe file reading]),
[enable_mpi=yes], [])
## Test for C++ compiler, possibly with MPI support
AX_PROG_CXX_MPI([test x$enable_mpi = xyes], [have_mpi=yes], [have_mpi=no])
if test x$enable_mpi = xyes; then
if test x$have_mpi = xyes; then
AC_DEFINE([HAVE_MPI], "1", [using MPI])
using_mpi=yes
else
AC_MSG_FAILURE([MPI compiler not found.])
using_mpi=no
fi
fi
AM_CONDITIONAL(USING_MPI, [test x$using_mpi = xyes])
## Require C++11
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
## Substitute compiler flags for the lhapdf-config script
LHAPDF_CXX="$CXX"
AC_SUBST(LHAPDF_CXX)
LHAPDF_CXXFLAGS="$CXXFLAGS"
AC_SUBST(LHAPDF_CXXFLAGS)
## More standard build tool checks
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_LIBTOOL
## Enable LHAGLUE compatibility fns for Fortran and the old C++ interface
AC_ARG_ENABLE([lhaglue],
[AC_HELP_STRING(--disable-lhaglue, [build without LHAPDF5 compatibility routines])],
[], [enable_lhaglue=yes])
AC_ARG_ENABLE([lhaglue-cxx],
[AC_HELP_STRING(--disable-lhaglue-cxx, [build without LHAPDF5 C++ compatibility routines])],
[], [enable_lhaglue_cxx=yes])
if test x$enable_lhaglue == xyes; then
AC_MSG_NOTICE(Building LHAGLUE Fortran wrappers)
if test x$enable_lhaglue_cxx == xyes; then
AC_MSG_NOTICE(Building LHAGLUE C++ wrappers)
else
AC_MSG_NOTICE(Not building LHAGLUE C++ wrappers)
fi
else
AC_MSG_NOTICE(Not building LHAGLUE wrappers)
fi
AM_CONDITIONAL(ENABLE_LHAGLUE, [test x$enable_lhaglue == xyes])
if test x$enable_lhaglue == xyes; then flag=1; else flag=0; fi
AC_DEFINE_UNQUOTED(LHAPDF_PDFLIB, $flag, "Whether PDFLIB Fortran compatibility is available")
AM_CONDITIONAL(ENABLE_LHAGLUE_CXX, [test x$enable_lhaglue_cxx == xyes])
if test x$enable_lhaglue_cxx == xyes; then flag=1; else flag=0; fi
AC_DEFINE_UNQUOTED(LHAPDF_LHA5CXX, $flag, "Whether LHAPDF5 C++ compatibility is available")
## Find Doxygen if possible
AC_PATH_PROG(DOXYGEN, doxygen)
AM_CONDITIONAL(WITH_DOXYGEN, [test x$DOXYGEN != x])
## Find Python and Cython if possible
AC_ARG_ENABLE([python],
[AC_HELP_STRING(--disable-python, [disable the build of the Python interface (default=enabled)])],
[], [enable_python=yes])
if test x$enable_python == xyes; then
AX_PYTHON_DEVEL([>= '2.7.3'])
if test x$PYTHON != x; then
PYTHON_VERSION=`$PYTHON -c "import sys; print('.'.join(map(str, sys.version_info@<:@:2@:>@)))"`
PYTHON_FULL_VERSION=`$PYTHON -c 'from __future__ import print_function; import platform; print(platform.python_version())'`
PYTHON_MAJOR_VERSION=`$PYTHON -c 'from __future__ import print_function; import sys; print(sys.version_info.major)'`
AC_SUBST(PYTHON_VERSION)
AC_SUBST(PYTHON_FULL_VERSION)
AC_SUBST(PYTHON_MAJOR_VERSION)
PYTHON_PATH=`$PYTHON -c "from __future__ import print_function; import sysconfig; print(sysconfig.get_path('platlib', 'posix_user', vars={'userbase' : '$prefix'}))"`
AC_SUBST(PYTHON_PATH)
AC_MSG_NOTICE([LHAPDF Python library to be installed to $PYTHON_PATH])
fi
AM_CHECK_CYTHON([0.24], [:], [:])
if test x$CYTHON_FOUND = xyes; then
AC_MSG_NOTICE([Cython >= 0.24 found: Python extension source can be rebuilt (for developers)])
for i in wrappers/python/*.pyx; do touch $i; done
fi
fi
AM_CONDITIONAL(WITH_PYTHON, [test x$PYTHON != x])
AM_CONDITIONAL(WITH_CYTHON, [test x$CYTHON_FOUND = xyes])
dnl ## Build Octave interface if possible
dnl AC_ARG_ENABLE([octave],
dnl [AC_HELP_STRING(--disable-octave, [don't try to make Octave interface])],
dnl [], [enable_octave=yes])
dnl if test x$enable_octave == xyes; then
dnl AC_PATH_PROG(OCTAVE, octave)
dnl AC_PATH_PROG(MKOCTFILE, mkoctfile)
dnl fi
dnl AM_CONDITIONAL(WITH_OCTAVE, [test x$OCTAVE != x && test x$MKOCTFILE != x])
## Set base compiler flags
AC_CEDAR_CHECKCXXFLAG([-pedantic], [AM_CXXFLAGS="$AM_CXXFLAGS -pedantic "])
AC_CEDAR_CHECKCXXFLAG([-Wall], [AM_CXXFLAGS="$AM_CXXFLAGS -Wall "])
AC_CEDAR_CHECKCXXFLAG([-Wno-long-long], [AM_CXXFLAGS="$AM_CXXFLAGS -Wno-long-long "])
AC_CEDAR_CHECKCXXFLAG([-Qunused-arguments], [AM_CPPFLAGS="$AM_CPPFLAGS -Qunused-arguments "])
AC_CEDAR_CHECKCXXFLAG([-Wshadow], [AM_CPPFLAGS="$AM_CPPFLAGS -Wshadow "])
## Include $prefix in the compiler flags for the rest of the configure run
if test x$prefix != xNONE; then
CPPFLAGS="$CPPFLAGS -I$prefix/include"
LDFLAGS="$LDFLAGS -L$prefix/lib"
fi
## Export base compiler flags
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS)
AC_SUBST(AM_LDFLAGS)
## Output
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/yamlcpp/Makefile])
AC_CONFIG_FILES([include/Makefile include/LHAPDF/Makefile])
AC_CONFIG_FILES([bin/Makefile])
AC_CONFIG_FILES([bin/lhapdf-config])
AC_CONFIG_FILES([examples/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([doc/Makefile doc/Doxyfile])
AC_CONFIG_FILES([lhapdf.pc])
AC_CONFIG_FILES([wrappers/Makefile])
AC_CONFIG_FILES([wrappers/python/Makefile wrappers/python/build.py])
dnl AC_CONFIG_FILES([wrappers/octave/Makefile])
AC_OUTPUT
## Message about getting PDF sets
pkgdatadir=`eval "echo $datarootdir/$PACKAGE_TARNAME"`
echo
echo "****************************************************************"
echo "IMPORTANT INFORMATION ABOUT PDF SETS"
echo
echo "LHAPDF no longer bundles PDF set data in the package tarball."
echo "The sets are instead all stored online at"
echo " http://lhapdfsets.web.cern.ch/lhapdfsets/current/"
echo "and you should install those that you wish to use into"
echo " $pkgdatadir"
echo
echo "The downloadable PDF sets are packaged as tarballs, which"
echo "must be expanded to be used. The simplest way to do this is with"
echo "the 'lhapdf' script, e.g. to install the CT10nlo PDF set:"
echo " lhapdf install CT10nlo"
echo "The same effect can be achieved manually with, e.g.:"
echo " wget http://lhapdfsets.web.cern.ch/lhapdfsets/current/CT10nlo.tar.gz -O- | tar xz -C $pkgdatadir"
echo
echo "****************************************************************"
echo