source: trunk/FACT++/pal/configure.ac@ 19594

Last change on this file since 19594 was 18712, checked in by tbretz, 8 years ago
Updated to PAL 0.9.7 (adds mainly light deflection to abberation which was previously missing)
File size: 5.2 KB
Line 
1dnl Process this file with autoconf to produce a configure script
2AC_REVISION($Revision: 27534 $)
3
4dnl Initialisation: package name and version number
5AC_INIT([pal],[0.9.7],[starlink@jiscmail.ac.uk])
6AC_CONFIG_AUX_DIR([build-aux])
7
8dnl Require autoconf-2.50 at least
9AC_PREREQ([2.69])
10dnl Require Starlink automake
11AM_INIT_AUTOMAKE(1.8.2-starlink)
12
13dnl Sanity-check: name a file in the source directory -- if this
14dnl isn't found then configure will complain
15AC_CONFIG_SRCDIR([pal.h])
16
17dnl Include defaults for Starlink configurations
18STAR_DEFAULTS
19
20dnl Would like the version number as an integer
21AC_DEFINE_UNQUOTED([PACKAGE_VERSION_INTEGER], $PACKAGE_VERSION_INTEGER,
22 [Integer version number, in the form major*1e6+minor*1e3+release])
23
24dnl Find required versions of the programs we need for configuration
25AC_PROG_CC
26LT_INIT
27
28# If --with-pic=no is set we should honour that.
29AM_CONDITIONAL(NOPIC, test x$pic_mode = xno)
30
31dnl copysign and isblank are a c99 feature
32AC_CHECK_FUNCS(copysign)
33AC_CHECK_FUNCS(isblank)
34
35dnl Use strlcpy if it is available
36AC_SEARCH_LIBS([strlcpy], [bsd])
37AS_IF([test "x$ac_cv_search_strlcpy" = "x-lbsd"], [AC_CHECK_HEADERS([bsd/string.h])])
38AC_CHECK_FUNCS([strlcpy])
39
40# Need the math library
41AC_CHECK_LIB([m],[sin])
42
43dnl We can not simply test for Starlink starutil because
44dnl when configure runs in a Starlink build starutil will not
45dnl have been built yet. If --without-starlink has been used
46dnl $STARLINK will be unset but to play safe we also check STARCONF_DEFAULT_PREFIX
47dnl If we do not have Starlink we can do the test anyhow just in case
48
49if test -n "$STARCONF_DEFAULT_PREFIX" -a -n "$STARLINK"
50then
51 AC_MSG_NOTICE([Assuming a Starlink environment])
52 AC_SUBST( STARUTIL_LIBADD, "${libdir}/libstarutil.la" )
53 AC_SUBST( ERFA_LIBADD, "${libdir}/liberfa.la" )
54 AC_SUBST( ERFA_LDFLAGS, "" )
55 AC_DEFINE( [HAVE_STAR_UTIL_H], [1], [Define to 1 if you have the <star/util.h> header file])
56else
57 AC_MSG_NOTICE([Building outside a Starlink environment])
58
59 # Allow ERFA/SOFA location to be specified using --with-erfa=$ERFA_DIR
60 # Assumes that the value supplied here is the root and lib and include directories
61 # are below it. --with-erfa=no or --without-erfa will result in ERFA being
62 # located in $PREFIX tree. This option is only effective if Starlink is not
63 # active.
64 AC_ARG_WITH(erfa,
65 AS_HELP_STRING([--with-erfa],
66 [Location of ERFA/SOFA tree]),
67 [if test -z "$withval" -o "$withval" = yes; then
68 unset ERFA_DIR
69 elif test "X$withval" = Xno; then
70 unset ERFA_DIR
71 elif test -d "$withval"; then
72 ERFA_DIR="$withval"
73 else
74 unset ERFA_DIR
75 AC_MSG_WARN([--with-erfa given nonexistent directory; ignored: using default instead])
76 fi])
77 if test -n "$ERFA_DIR"; then
78 AC_MSG_NOTICE([ERFA/SOFA tree located at $ERFA_DIR])
79 erfa_includedir="${ERFA_DIR}/include"
80 erfa_libdir="${ERFA_DIR}/lib"
81 else
82 ERFA_DIR=${prefix}
83 erfa_includedir=${includedir}
84 erfa_libdir=${libdir}
85 AC_MSG_NOTICE([Looking for ERFA/SOFA in default location of $ERFA_DIR])
86 fi
87
88 dnl AC_CHECK_HEADERS does not search $includedir
89 save_CPPFLAGS="$CPPFLAGS"
90 eval CPPFLAGS=\"$CPPFLAGS -I${includedir} -I${erfa_includedir}\"
91 eval CPPFLAGS=\"$CPPFLAGS\"
92 AC_CHECK_HEADERS( star/util.h )
93 CPPFLAGS="$save_CPPFLAGS"
94
95 dnl for some reason AC_CHECK_LIB does not look in the --prefix hierarchy so
96 dnl $libdir is not searched.
97 dnl and we use eval twice to convert $libdir -> $exec_prefix/lib -> $prefix/lib
98 save_LDFLAGS="$LDFLAGS"
99 eval LDFLAGS=\"$LDFLAGS -L${libdir} -L${erfa_libdir}\"
100 eval LDFLAGS=\"$LDFLAGS\"
101
102 AC_CHECK_LIB([starutil],[star_strlcpy],
103 [AC_SUBST(STARUTIL_LIBADD, "-lstarutil")],
104 [AC_SUBST(STARUTIL_LIBADD, "")])
105
106 AC_CHECK_LIB([erfa],[eraCal2jd],
107 [AC_SUBST(ERFA_LIBADD, "-lerfa")],
108 [
109 AC_CHECK_LIB([sofa_c],[iauCal2jd],
110 [AC_SUBST(ERFA_LIBADD, "-lsofa_c")
111 AC_DEFINE([HAVE_SOFA_H],[1],"Build with SOFA library")],
112 [AC_MSG_ERROR(Neither ERFA nor SOFA library located. Can not continue)])
113 ])
114 LDFLAGS="$save_LDFLAGS"
115
116 dnl Ensure that we use the $prefix values and the ERFA values
117 AC_SUBST( ERFA_LDFLAGS, "-L${libdir} -L${erfa_libdir}" )
118 AC_SUBST( ERFA_CPPFLAGS, "-I${includedir} -I${erfa_includedir}" )
119
120 dnl Disable document building regardless of --without-stardocs
121 _star_build_docs=false
122fi
123
124dnl Declare the build and use dependencies for this package
125STAR_DECLARE_DEPENDENCIES(build, [erfa starutil])
126STAR_DECLARE_DEPENDENCIES(link, [erfa starutil])
127
128dnl List the sun/ssn/... numbers which document this package and
129dnl which are present as .tex files in this directory.
130STAR_LATEX_DOCUMENTATION(sun267)
131
132dnl If you wish to configure extra files, you can add them to this
133dnl declaration.
134AC_CONFIG_FILES(Makefile component.xml)
135AC_CONFIG_HEADERS( config.h )
136
137dnl This is the bit that does the actual work
138AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.