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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
|
dnl Process this file with autoconf to produce a configure script
AC_REVISION($Revision$)
dnl This configure file is known to work with autoconf-2.57,
dnl automake versions 1.6.3 and 1.7.5, and libtool versions 1.4.2 and
dnl 1.5. It should work with autoconf versions 2.50 or better, and
dnl automake 1.6 or better.
dnl Initialisation: package name and version number
m4_define([v_maj], [9])
m4_define([v_min], [2])
m4_define([v_mic], [3])
m4_define([project_version], [v_maj.v_min.v_mic])
AC_INIT([ast],[project_version],[starlink@jiscmail.ac.uk])
AC_CONFIG_AUX_DIR([build-aux])
dnl Shared library versioning
m4_define([lt_cur], [m4_eval(v_maj + v_min)])
m4_define([lt_rev], [v_mic])
m4_define([lt_age], [v_min])
version_info="lt_cur:lt_rev:lt_age"
AC_SUBST([version_info])
dnl Require autoconf-2.50 at least
AC_PREREQ([2.69])
dnl Require Starlink automake
AM_INIT_AUTOMAKE([foreign subdir-objects])
# Comment out predistribution sources in Makefile.am
PREDIST='#' # safe default
AC_SUBST(PREDIST)
dnl Sanity-check: name a file in the source directory
AC_CONFIG_SRCDIR([ast_link.in])
# Checks for programs
AC_PROG_CC
AC_PROG_CPP
LT_INIT
AC_PROG_LN_S
# Include defaults for Starlink configurations
STAR_DEFAULTS
# See if the --without-topinclude option has been provided. This sets the
# automake conditional TOPINCLUDE. By default header files are installed
# into both includedir and includedir/star. If --without-topinclude is
# specified when running configure, then the header files are only
# installed into includedir/star.
AC_ARG_WITH(
[topinclude],
AS_HELP_STRING([--without-topinclude],[install headers only in includedir/star - not includedir]),
if test "$withval" = "yes"; then
topinclude="1"
else
topinclude="0"
fi,
topinclude="1")
AM_CONDITIONAL(TOPINCLUDE, test x$topinclude = x1)
# See if the --with-starmem option has been provided. This sets the
# preprocesor macro HAVE_STAR_MEM_H.
AC_ARG_WITH(
[starmem],
AS_HELP_STRING([--with-starmem],[use starmem library for memory management]),
AC_DEFINE([HAVE_STAR_MEM_H],[1],[Use the starmem library for memory management]),
)
# See if the --with-memdebug option has been provided. This sets the
# preprocesor macro MEM_DEBUG which enables facilities used to track
# down memory leaks, etc.
AC_ARG_WITH(
[memdebug],
AS_HELP_STRING([--with-memdebug],[enable AST memory leak debugging functions]),
AC_DEFINE([MEM_DEBUG],[1],[enable AST memory leak debugging functions in memory.c]),
)
# See if the --with-external_pal option has been provided. This sets the
# preprocesor macro EXTERNAL_PAL which prevents use of the PAL & ERFA
# library functions that are included in the AST distribution. Suitable
# link options are used within ast_link(_adam) scripts to pull in libpal.
AC_ARG_WITH([external_pal],
[ --with-external_pal Use external PAL and ERFA libraries],
if test "$withval" = "yes"; then
external_pal="1"
else
external_pal="0"
fi,
external_pal="0")
AC_SUBST( EXTERNAL_PAL, $external_pal )
if test "$external_pal" = "1"; then
AC_SUBST( LIBPAL, "-lstarlink_pal" )
AC_DEFINE([EXTERNAL_PAL],[1],[use external PAL and ERFA libraries]),
else
AC_SUBST( LIBPAL, "" )
fi
AM_CONDITIONAL(EXTERNAL_PAL, test x$external_pal = x1)
# Conditional defining whether we want to support Fortran libraries
# (e.g. pgplot) and applications. It seems that this must come before
# any uses of AC_CHECK_LIB as otherwise the library checked using
# AC_CHECK_LIB is automatically added to the list of linker options
# created by AC_FC_LIBRARY_LDFLAGS
AC_ARG_WITH([fortran],
[ --without-fortran Build package without Fortran support],
if test "$withval" = "yes"; then
use_fortran="1"
else
use_fortran="0"
fi,
use_fortran="1")
AM_CONDITIONAL(NOFORTRAN, test x$use_fortran = x0)
AC_SUBST(FORTRAN, $use_fortran)
# ast_link needs to be able to link against the Fortran runtime if
# necessary
if test "$use_fortran" = "1"; then
AC_PROG_FC
AC_FC_LIBRARY_LDFLAGS
fi
# If --with-pic=no is set we should honour that.
AM_CONDITIONAL(NOPIC, test x$pic_mode = xno)
# Conditional defining whether we build with POSIX thread support.
AC_ARG_WITH([pthreads],
[ --without-pthreads Build package without POSIX threads support],
if test "$withval" = "yes"; then
use_pthreads="1"
else
use_pthreads="0"
fi,
use_pthreads="1")
if test "$use_pthreads" = "1"; then
AC_CHECK_LIB([pthread], [pthread_create], ,[use_pthreads="0"])
fi
AM_CONDITIONAL(NOTHREADS, test x$use_pthreads = x0)
AC_SUBST(THREADS, $use_pthreads)
# Conditional defining whether we build with YAML support.
AC_ARG_WITH([yaml],
[ --without-yaml Build package without YAML support],
if test "$withval" = "yes"; then
use_yaml="1"
else
use_yaml="0"
fi,
use_yaml="1")
if test "$use_yaml" = "1"; then
AC_CHECK_LIB([yaml], [yaml_parser_initialize], ,[use_yaml="0"])
fi
AM_CONDITIONAL(NOYAML, test x$use_yaml = x0)
AC_SUBST(YAML, $use_yaml)
# See which variadic function API to use
AC_CHECK_HEADERS(stdarg.h varargs.h, break)
# Can we use backtrace?
AC_CHECK_HEADERS([execinfo.h])
AC_CHECK_FUNCS([backtrace])
# Do we have reentrant strerror and strtok?
AC_CHECK_FUNCS([strerror_r strtok_r])
# Do we have vsnprintf?
AC_CHECK_FUNCS([vsnprintf])
# See if we have long doubles (used by the Mapping and Region classes)
AC_CHECK_TYPES([long double])
# See if we have 64 bit integers.
AC_CHECK_TYPES([int64_t, uint64_t])
# Calculate alternative 64 bit integer sizes
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
# Decide how to get the name of the curently executing function.
# -------------------------------------------------------------
AC_DEFUN([CIT_FUNCTIONSTRING], [
set_function_name=no
AC_MSG_CHECKING([whether C compiler defines __func__])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[const char* name = __func__;]])],
[AC_MSG_RESULT(yes)
set_function_name=yes
AC_DEFINE([FUNCTION_NAME], [__func__], [Variable holding current function name.])],
[AC_MSG_RESULT(no)])
if test "$set_function_name" == no; then
AC_MSG_CHECKING([whether C compiler defines __FUNCTION__])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[const char* name = __FUNCTION__;]])],
[AC_MSG_RESULT(yes)
set_function_name=yes
AC_DEFINE([FUNCTION_NAME], [__FUNCTION__], [Variable holding current function name.])],
[AC_MSG_RESULT(no)])
fi
])
CIT_FUNCTIONSTRING
# Find an absolute path to the Perl binary, augmenting the path with the
# location of the Starlink Perl build. If this fails, then set @PERL@
# to the backup `/usr/bin/env perl', which will find Perl if it exists
# in the path at runtime.
AC_PATH_PROG(PERL, perl, [/usr/bin/env perl], [$STARLINK/Perl/bin:$PATH])
# Function and declaration checks
AC_CHECK_FUNCS([isnan])
AC_CHECK_DECLS([isnan],,,[#include <math.h>
])
AC_CHECK_FUNCS([isfinite])
AC_CHECK_DECLS([isfinite],,,[#include <math.h>
])
STAR_DECLARE_DEPENDENCIES(sourceset, [sst htx])
# Perform the check that configures f77.h.in for the return type of REAL
# Fortran functions. On 64-bit g77 with f2c compatibility this is double
# not float.
if test "$use_fortran" = "1"; then
STAR_CNF_F2C_COMPATIBLE
# Determine the type of Fortran character string lengths.
STAR_CNF_TRAIL_TYPE
fi
# Declare the message file.
STAR_MESSGEN(ast_err.msg)
# Test for non-ANSI behaviour in sscanf on some platforms, reported by
# Bill Joye. Also check for bad MINGW sscanf. That returns nc=0 in the
# System test.
AC_MSG_CHECKING([whether the sscanf function is ANSI-compatible])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
int main() {
char foo[] = " name 1111.1 ";
char mingw[] = "system= FK4_NO_E";
char bar[8];
float ff;
int system;
int nc;
int r;
nc = 0;
r = sscanf(foo, " %s %f %n", bar, &ff, &nc);
if ( nc == 13 ) {
nc = 0;
r = sscanf( mingw, "system= %n%*s %n", &system, &nc );
if ( nc != 0 ) nc = 13;
}
exit( ( nc != 13 ) ? 0 : 1 );
}
]])],[
AC_MSG_RESULT([no]);AC_DEFINE([HAVE_NONANSI_SSCANF],[1],[The sscanf shows the non-ANSI behaviour reported by Bill Joye])
],[AC_MSG_RESULT([yes])],[
AC_DEFINE([HAVE_NONANSI_SSCANF],[1],[The sscanf may show the non-ANSI behaviour reported by Bill Joye])
])
# Declare the documentation. We need to do complicated things to
# satisfy these targets, so give a non-null value
# for the second argument, to suppress automatic generation of
# rules.
STAR_LATEX_DOCUMENTATION([sun211])
STAR_PREDIST_SOURCES(sun_master.tex)
STAR_CHECK_PROGS(star2html)
STAR_CHECK_PROGS(prolat, sst) # prolat is part of SST
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_FILES(Makefile component.xml ast_link ast_link_adam src/object.h)
if test "$use_fortran" = "1"; then
AC_CONFIG_FILES(src/f77.h)
fi
AC_CONFIG_FILES([ast_cpp], [chmod +x ast_cpp])
# Following are files which are substituted by the Makefile at
# distribution time, rather than by configure. They are not distributed.
STAR_PREDIST_SOURCES(src/version.h.in builddocs.in addversion.in)
AC_OUTPUT
|