This repository has been archived by the owner on Jan 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
132 lines (120 loc) · 3.75 KB
/
configure.ac
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
# This file is an input file used by the GNU "autoconf" program to
# generate the file "configure", which is run during installation
# to configure the system for the local environment.
AC_INIT(regions, 1.0, [email protected])
AC_CONFIG_SRCDIR([./regions.h])
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_RANLIB
m4_include([m4/ac_prog_ar.m4])
AC_PROG_AR
AC_PROG_AWK
AC_CHECK_FUNCS(setenv)
AC_CHECK_SIZEOF([void *])
case $ac_cv_sizeof_void_p in
8) LSUFFIX="64";;
esac
AC_EXEEXT
if test x"${EXEEXT}" = "xno"; then
EXEEXT=""
fi
# check for external cfitsio libraries
havelib=0
AC_MSG_CHECKING(for cfitsio)
AC_ARG_WITH(cfitsio,
[--with-cfitsio=<path> cfitsio top-level directory], havelib=1, havelib=0)
if test x"$havelib" = x1 ; then
CFITSIOBASE=$withval
# make sure essential libraries are present
if test -r $CFITSIOBASE/lib$LSUFFIX/libcfitsio.a -o \
-r $CFITSIOBASE/lib$LSUFFIX/libcfitsio.so -o \
-r $CFITSIOBASE/lib$LSUFFIX/libcfitsio.dylib; then
CFITSIOINC=$CFITSIOBASE/include
CFITSIOLIB=$CFITSIOBASE/lib$LSUFFIX
AC_MSG_RESULT(yes ($CFITSIOBASE))
elif test -r $CFITSIOBASE/lib/libcfitsio.a -o \
-r $CFITSIOBASE/lib/libcfitsio.so -o \
-r $CFITSIOBASE/lib/libcfitsio.dylib; then
CFITSIOINC=$CFITSIOBASE/include
CFITSIOLIB=$CFITSIOBASE/lib
AC_MSG_RESULT(yes ($CFITSIOBASE))
elif test -r $CFITSIOBASE/libcfitsio.a -o \
-r $CFITSIOBASE/libcfitsio.so -o \
-r $CFITSIOBASE/libcfitsio.dylib; then
CFITSIOINC=$CFITSIOBASE
CFITSIOLIB=$CFITSIOBASE
AC_MSG_RESULT(yes ($CFITSIOBASE))
else
AC_MSG_ERROR([cannot find CFITSIO library files])
fi
if test x$CFITSIOINC != x; then
EXTRA_INCS="$EXTRA_INCS -I$CFITSIOINC"
fi
if test x$CFITSIOLIB != x; then
EXTRA_LIBS="$EXTRA_LIBS -L$CFITSIOLIB -lcfitsio -lcurl"
fi
fi
if test x"$havelib" = x0 ; then
AC_CHECK_LIB(cfitsio, ffopentest, havelib=1, havelib=0, -lm)
if test x"$havelib" = x1 ; then
EXTRA_LIBS="$EXTRA_LIBS -lcfitsio -lcurl"
else
AC_MSG_ERROR([--with-cfitsio=<path> is required to specify the CFITSIO library])
fi
fi
# cfitsio 4.0.0 no longer supplies zlib routines if they are installed
AC_CHECK_LIB(z, inflate, EXTRA_LIBS="$EXTRA_LIBS -lz")
AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
if test "$have_dl" = yes; then
dofpic="yes"
HAVE_DL="-DHAVE_DL=1"
EXTRA_LIBS="$EXTRA_LIBS -ldl"
if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
LDFLAGS="$LDFLAGS -rdynamic"
fi
fi
AC_SUBST(HAVE_DL)
AC_MSG_CHECKING([${host_os}-specific configuration])
case $host_os in
*cygwin*|*Cygwin* )
CFLAGS="$CFLAGS -enable-auto-import"
AC_MSG_RESULT(Cygwin configuration)
;;
*mingw32*|*Mingw32*)
CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
AC_MSG_RESULT(MinGW configuration)
;;
*solaris*|*sunos*)
EXTRA_LIBS="$EXTRA_LIBS -lsocket -lnsl"
AC_MSG_RESULT(SunOS configuration)
;;
*) AC_MSG_RESULT(none)
;;
esac
AC_MSG_CHECKING([compiler-specific configuration])
case $CC in
*gcc*)
if test x"$dofpic" = x"yes" ; then
CFLAGS="$CFLAGS -fPIC"
AC_MSG_RESULT(adding -fPIC to gcc)
fi
;;
*) AC_MSG_RESULT(none)
;;
esac
AC_MSG_CHECKING(for regions compiler)
AC_ARG_WITH(regions-cc, [ --with-regions-cc=CC compiler],
REGIONS_CC=\\\"$withval\\\", REGIONS_CC=NULL)
AC_MSG_RESULT($REGIONS_CC)
AC_SUBST(REGIONS_CC)
AC_MSG_CHECKING(for regions cflags)
AC_ARG_WITH(regions-cflags, [ --with-regions-cflags=CFLAGS compiler flags],
REGIONS_CFLAGS=\\\"$withval\\\", REGIONS_CFLAGS=\\\"-O2\\\")
AC_MSG_RESULT($REGIONS_CFLAGS)
AC_SUBST(REGIONS_CFLAGS)
AC_SUBST(EXTRA_INCS)
AC_SUBST(EXTRA_LIBS)
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(regions.pc)
AC_OUTPUT