configure.ac 8.49 KB
Newer Older
Adam Mercer's avatar
Adam Mercer committed
1
AC_PREREQ([2.63])
2
AC_INIT([LALInference],[1.7.0.1],[lal-discuss@ligo.org])
3
AC_CONFIG_HEADERS([src/config.h src/LALInferenceConfig.h])
4 5 6 7 8 9
AC_CONFIG_SRCDIR([src/LALInference.h])
AC_CONFIG_AUX_DIR([gnuscripts])
AC_CONFIG_MACRO_DIR([gnuscripts])
AC_CONFIG_FILES([ \
  Makefile \
  debian/Makefile \
10 11
  doxygen/Makefile \
  doxygen/doxygen.cfg \
12 13
  include/Makefile \
  include/lal/Makefile \
14 15
  lalinference.pc \
  lalinference.spec \
16
  python/Makefile \
17 18 19
  python/lalinference/Makefile \
  python/lalinference/__init__.py \
  python/lalinference/bayestar/Makefile \
20
  python/lalinference/io/Makefile \
21
  python/lalinference/rapid_pe/Makefile \
22
  python/lalinference/imrtgr/Makefile \
23
  python/lalinference/tiger/Makefile \
24
  python/lalinference/popprior/Makefile \
25 26 27
  src/LALInferenceVCSInfo.c \
  src/LALInferenceVCSInfo.h \
  src/Makefile \
28
  swig/Makefile \
Leo Pound Singer's avatar
Leo Pound Singer committed
29
  test/Makefile \
30
])
31 32 33 34 35 36
AM_INIT_AUTOMAKE([ \
  1.11 \
  foreign \
  subdir-objects \
  color-tests \
  parallel-tests \
Adam Mercer's avatar
Adam Mercer committed
37
  tar-ustar \
38 39
  dist-xz \
  no-dist-gzip \
40
])
41 42 43

AC_CANONICAL_HOST

44 45
LALSUITE_ARG_VAR

Karl Wette's avatar
Karl Wette committed
46
LALSUITE_CHECK_GIT_REPO
47
LALSUITE_DISTCHECK_CONFIGURE_FLAGS
48

49 50 51 52 53 54 55 56 57 58 59 60 61 62
# 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.
63
AC_SUBST([LIBCURRENT],[11])
64
AC_SUBST([LIBREVISION],[0])
65
AC_SUBST([LIBAGE],[0])
66 67 68 69 70
AC_SUBST([LIBVERSION],[${LIBCURRENT}:${LIBREVISION}:${LIBAGE}])

# nightly build
LALSUITE_ENABLE_NIGHTLY

71 72 73 74 75 76 77 78
# enable strict gcc flags
LALSUITE_ENABLE_GCC_FLAGS

# optional lal libraries
LALSUITE_ENABLE_LALFRAME
LALSUITE_ENABLE_LALMETAIO
LALSUITE_ENABLE_LALINSPIRAL
LALSUITE_ENABLE_LALPULSAR
79
LALSUITE_ENABLE_LALBURST
80 81
LALSUITE_ENABLE_LALXML

82 83 84
# enable SWIG wrapping modules
LALSUITE_ENABLE_SWIG

85 86 87
# enable Doxygen documentation
LALSUITE_ENABLE_DOXYGEN

88 89
# define version/configure info
LALSUITE_VERSION_CONFIGURE_INFO
90

91 92 93
# workaround broken libtool multilib support on sl6
LALSUITE_MULTILIB_LIBTOOL_HACK

94 95
# use silent build rules
AM_SILENT_RULES([yes])
96

97 98
# check for required compilers
LALSUITE_PROG_COMPILERS
99

100
# checks for programs
101
AC_PROG_INSTALL
102
AC_PROG_LN_S
103
AC_PROG_AWK
104
AC_PROG_SED
105
LALSUITE_CHECK_PYTHON([2.6])
106 107 108 109 110 111 112 113 114

# 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
115
AC_CHECK_HEADERS([unistd.h])
116 117 118 119

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

120 121 122 123 124 125 126 127
# 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])
128 129
    LALSUITE_PUSH_UVARS
    CFLAGS="$OPENMP_CFLAGS"
130 131 132 133 134 135 136 137 138 139 140 141 142 143
    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=
      ]
    )
144
    LALSUITE_POP_UVARS
145 146 147 148 149
  ]
)

# check for HEALPix
PKG_CHECK_MODULES([CHEALPIX],[chealpix],[true],[false])
150
LALSUITE_ADD_FLAGS([C],[${CHEALPIX_CFLAGS}],[${CHEALPIX_LIBS}])
151 152
HEALPIX_ENABLE_VAL=ENABLED
AC_CHECK_LIB([chealpix],[nside2npix],,[HEALPIX_ENABLE_VAL=DISABLED])
153 154
AM_CONDITIONAL([HAVE_CHEALPIX],[test "x$HEALPIX_ENABLE_VAL" = "xENABLED"])

155 156
# check for gsl
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
157
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
158
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
Karl Wette's avatar
Karl Wette committed
159
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
160
LALSUITE_CHECK_GSL_VERSION([1.15])
161
LALSUITE_ENABLE_FAST_GSL
162 163 164 165 166 167

# 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])
168
LALSUITE_ADD_FLAGS([C],[${METAIO_CFLAGS}],[${METAIO_LIBS}])
169 170 171 172 173
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])])

174 175 176
if test "$lalxml" = "true"; then
  # check for libxml2
  PKG_CHECK_MODULES([LIBXML2],[libxml-2.0 >= 2.6],[true],[false])
177
  LALSUITE_ADD_FLAGS([C],[${LIBXML2_CFLAGS}],[${LIBXML2_LIBS}])
178 179 180
  AC_CHECK_LIB([xml2],[xmlInitParser],,[AC_MSG_WARN([cannot find the xml2 library])])
fi

181
# check for lal libraries and headers
182 183 184 185 186 187 188 189
LALSUITE_CHECK_LIB([LAL],[6.16.1],[LALVersion],[lal/LALStdio.h])
LALSUITE_CHECK_LIB([LALSupport],[6.16.1],[XLALCacheImport],[lal/LALCache.h])
LALSUITE_CHECK_LIB([LALMetaIO],[1.2.8],[XLALCreateMetaTableDir],[lal/LIGOLwXMLRead.h])
LALSUITE_CHECK_LIB([LALFrame],[1.4.1],[LALFrOpen],[lal/LALFrameL.h])
LALSUITE_CHECK_LIB([LALSimulation],[1.6.0],[XLALSimDetectorStrainREAL8TimeSeries],[lal/LALSimulation.h])
LALSUITE_CHECK_LIB([LALInspiral],[1.7.5],[LALInspiralParameterCalc],[lal/LALInspiral.h])
LALSUITE_CHECK_LIB([LALPulsar],[1.14.0],[XLALComputeFstat],[lal/ComputeFstat.h])
LALSUITE_CHECK_LIB([LALBurst],[1.4.2],[XLALEPSearch],[lal/EPSearch.h])
190

191
# check for lalxml
192
LALSUITE_CHECK_OPT_LIB([LALXML],[1.2.2],[XLALXMLFilePrintElements],[lal/LALXML.h])
John Douglas Veitch's avatar
John Douglas Veitch committed
193

194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
AC_MSG_CHECKING([if LAL was built with HDF5 support])
AC_RUN_IFELSE(
  [AC_LANG_PROGRAM(
    [
      #include <lal/H5FileIO.h>
      #include <lal/XLALError.h>
    ],
    [
      int ret;
      (void)XLALSetSilentErrorHandler();
      (void)XLALH5FileOpen(NULL, NULL);
      return xlalErrno != XLAL_EFAULT;
    ]
  )],
  [AC_MSG_RESULT([yes])],
  [
    AC_MSG_RESULT([no])
    AC_MSG_ERROR([LAL must be built with HDF5 support in order to build LALInference])
  ]
)

215
# configure SWIG wrapping modules
Karl Wette's avatar
Karl Wette committed
216
LALSUITE_USE_SWIG
217

218 219 220
# configure Doxygen documentation
LALSUITE_USE_DOXYGEN

221 222 223 224 225 226
# 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=]
)
227 228 229 230 231
# add compiler flags for OpenMP
AS_IF(
  [test "x$OPENMP_CFLAGS" = "x"],
  [
    OPENMP_ENABLE_VAL="DISABLED"
232
    LALSUITE_ADD_FLAGS([C],[-Wno-unknown-pragmas],[])
233 234 235
  ],
  [
    OPENMP_ENABLE_VAL="ENABLED"
236
    LALSUITE_ADD_FLAGS([C],[${OPENMP_CFLAGS}],[])
237 238 239
  ]
)

240 241 242 243 244 245 246 247 248 249 250 251 252 253
# check for hdf5 support
HDF5_ENABLE_VAL="DISABLED"
# Note that AX_LIB_HDF5 uses h5cc to determine compiler for configure tests.
# Make sure that it uses the same compiler as we are using.
# Otherwise the configure tests may fail if we are using icc.
HDF5_CC="${CC}"; export HDF5_CC
HDF5_CLINKER="${CC}"; export HDF5_CLINKER
AX_LIB_HDF5()
unset HDF5_CC
unset HDF5_CLINKER
if test "${with_hdf5}" != "yes"; then
  AC_MSG_ERROR([could not find the HDF5 library])
fi

254 255 256
# add gcc specific flags
LALSUITE_ADD_GCC_FLAGS

257 258 259
# link any executables against LALInference library
AC_SUBST([LDADD], ["\$(top_builddir)/src/liblalinference.la"])

260 261 262 263
# add extra preprocessor flags
AM_CPPFLAGS="-DPKG_DATA_DIR='\"\$(pkgdatadir)/\"' ${AM_CPPFLAGS}"
AM_CPPFLAGS="-I\$(top_builddir)/include ${AM_CPPFLAGS}"

264 265 266
# force headers to be installed in ${includedir}/lal, ignoring library name
AC_SUBST([pkgincludedir], ["\${includedir}/lal"])

267 268 269 270 271
# 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}"])

272
# output
273
AC_OUTPUT
274
AC_MSG_NOTICE([
275 276
==================================================
LALInference has now been successfully configured:
277

278
* Python support is $PYTHON_ENABLE_VAL
279
* LALXML library support is $LALXML_ENABLE_VAL
Karl Wette's avatar
Karl Wette committed
280 281
* SWIG bindings for Octave are $SWIG_BUILD_OCTAVE_ENABLE_VAL
* SWIG bindings for Python are $SWIG_BUILD_PYTHON_ENABLE_VAL
282 283
* HEALPix is $HEALPIX_ENABLE_VAL
* OpenMP acceleration is $OPENMP_ENABLE_VAL
284
* Doxygen documentation is $DOXYGEN_ENABLE_VAL
285

286
and will be installed under the directory:
287

288
${prefix}
289

290 291 292
Now run 'make' to build LALInference,
and run 'make install' to install LALInference.
==================================================
293
])