File: configure.ac

package info (click to toggle)
healpix-cxx 3.60.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,700 kB
  • sloc: cpp: 14,223; sh: 4,451; makefile: 183
file content (127 lines) | stat: -rw-r--r-- 4,390 bytes parent folder | download
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
AC_INIT([healpix_cxx], [3.60.0])
AM_INIT_AUTOMAKE([foreign serial-tests subdir-objects -Wall -Werror])
AM_MAINTAINER_MODE([enable])

dnl
dnl Needed for linking on Windows.
dnl Protect with m4_ifdef because AM_PROG_AR is required in
dnl autoconf >= 1.12 when using -Wall, but the macro is
dnl absent in old versions of autoconf.
dnl
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

LT_INIT
AC_CONFIG_MACRO_DIR([m4])

dnl
dnl By default, install the headers into a subdirectory of
dnl ${prefix}/include to avoid possible header filename collisions.
dnl
includedir="${includedir}/${PACKAGE_NAME}"

dnl
dnl Enable silent build rules if this version of Automake supports them
dnl
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_PROG_CC_C99
AC_OPENMP
CPPFLAGS="$CPPFLAGS $OPENMP_CFLAGS"
CFLAGS="$CFLAGS $OPENMP_CFLAGS"

AC_PROG_CXX
AC_LANG_PUSH([C++])
AX_CXX_COMPILE_STDCXX_11
AC_OPENMP
CXXFLAGS="$CXXFLAGS $OPENMP_CFLAGS"
AC_LANG_POP([C++])

dnl
dnl Determine the compiler flags (CFITSIO_CFLAGS)
dnl and linker flags (CFITSIO_LIBS) required to build against libcfitsio.
dnl
dnl Add help messages to describe the variables CFITSIO_CFLAGS and CFITSIO_LIBS,
dnl which can be provided as environment variables or as command-line arguments.
dnl These are output variables of PKG_CHECK_MODULES, but they can be overridden.
dnl
AC_ARG_VAR([CFITSIO_CFLAGS], [compiler flags needed for building with cfitsio, if not found by pkg-config])
AC_ARG_VAR([CFITSIO_LIBS], [linker flags needed for building with cfitsio, if not found by pkg-config])
dnl
dnl Now check for cfitsio using pkg-config. If cfitsio is not found with
dnl pkg-config, CFITSIO_LIBS defaults to "-lcfitsio".
dnl
PKG_CHECK_MODULES([CFITSIO], [cfitsio], , [CFITSIO_LIBS=-lcfitsio])
dnl
dnl Linking against libcfitsio requires libm too.
dnl
CFITSIO_LIBS="$CFITSIO_LIBS -lm"
dnl
dnl With pkg-config < 0.24, PKG_CHECK_MODULES does not AC_SUBST the _CFLAGS
dnl and _LIBS variables.
dnl
AC_SUBST([CFITSIO_CFLAGS])
AC_SUBST([CFITSIO_LIBS])
dnl
dnl Perform a test compile and link to determine if cfitsio is usable. If
dnl pkg-config did not find cfitsio, then the user may still have provided
dnl CFITSIO_CFLAGS and CFITSIO_LIBS manually. If pkg-config did find cfitsio,
dnl it does not hurt to test that cfitsio is usable.
dnl
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="$CFLAGS $CFITSIO_CFLAGS"
LIBS="$LIBS $CFITSIO_LIBS"
AC_CHECK_LIB([cfitsio], [ffgnrwll], [:], AC_MSG_ERROR([could not find the cfitsio library]))
AC_CHECK_HEADERS([fitsio.h], [:], AC_MSG_ERROR([could not find the cfitsio header file]))
CFLAGS=$save_CFLAGS
LIBS=$save_LIBS

dnl
dnl Determine the compiler flags (SHARP_CFLAGS)
dnl and linker flags (SHARP_LIBS) required to build against libcfitsio.
dnl
dnl Add help messages to describe the variables SHARP_CFLAGS and SHARP_LIBS,
dnl which can be provided as environment variables or as command-line arguments.
dnl These are output variables of PKG_CHECK_MODULES, but they can be overridden.
dnl
AC_ARG_VAR([SHARP_CFLAGS], [compiler flags needed for building with libsharp, if not found by pkg-config])
AC_ARG_VAR([SHARP_LIBS], [linker flags needed for building with libsharp, if not found by pkg-config])
dnl
dnl Now check for libsharp using pkg-config. If libsharp is not found with
dnl pkg-config, SHARP_LIBS defaults to "-lsharp".
dnl
PKG_CHECK_MODULES([SHARP], [libsharp], , [SHARP_LIBS=-lsharp])
dnl
dnl Linking against libsharp requires libm too.
dnl
SHARP_LIBS="$SHARP_LIBS -lm"
dnl
dnl With pkg-config < 0.24, PKG_CHECK_MODULES does not AC_SUBST the _CFLAGS
dnl and _LIBS variables.
dnl
AC_SUBST([SHARP_CFLAGS])
AC_SUBST([SHARP_LIBS])
dnl
dnl Perform a test compile and link to determine if libsharp is usable. If
dnl pkg-config did not find libsharp, then the user may still have provided
dnl SHARP_CFLAGS and SHARP_LIBS manually. If pkg-config did find libsharp,
dnl it does not hurt to test that libsharp is usable.
dnl
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="$CFLAGS $SHARP_CFLAGS"
LIBS="$LIBS $SHARP_LIBS"
AC_CHECK_LIB([sharp], [sharp_execute], [:], AC_MSG_ERROR([could not find the libsharp library]))
AC_CHECK_HEADERS([libsharp/sharp.h], [:], AC_MSG_ERROR([could not find the libsharp header file]))
CFLAGS=$save_CFLAGS
LIBS=$save_LIBS

AC_PROG_LIBTOOL

dnl
dnl Create pkgconfig .pc file.
dnl
AX_CREATE_PKGCONFIG_INFO(,,,,[$OPENMP_CFLAGS $SHARP_CFLAGS $CFITSIO_CFLAGS])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT