configure.ac 8.01 KB
Newer Older
Adam Mercer's avatar
Adam Mercer committed
1
AC_PREREQ([2.63])
2
AC_INIT([lalinference],[1.1.0.1],[lal-discuss@gravity.phys.uwm.edu])
3
AC_CONFIG_HEADERS([include/config.h src/LALInferenceConfig.h])
4
5
6
7
8
9
10
11
12
13
14
15
AC_CONFIG_SRCDIR([src/LALInference.h])
AC_CONFIG_AUX_DIR([gnuscripts])
AC_CONFIG_MACRO_DIR([gnuscripts])
AC_CONFIG_FILES([ \
  lalinference.spec \
  lalinference.pc \
  Makefile \
  gnuscripts/Makefile \
  debian/Makefile \
  include/Makefile \
  include/lal/Makefile \
  src/Makefile \
16
17
  python/Makefile \
  python/__init__.py \
18
  python/bayestar/Makefile \
19
20
21
  swig/Makefile \
  swig/octave/Makefile \
  swig/python/Makefile \
22
23
  test/Makefile
])
24
AM_INIT_AUTOMAKE([1.11 foreign color-tests parallel-tests])
25
26
27

AC_CANONICAL_HOST

28
LALSUITE_ARG_VAR
29
LALSUITE_DISTCHECK_CONFIGURE_FLAGS
30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
# set library api info
# 1. start with version information of "0:0:0" for each libtool library
# 2. update the version information only immediately before a public
#    release of your software. More frequent updates are unnecessary,
#    and only guarantee that the current interface number gets larger
#    faster.
# 3. if the library source code has changed at all since the last
#    update, then increment revision ("c:r:a" becomes "c:r+1:a").
# 4. if any interfaces have been added, removed, or changed since the
#    last update, increment current, and set revision to 0.
# 5. if any interfaces have been added since the last public release,
#    then increment age.
# 6. if any interfaces have been removed since the last public release,
#    then set age to 0.
45
46
47
AC_SUBST([LIBCURRENT],[5])
AC_SUBST([LIBREVISION],[0])
AC_SUBST([LIBAGE],[0])
48
49
AC_SUBST([LIBVERSION],[${LIBCURRENT}:${LIBREVISION}:${LIBAGE}])

50
51
52
# check for git repo
LALSUITE_CHECK_GIT_REPO

53
54
55
# nightly build
LALSUITE_ENABLE_NIGHTLY

Adam Mercer's avatar
Adam Mercer committed
56
57
58
# debug
LALSUITE_ENABLE_DEBUG

59
60
61
62
63
64
65
66
67
68
# enable strict gcc flags
LALSUITE_ENABLE_GCC_FLAGS

# optional lal libraries
LALSUITE_ENABLE_LALFRAME
LALSUITE_ENABLE_LALMETAIO
LALSUITE_ENABLE_LALINSPIRAL
LALSUITE_ENABLE_LALPULSAR
LALSUITE_ENABLE_LALXML

69
70
71
# enable SWIG wrapping modules
LALSUITE_ENABLE_SWIG

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# put version/configure info in config header
lalinference_version_major=`echo "$VERSION" | cut -d. -f1`
lalinference_version_minor=`echo "$VERSION" | cut -d. -f2`
lalinference_version_micro=`echo "$VERSION" | cut -d. -f3`
lalinference_version_devel=`echo "$VERSION" | cut -d. -f4-`
test -z "$lalinference_version_micro" && lalinference_version_micro=0
test -z "$lalinference_version_devel" && lalinference_version_devel=0
lalinspiral_configure_date=`date +"%Y-%m-%dT%H:%M:%S%z"`
AC_DEFINE_UNQUOTED([LALINFERENCE_VERSION],["$VERSION"],[LALInference Version])
AC_DEFINE_UNQUOTED([LALINFERENCE_VERSION_MAJOR],[$lalinference_version_major],
                   [LALInference Version Major Number])
AC_DEFINE_UNQUOTED([LALINFERENCE_VERSION_MINOR],[$lalinference_version_minor],
                   [LALInference Version Minor Number])
AC_DEFINE_UNQUOTED([LALINFERENCE_VERSION_MICRO],[$lalinference_version_micro],
                   [LALInference Version Micro Number])
AC_DEFINE_UNQUOTED([LALINFERENCE_VERSION_DEVEL],[$lalinference_version_devel],
                   [LALInference Version Devel Number])
AC_DEFINE_UNQUOTED([LALINFERENCE_CONFIGURE_ARGS],["$ac_configure_args"],
                   [LALInference Configure Arguments])
AC_DEFINE_UNQUOTED([LALINFERENCE_CONFIGURE_DATE],["$lalinspiral_configure_date"],
                   [LALInference Configure Date])

94
95
96
# workaround broken libtool multilib support on sl6
LALSUITE_MULTILIB_LIBTOOL_HACK

97
98
# use silent build rules
AM_SILENT_RULES([yes])
99

100
101
# check for C/C++ compilers
LALSUITE_PROG_CC_CXX
102

103
104
105
# checks for programs
AC_PROG_INSTALL
AC_PROG_LN_S
106
AC_PROG_AWK
107
AC_PROG_SED
Adam Mercer's avatar
Adam Mercer committed
108
AM_PATH_PYTHON([2.6],,[AC_MSG_ERROR([Python-2.6, or higher, is required])])
109
AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != :])
110
111
112
113
114
115
116
117
118
119
120
121
122

# check for supported mac os x version
LALSUITE_OSX_VERSION_CHECK

# link tests using libtool
LALSUITE_USE_LIBTOOL

# check for header files
AC_HEADER_STDC

# check for required libraries
AC_CHECK_LIB([m],[main],,[AC_MSG_ERROR([could not find the math library])])

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# check for OpenMP
AC_OPENMP

# check that compiler supports C99 variable length arrays in OpenMP for loops.
# Apple's llvm-gcc-4.2 is buggy and does not.
AS_IF([test "x$OPENMP_CFLAGS" != "x"],
  [
    AC_MSG_CHECKING([if compiler supports C99 VLAs in OpenMP for loops])
    save_CFLAGS=$CFLAGS
    CFLAGS="$CFLAGS $OPENMP_CFLAGS"
    AC_LINK_IFELSE([
        AC_LANG_PROGRAM(, [
          int i, n = 10;
          #pragma omp parallel for
          for (i = 0; i < 10; i ++)
          { int a@<:@n@:>@; }
        ])
      ],
      [AC_MSG_RESULT([yes])],
      [
        AC_MSG_RESULT([no, disabling OpenMP])
        OPENMP_CFLAGS=
      ]
    )
Leo P. Singer's avatar
Leo P. Singer committed
147
    CFLAGS=$save_CFLAGS
148
149
150
151
152
153
154
155
156
157
  ]
)

# check for HEALPix
PKG_CHECK_MODULES([CHEALPIX],[chealpix],[true],[false])
CPPFLAGS="$CPPFLAGS $CHEALPIX_CFLAGS"
LIBS="$LIBS $CHEALPIX_LIBS"
AC_CHECK_LIB([chealpix],[nside2npix],[HEALPIX_ENABLE_VAL=ENABLED],[HEALPIX_ENABLE_VAL=DISABLED])
AM_CONDITIONAL([HAVE_CHEALPIX],[test "x$HEALPIX_ENABLE_VAL" = "xENABLED"])

158
159
160
161
162
163
# check for gsl
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
CPPFLAGS="$CPPFLAGS $GSL_CFLAGS"
LIBS="$LIBS $GSL_LIBS"
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_strerror],,[AC_MSG_ERROR([could not find the gsl library])])
164
LALSUITE_ENABLE_FAST_GSL
165
166
167
168
169
170
171
172
173
174
175
176
177

# check for gsl headers
AC_CHECK_HEADERS([gsl/gsl_errno.h],,[AC_MSG_ERROR([could not find the gsl/gsl_errno.h header])])

# metaio
PKG_CHECK_MODULES([METAIO],[libmetaio],[true],[false])
CPPFLAGS="$CPPFLAGS $METAIO_CFLAGS"
LIBS="$LIBS $METAIO_LIBS"
AC_CHECK_LIB([metaio],[MetaioOpen],,[AC_MSG_ERROR([could not find the metaio library])])

# check for libmetaio headers
AC_CHECK_HEADERS([metaio.h],,[AC_MSG_ERROR([could not find the metaio.h header])])

178
179
180
181
182
183
184
185
if test "$lalxml" = "true"; then
  # check for libxml2
  PKG_CHECK_MODULES([LIBXML2],[libxml-2.0 >= 2.6],[true],[false])
  CPPFLAGS="$CPPFLAGS $LIBXML2_CFLAGS"
  LIBS="$LIBS $LIBXML2_LIBS"
  AC_CHECK_LIB([xml2],[xmlInitParser],,[AC_MSG_WARN([cannot find the xml2 library])])
fi

186
# check for lal libraries and headers
187
188
189
190
191
192
193
LALSUITE_CHECK_LIB([LAL],[6.10.0],[LALVersion],[lal/LALStdio.h])
LALSUITE_CHECK_LIB([LALSupport],[6.10.0],[LALOpenDataFile],[lal/FileIO.h])
LALSUITE_CHECK_LIB([LALMetaIO],[1.1.0],[XLALCreateMetaTableDir],[lal/LIGOLwXMLRead.h])
LALSUITE_CHECK_LIB([LALFrame],[1.0.10],[LALFrOpen],[lal/LALFrameL.h])
LALSUITE_CHECK_LIB([LALSimulation],[0.7.0],[XLALSimDetectorStrainREAL8TimeSeries],[lal/LALSimulation.h])
LALSUITE_CHECK_LIB([LALInspiral],[1.5.0],[LALInspiralParameterCalc],[lal/LALInspiral.h])
LALSUITE_CHECK_LIB([LALPulsar],[1.7.0],[XLALComputeFaFb],[lal/ComputeFstat.h])
194

195
# check for lalxml
196
LALSUITE_CHECK_OPT_LIB([LALXML],[1.1.5],[XLALXMLFilePrintElements],[lal/LALXML.h])
John Douglas Veitch's avatar
John Douglas Veitch committed
197

198
199
200
# configure SWIG wrapping modules
LALSUITE_USE_SWIG([XLALInference LALInference XLAL LAL])

201
# add gcc specific flags
202
LALSUITE_ADD_GCC_FLAGS
203

204
205
206
207
208
209
# Disable OpenMP by default.
# FIXME: OpenMP should be on by default, but it breaks condor_compiling lalapps.
AS_IF(
  [test "x$enable_openmp" = "x"],
  [OPENMP_CFLAGS=]
)
210
211
212
213
214
215
216
217
218
219
220
221
222
# add compiler flags for OpenMP
AS_IF(
  [test "x$OPENMP_CFLAGS" = "x"],
  [
    OPENMP_ENABLE_VAL="DISABLED"
    CFLAGS="$CFLAGS -Wno-unknown-pragmas"
  ],
  [
    OPENMP_ENABLE_VAL="ENABLED"
    CFLAGS="$CFLAGS $OPENMP_CFLAGS"
  ]
)

223
224
225
226
227
# force all python modules into the exec dir to prevent mixed C and
# pure-python library code from being split across lib and lib64 on
# RedHat-derived systems.
AC_SUBST([pkgpythondir], ["\${pkgpyexecdir}"])

228
229
230
231
232
233
# output
LAL_HEADER_LINK=${ac_aux_dir}/header-link.mk
AC_SUBST_FILE([LAL_HEADER_LINK])
AC_PROG_MAKE_SET
AC_OUTPUT
echo "
234
235
==================================================
LALInference has now been successfully configured:
236

237
* LALXML library support is $LALXML_ENABLE_VAL
238
239
* SWIG wrapping module for Octave is $SWIG_OCTAVE_ENABLE_VAL
* SWIG wrapping module for Python is $SWIG_PYTHON_ENABLE_VAL
240
241
* HEALPix is $HEALPIX_ENABLE_VAL
* OpenMP acceleration is $OPENMP_ENABLE_VAL
242

243
and will be installed under the directory:
244

245
${prefix}
246

247
248
249
250
Now run 'make' to build LALInference,
and run 'make install' to install LALInference.
==================================================
"