lalsuite_swig.m4 14.9 KB
Newer Older
1 2
# -*- mode: autoconf; -*-
# lalsuite_swig.m4 - SWIG configuration
Karl Wette's avatar
Karl Wette committed
3
# Author: Karl Wette, 2011--2014
4
#
5
# serial 77
6

Karl Wette's avatar
Karl Wette committed
7
AC_DEFUN([_LALSUITE_CHECK_SWIG_VERSION],[
8 9 10
  # $0: check the version of $1, and store it in ${swig_version}
  swig_version=
  swig_version_output=[`$1 -version 2>/dev/null`]
Karl Wette's avatar
Karl Wette committed
11 12 13
  AS_IF([test $? -eq 0],[
    swig_version_regex=['s|^ *SWIG [Vv]ersion \([0-9.][0-9.]*\)|\1|p;d']
    swig_version=[`echo "${swig_version_output}" | ${SED} -e "${swig_version_regex}"`]
14 15 16
  ])
  AS_IF([test "x${swig_version}" = x],[
    AC_MSG_ERROR([could not determine version of $1])
Karl Wette's avatar
Karl Wette committed
17 18 19 20 21 22
  ])
  # end $0
])

AC_DEFUN([LALSUITE_ENABLE_SWIG],[
  # $0: enable SWIG bindings
23 24 25 26
  AC_ARG_ENABLE(
    [swig],
    AC_HELP_STRING(
      [--enable-swig],
Karl Wette's avatar
Karl Wette committed
27
      [generate SWIG bindings for all languages]
28
    ),[
29 30 31
      AS_CASE(["${enableval}"],
        [yes],[swig_build_all=true],
        [no],[swig_build_all=false],
32
        [AC_MSG_ERROR([invalid value "${enableval}" for --enable-swig])]
33
      )
34 35 36 37
    ],[
      swig_build_all=
    ]
  )
38
  swig_build_any=false
Karl Wette's avatar
Karl Wette committed
39
  LALSUITE_ENABLE_SWIG_LANGUAGE([Octave],[false],[LALSUITE_REQUIRE_CXX])
40
  LALSUITE_ENABLE_SWIG_LANGUAGE([Python],[false],[LALSUITE_REQUIRE_PYTHON([2.6])])
41 42
  # Python is required to run generate_swig_iface.py
  LALSUITE_REQUIRE_PYTHON([2.6])
Karl Wette's avatar
Karl Wette committed
43
  # end $0
44
])
45

46
AC_DEFUN([LALSUITE_ENABLE_SWIG_LANGUAGE],[
Karl Wette's avatar
Karl Wette committed
47 48 49
  # $0: enable SWIG binding languages
  m4_pushdef([uppercase],m4_translit([$1],[a-z],[A-Z]))
  m4_pushdef([lowercase],m4_translit([$1],[A-Z],[a-z]))
50 51 52 53
  AC_ARG_ENABLE(
    [swig-]lowercase,
    AC_HELP_STRING(
      [--enable-swig-]lowercase,
54
      [generate SWIG bindings for $1]
55 56 57 58
    ),[
      AS_CASE(["${enableval}"],
        [yes],[swig_build_]lowercase[=true],
        [no],[swig_build_]lowercase[=false],
59
        [AC_MSG_ERROR([invalid value "${enableval}" for --enable-swig-]]lowercase[)]
60 61 62 63 64
      )
    ],[
      swig_build_]lowercase[=${swig_build_all:-$2}
    ]
  )
Karl Wette's avatar
Karl Wette committed
65
  AS_IF([test "${swig_build_]lowercase[}" = true],[
66
    swig_build_any=true
Karl Wette's avatar
Karl Wette committed
67 68 69 70
    SWIG_BUILD_]uppercase[_ENABLE_VAL=ENABLED
    $3
  ],[
    SWIG_BUILD_]uppercase[_ENABLE_VAL=DISABLED
71
  ])
Karl Wette's avatar
Karl Wette committed
72 73
  AM_CONDITIONAL([SWIG_BUILD_]uppercase,[test "${swig_build_]lowercase[}" = true])
  m4_popdef([uppercase])
74
  m4_popdef([lowercase])
Karl Wette's avatar
Karl Wette committed
75
  # end $0
76 77 78
])

AC_DEFUN([LALSUITE_USE_SWIG],[
Karl Wette's avatar
Karl Wette committed
79 80 81
  # $0: configure enabled SWIG bindings
  AS_IF([test "${swig_build_any}" = true],[

82 83 84
    # configure SWIG binding languages
    swig_min_version=2.0.11
    swig_min_version_info=""
85
    swig_src_files=""
86 87 88
    LALSUITE_USE_SWIG_OCTAVE
    LALSUITE_USE_SWIG_PYTHON

89 90
    # check for SWIG binary with version ${swig_min_version} or later;
    # use ${SWIG} if set, otherwise check common SWIG binary names
91
    AC_SUBST([SWIG])
92 93 94 95 96 97
    AS_IF([test "x${SWIG}" != x],[
      AC_MSG_CHECKING([if ${SWIG} version is at least ${swig_min_version}])
      _LALSUITE_CHECK_SWIG_VERSION([${SWIG}])
      LALSUITE_VERSION_COMPARE([${swig_version}],[<],[${swig_min_version}],[
        AC_MSG_RESULT([no (${swig_version})])
        AC_MSG_ERROR([SWIG version ${swig_min_version} or later is required ${swig_min_version_info}])
98
      ])
99
      AC_MSG_RESULT([yes (${swig_version})])
Karl Wette's avatar
Karl Wette committed
100
    ],[
101 102 103 104 105 106 107
      AC_PATH_PROGS_FEATURE_CHECK([SWIG],[swig swig2.0],[
        AC_MSG_CHECKING([if ${ac_path_SWIG} version is at least ${swig_min_version}])
        _LALSUITE_CHECK_SWIG_VERSION([${ac_path_SWIG}])
        LALSUITE_VERSION_COMPARE([${swig_version}],[>=],[${swig_min_version}],[
          ac_path_SWIG_found=true
          AC_MSG_RESULT([yes (${swig_version})])
          ac_cv_path_SWIG="${ac_path_SWIG}"
108
        ],[
109 110
          ac_path_SWIG_found=false
          AC_MSG_RESULT([no (${swig_version})])
111
        ])
112 113 114 115
      ],[
        AC_MSG_ERROR([SWIG version ${swig_min_version} or later is required ${swig_min_version_info}])
      ])
      SWIG="${ac_cv_path_SWIG}"
116 117
    ])

Karl Wette's avatar
Karl Wette committed
118 119 120 121 122
    # extract -I and -D flags from LALSuite library preprocessor flags
    AC_SUBST([SWIG_CPPFLAGS],[])
    for flag in ${CPPFLAGS}; do
      AS_CASE([${flag}],
        [-I*|-D*],[SWIG_CPPFLAGS="${SWIG_CPPFLAGS} ${flag}"]
123 124
      )
    done
Karl Wette's avatar
Karl Wette committed
125 126 127 128 129 130

    # extract -L flags from LALSuite library linker flags
    AC_SUBST([SWIG_LDFLAGS],[])
    for flag in ${LDFLAGS}; do
      AS_CASE([${flag}],
        [-L*],[SWIG_LDFLAGS="${SWIG_LDFLAGS} ${flag}"]
131 132
      )
    done
133

Karl Wette's avatar
Karl Wette committed
134 135 136
    # determine various libtool parameters
    AC_SUBST([SWIG_LTLIBDIR],["${objdir}"])
    AC_SUBST([SWIG_SOEXT],[`module=yes; eval shrext=\"${shrext_cmds}\"; echo ${shrext}`])
137

Karl Wette's avatar
Karl Wette committed
138 139 140 141 142 143 144 145
    # substitute list of LALSuite bindings that these bindings depend on
    AC_MSG_CHECKING([for LALSuite binding dependencies])
    AC_SUBST([SWIG_DEPENDENCIES],[])
    for arg in ${lalsuite_libs}; do
      AS_CASE([${arg}],
        [lalsupport],[:],
        [SWIG_DEPENDENCIES="${SWIG_DEPENDENCIES} ${arg}"]
      )
146
    done
Karl Wette's avatar
Karl Wette committed
147 148
    AS_IF([test "x${SWIG_DEPENDENCIES}" = x],[
      AC_MSG_RESULT([none])
149
    ],[
Karl Wette's avatar
Karl Wette committed
150
      AC_MSG_RESULT([${SWIG_DEPENDENCIES}])
151 152
    ])

153
  ])
Karl Wette's avatar
Karl Wette committed
154 155
  AM_CONDITIONAL([SWIG_BUILD],[test "${swig_build_any}" = true])
  # end $0
156 157
])

158
AC_DEFUN([LALSUITE_USE_SWIG_LANGUAGE],[
Karl Wette's avatar
Karl Wette committed
159 160 161 162 163
  # $0: configure SWIG binding languages
  m4_pushdef([uppercase],m4_translit([$1],[a-z],[A-Z]))
  m4_pushdef([lowercase],m4_translit([$1],[A-Z],[a-z]))
  AS_IF([test "${swig_build_]lowercase[}" = true],[
    swig_build=true
164 165
    swig_src_files="${swig_src_files} swiglal_[]lowercase[].$2"
    $3
166 167 168
  ])
  m4_popdef([uppercase])
  m4_popdef([lowercase])
Karl Wette's avatar
Karl Wette committed
169
  # end $0
170 171
])

172
AC_DEFUN([LALSUITE_USE_SWIG_OCTAVE],[
Karl Wette's avatar
Karl Wette committed
173
  # $0: configure SWIG Octave bindings
174
  LALSUITE_USE_SWIG_LANGUAGE([Octave],[cpp],[
175

Karl Wette's avatar
Karl Wette committed
176
    # check for Octave
177 178
    AC_PATH_PROG(OCTAVE,[octave],[],[])
    AS_IF([test "x${OCTAVE}" = x],[
Karl Wette's avatar
Karl Wette committed
179
      AC_MSG_ERROR([could not find octave in PATH])
180 181
    ])

Karl Wette's avatar
Karl Wette committed
182 183 184 185 186 187 188 189 190 191 192
    # check for Octave utilities octave-config and mkoctfile
    octave_dir=`AS_DIRNAME(["${OCTAVE}"])`
    AC_MSG_CHECKING([for octave-config])
    octave_cfg="${octave_dir}/octave-config"
    AS_IF([test -x "${octave_cfg}"],[
      AC_MSG_RESULT([${octave_cfg}])
    ],[
      AC_MSG_RESULT([not found])
      AC_MSG_ERROR([could not find octave-config in ${octave_dir}])
    ])
    octave_cfg="env - ${octave_cfg}"
193
    AC_MSG_CHECKING([for mkoctfile])
Karl Wette's avatar
Karl Wette committed
194 195 196
    mkoctfile="${octave_dir}/mkoctfile"
    AS_IF([test -x "${mkoctfile}"],[
      AC_MSG_RESULT([${mkoctfile}])
197
    ],[
Karl Wette's avatar
Karl Wette committed
198 199
      AC_MSG_RESULT([not found])
      AC_MSG_ERROR([could not find mkoctfile in ${octave_dir}])
200
    ])
Karl Wette's avatar
Karl Wette committed
201
    mkoctfile="env - ${mkoctfile}"
202 203 204 205

    # check Octave version
    octave_min_version=3.2.0
    AC_MSG_CHECKING([${OCTAVE} version])
Karl Wette's avatar
Karl Wette committed
206
    octave_version=[`${octave_cfg} -p VERSION 2>/dev/null`]
207
    AS_IF([test "x${octave_version}" = x],[
208
      AC_MSG_ERROR([could not determine ${OCTAVE} version])
209 210
    ])
    AC_MSG_RESULT([${octave_version}])
211
    LALSUITE_VERSION_COMPARE([${octave_version}],[<],[${octave_min_version}],[
212 213 214 215 216
      AC_MSG_ERROR([Octave version ${octave_min_version} or later is required])
    ])
    LALSUITE_VERSION_COMPARE([${octave_version}],[>=],[3.8.0],[
      swig_min_version=2.0.12
      swig_min_version_info="for Octave version ${octave_version}"
217 218
    ])

219 220 221 222
    # determine where to install Octave bindings: take versioned site .oct file
    # directory given by octave-config, and strip off prefix; thus, if LALSuite
    # is installed in the same directory as Octave, .oct files will be found by
    # Octave without having to add to OCTAVE_PATH
Karl Wette's avatar
Karl Wette committed
223 224 225 226 227 228 229 230 231 232 233
    AC_MSG_CHECKING([${OCTAVE} .oct installation directory])
    octave_prefix=[`${octave_cfg} -p PREFIX 2>/dev/null | ${SED} -e 's|/*$||'`]
    octexecdir=[`${octave_cfg} -p LOCALVEROCTFILEDIR 2>/dev/null | ${SED} -e 's|/*$||'`]
    octexecdir=[`echo ${octexecdir} | ${SED} -e "s|^${octave_prefix}/||"`]
    AS_IF([test "x`echo ${octexecdir} | ${SED} -n -e '\|^/|p'`" != x],[
      AC_MSG_ERROR([could not build relative path from "${octexecdir}"])
    ])
    octexecdir='${prefix}'/"${octexecdir}"
    AC_MSG_RESULT([${octexecdir}])
    AC_SUBST([octexecdir])

234 235
    # check that wrappings are being compiled with the
    # same C++ compiler used to compile Octave itself
236
    AC_MSG_CHECKING([C++ compiler used for building ${OCTAVE}])
Karl Wette's avatar
Karl Wette committed
237
    octave_CXX=`${mkoctfile} -p CXX 2>/dev/null`
238
    AC_MSG_RESULT([${octave_CXX}])
239 240 241 242 243
    CXX_version_regex=['s|([^)]*) *||g;s|^ *||g;s| *$||g']
    octave_CXX_version=`${octave_CXX} --version 2>/dev/null | ${SED} -n -e '1p' | ${SED} -e "${CXX_version_regex}"`
    _AS_ECHO_LOG([octave_CXX_version: '${octave_CXX_version}'])
    lalsuite_CXX_version=`${CXX} --version 2>/dev/null | ${SED} -n -e '1p' | ${SED} -e "${CXX_version_regex}"`
    _AS_ECHO_LOG([lalsuite_CXX_version: '${lalsuite_CXX_version}'])
244
    AS_IF([test "x${lalsuite_CXX_version}" != "x${octave_CXX_version}"],[
245 246
      AC_MSG_ERROR([configured C++ compiler "${CXX}" differs from ${OCTAVE} C++ compiler "${octave_CXX}"])
    ])
247

Karl Wette's avatar
Karl Wette committed
248 249
    # determine Octave preprocessor flags
    AC_SUBST([SWIG_OCTAVE_CPPFLAGS],[])
250
    AC_SUBST([SWIG_OCTAVE_CPPFLAGS_IOCTAVE],[])
251
    for arg in CPPFLAGS INCFLAGS; do
252 253 254 255 256 257
      for flag in `${mkoctfile} -p ${arg} 2>/dev/null`; do
        AS_CASE([${flag}],
          [-I*/octave],[SWIG_OCTAVE_CPPFLAGS_IOCTAVE="${flag}"],
          [SWIG_OCTAVE_CPPFLAGS="${SWIG_OCTAVE_CPPFLAGS} ${flag}"]
        )
      done
258
    done
Karl Wette's avatar
Karl Wette committed
259 260 261

    # determine Octave compiler flags
    AC_SUBST([SWIG_OCTAVE_CXXFLAGS],[])
262
    swig_octave_cxxflags=
Karl Wette's avatar
Karl Wette committed
263
    for arg in CXXPICFLAG ALL_CXXFLAGS; do
264
      for flag in `${mkoctfile} -p ${arg} 2>/dev/null`; do
265
        swig_octave_cxxflags="${swig_octave_cxxflags} ${flag}"
266
      done
Karl Wette's avatar
Karl Wette committed
267 268
    done
    AC_LANG_PUSH([C++])
269 270
    LALSUITE_CHECK_COMPILE_FLAGS([
      ${swig_octave_cxxflags}
Karl Wette's avatar
Karl Wette committed
271
      -Wno-uninitialized -Wno-unused-variable -Wno-unused-but-set-variable
272 273 274 275
      -Wno-format-extra-args -Wno-tautological-compare -fno-strict-aliasing
      -g -O0 -Wp[,]-U_FORTIFY_SOURCE
      ],[SWIG_OCTAVE_CXXFLAGS="${SWIG_OCTAVE_CXXFLAGS} ${flag}"]
    )
Karl Wette's avatar
Karl Wette committed
276 277 278 279
    AC_LANG_POP([C++])

    # determine Octave linker flags
    AC_SUBST([SWIG_OCTAVE_LDFLAGS],[])
280
    swig_octave_ldflags=
Karl Wette's avatar
Karl Wette committed
281
    for arg in LFLAGS LIBOCTINTERP LIBOCTAVE LIBCRUFT OCT_LINK_OPTS OCT_LINK_DEPS; do
282 283 284
      for flag in `${mkoctfile} -p ${arg} 2>/dev/null`; do
        AS_CASE([${flag}],
          [-L/usr/lib|-L/usr/lib64],[:],
285
          [swig_octave_ldflags="${swig_octave_ldflags} ${flag}"]
286 287
        )
      done
288
    done
289 290 291 292
    LALSUITE_CHECK_LINK_FLAGS([
      ${swig_octave_ldflags}
      ],[SWIG_OCTAVE_LDFLAGS="${SWIG_OCTAVE_LDFLAGS} ${flag}"]
    )
293 294 295

    # check for Octave headers
    AC_LANG_PUSH([C++])
Karl Wette's avatar
Karl Wette committed
296
    LALSUITE_PUSH_UVARS
297
    CPPFLAGS="${SWIG_OCTAVE_CPPFLAGS_IOCTAVE} ${SWIG_OCTAVE_CPPFLAGS}"
298
    AC_CHECK_HEADER([octave/oct.h],[],[
299 300 301
      AC_MSG_ERROR([could not find the header "octave/oct.h"])
    ],[
      AC_INCLUDES_DEFAULT
302
    ])
Karl Wette's avatar
Karl Wette committed
303
    LALSUITE_POP_UVARS
304
    AC_LANG_POP([C++])
305 306

  ])
Karl Wette's avatar
Karl Wette committed
307
  # end $0
308
])
309

310
AC_DEFUN([LALSUITE_USE_SWIG_PYTHON],[
Karl Wette's avatar
Karl Wette committed
311
  # $0: configure SWIG Python bindings
312
  LALSUITE_USE_SWIG_LANGUAGE([Python],[c],[
313

314 315 316 317 318
    # check for distutils
    AC_MSG_CHECKING([for distutils])
    cat <<EOD | ${PYTHON} - 2>/dev/null
import distutils
EOD
319
    AS_IF([test $? -ne 0],[
320
      AC_MSG_ERROR([could not import distutils])
321 322 323
    ])
    AC_MSG_RESULT([yes])

324 325 326 327 328 329 330 331 332 333 334 335 336 337
    # check for NumPy
    numpy_min_version=1.3
    AC_MSG_CHECKING([for NumPy])
    numpy_version=[`cat <<EOD | ${PYTHON} - 2>/dev/null
import numpy
print(numpy.__version__)
EOD`]
    AS_IF([test $? -ne 0],[
      AC_MSG_ERROR([could not import NumPy])
    ])
    AC_MSG_RESULT([yes])

    # check NumPy version
    AC_MSG_CHECKING([NumPy version])
338
    LALSUITE_VERSION_COMPARE([${numpy_version}],[<],[${numpy_min_version}],[
339
      AC_MSG_ERROR([NumPy version ${numpy_min_version} or later is required])
340 341 342
    ])
    AC_MSG_RESULT([${numpy_version}])

Karl Wette's avatar
Karl Wette committed
343 344 345
    # determine Python preprocessor flags
    AC_SUBST([SWIG_PYTHON_CPPFLAGS],[])
    python_out=[`cat <<EOD | ${PYTHON} - 2>/dev/null
346 347 348 349 350 351 352 353
import sys
import distutils.sysconfig as cfg
import numpy.lib.utils as npyutil
sys.stdout.write( '-I' + cfg.get_python_inc())
sys.stdout.write(' -I' + cfg.get_python_inc(plat_specific=1))
sys.stdout.write(' -I' + npyutil.get_include())
EOD`]
    AS_IF([test $? -ne 0],[
Karl Wette's avatar
Karl Wette committed
354
      AC_MSG_ERROR([could not determine Python preprocessor flags])
355
    ])
356 357 358
    for flag in ${python_out}; do
      SWIG_PYTHON_CPPFLAGS="${SWIG_PYTHON_CPPFLAGS} ${flag}"
    done
359

Karl Wette's avatar
Karl Wette committed
360 361 362
    # determine Python compiler flags
    AC_SUBST([SWIG_PYTHON_CFLAGS],[])
    python_out=[`cat <<EOD | ${PYTHON} - 2>/dev/null
363 364 365 366 367 368 369
import sys
import distutils.sysconfig as cfg
cflags = cfg.get_config_var('CFLAGS').split()
cflags = [f for f in cflags if f != '-DNDEBUG']
sys.stdout.write(" ".join(cflags))
EOD`]
    AS_IF([test $? -ne 0],[
Karl Wette's avatar
Karl Wette committed
370 371
      AC_MSG_ERROR([could not determine Python compiler flags])
    ])
372
    for flag in ${python_out}; do
373
      swig_python_cflags="${swig_python_cflags} ${flag}"
374
    done
Karl Wette's avatar
Karl Wette committed
375
    AC_LANG_PUSH([C])
376 377
    LALSUITE_CHECK_COMPILE_FLAGS([
      ${swig_python_cflags}
Karl Wette's avatar
Karl Wette committed
378
      -Wno-uninitialized -Wno-unused-variable -Wno-unused-but-set-variable
379
      -Wno-format-extra-args -Wno-tautological-compare -fno-strict-aliasing -g
380 381
      ],[SWIG_PYTHON_CFLAGS="${SWIG_PYTHON_CFLAGS} ${flag}"]
    )
Karl Wette's avatar
Karl Wette committed
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
    AC_LANG_POP([C])

    # determine Python linker flags
    AC_SUBST([SWIG_PYTHON_LDFLAGS],[])
    python_out=[`cat <<EOD | ${PYTHON} - 2>/dev/null
import sys, os
import distutils.sysconfig as cfg
sys.stdout.write(cfg.get_config_var('LINKFORSHARED'))
sys.stdout.write(' -L' + cfg.get_python_lib())
sys.stdout.write(' -L' + cfg.get_python_lib(plat_specific=1))
sys.stdout.write(' -L' + cfg.get_python_lib(plat_specific=1,standard_lib=1))
sys.stdout.write(' -L' + cfg.get_config_var('LIBDIR'))
EOD`]
    AS_IF([test $? -ne 0],[
      AC_MSG_ERROR([could not determine Python linker flags])
397
    ])
398 399 400
    for flag in ${python_out}; do
      AS_CASE([${flag}],
        [-L/usr/lib|-L/usr/lib64],[:],
401
        [swig_python_ldflags="${swig_python_ldflags} ${flag}"]
402 403
      )
    done
404 405 406 407
    LALSUITE_CHECK_LINK_FLAGS([
      ${swig_python_ldflags}
      ],[SWIG_PYTHON_LDFLAGS="${SWIG_PYTHON_LDFLAGS} ${flag}"]
    )
408

Karl Wette's avatar
Karl Wette committed
409
    # check for Python and NumPy headers
410
    AC_LANG_PUSH([C])
Karl Wette's avatar
Karl Wette committed
411 412
    LALSUITE_PUSH_UVARS
    CPPFLAGS="${SWIG_PYTHON_CPPFLAGS}"
413
    AC_CHECK_HEADER([Python.h],[],[
414 415 416 417
      AC_MSG_ERROR([could not find the header "Python.h"])
    ],[
      AC_INCLUDES_DEFAULT
    ])
418
    AC_CHECK_HEADER([numpy/arrayobject.h],[],[
419 420 421 422 423
      AC_MSG_ERROR([could not find the header "numpy/arrayobject.h"])
    ],[
      AC_INCLUDES_DEFAULT
      #include <Python.h>
    ])
Karl Wette's avatar
Karl Wette committed
424
    LALSUITE_POP_UVARS
425
    AC_LANG_POP([C])
426

427
    # remove deprecated code in NumPy API >= 1.7
Karl Wette's avatar
Karl Wette committed
428
    SWIG_PYTHON_CPPFLAGS="${SWIG_PYTHON_CPPFLAGS} -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION"
429 430 431

    # check for declarations which may need compatibility code for NumPy API < 1.7
    AC_LANG_PUSH([C])
Karl Wette's avatar
Karl Wette committed
432 433
    LALSUITE_PUSH_UVARS
    CPPFLAGS="${SWIG_PYTHON_CPPFLAGS}"
434 435 436 437 438 439 440 441 442 443
    AC_CHECK_DECL([NPY_ARRAY_WRITEABLE],[
      SWIG_PYTHON_CPPFLAGS="${SWIG_PYTHON_CPPFLAGS} -DSWIGLAL_HAVE_NPY_ARRAY_WRITEABLE"
    ],[],[
      AC_INCLUDES_DEFAULT
      #include <Python.h>
      #include <numpy/arrayobject.h>
    ])
    AC_CHECK_DECL([PyArray_SetBaseObject],[
      SWIG_PYTHON_CPPFLAGS="${SWIG_PYTHON_CPPFLAGS} -DSWIGLAL_HAVE_PyArray_SetBaseObject"
    ],[],[
444 445 446 447
      AC_INCLUDES_DEFAULT
      #include <Python.h>
      #include <numpy/arrayobject.h>
    ])
Karl Wette's avatar
Karl Wette committed
448
    LALSUITE_POP_UVARS
449 450
    AC_LANG_POP([C])

451
  ])
Karl Wette's avatar
Karl Wette committed
452
  # end $0
453
])