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

Last change on this file since 18350 was 18347, checked in by tbretz, 9 years ago
File size: 5.1 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.3],[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
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=:
121fi
122
123dnl Declare the build and use dependencies for this package
124STAR_DECLARE_DEPENDENCIES(build, [erfa starutil])
125STAR_DECLARE_DEPENDENCIES(link, [erfa starutil])
126
127dnl List the sun/ssn/... numbers which document this package and
128dnl which are present as .tex files in this directory.
129STAR_LATEX_DOCUMENTATION(sun267)
130
131dnl If you wish to configure extra files, you can add them to this
132dnl declaration.
133AC_CONFIG_FILES(Makefile component.xml)
134AC_CONFIG_HEADERS( config.h )
135
136dnl This is the bit that does the actual work
137AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.