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