forked from OSGeo/PROJ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
140 lines (106 loc) · 3.94 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
133
134
135
136
137
138
139
140
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([PROJ.4 Projections], 4.9.3, [warmerdam@pobox.com], proj)
AC_CONFIG_MACRO_DIR([m4])
AC_LANG(C)
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(src/proj_config.h)
dnl Enable as much warnings as possible
AX_CFLAGS_WARN_ALL(C_WFLAGS)
AC_SUBST(C_WFLAGS,$C_WFLAGS)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
dnl Checks for libraries.
save_CFLAGS="$CFLAGS"
CFLAGS=`echo "$CFLAGS" | sed "s/-Werror/ /"`
AC_CHECK_LIB(m,exp,,,)
CFLAGS="$save_CFLAGS"
dnl We check for headers
AC_HEADER_STDC
dnl Check for C99 math functions
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_MSG_CHECKING([for C99 math functions])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[#include <math.h>],
[int q;
return (int)(hypot(3.0, 4.0) + atanh(0.8) + cbrt(8.0) +
remquo(100.0, 90.0, &q) +
remainder(100.0, 90.0) + copysign(1.0, -0.0));])],
[AC_MSG_RESULT([yes]);C99_MATH="-DHAVE_C99_MATH=1"],
[AC_MSG_RESULT([no]);C99_MATH="-DHAVE_C99_MATH=0"])
CFLAGS="$save_CFLAGS $C99_MATH"
AC_CHECK_FUNC(localeconv, [AC_DEFINE(HAVE_LOCALECONV,1,[Define to 1 if you have localeconv])])
dnl ---------------------------------------------------------------------------
dnl Check for JNI support.
dnl ---------------------------------------------------------------------------
JNI_INCLUDE=
export JNI_INCLUDE
AC_ARG_WITH(jni,
[AS_HELP_STRING([--with-jni=dir],
[Include Java/JNI support, add optional include dir])
],,)
if test "$with_jni" = "yes" ; then
AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])
AC_MSG_CHECKING(whether to enable Java/JNI support)
AC_MSG_RESULT([enabled])
elif test "$with_jni" != "no" -a "$with_jni" != "" ; then
AC_MSG_CHECKING(whether to enable Java/JNI support)
if test \! -r "$with_jni/jni.h" ; then
AC_MSG_ERROR(Did not find $with_jni/jni.h)
fi
AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])
AC_MSG_RESULT([enabled])
JNI_INCLUDE="-I$with_jni"
elif test "$with_jni" = "" ; then
AC_CHECK_HEADERS(jni.h)
AC_MSG_CHECKING(whether to enable Java/JNI support)
if test "$ac_cv_header_jni_h" = "no" ; then
AC_MSG_RESULT([disabled])
else
AC_MSG_RESULT([enabled])
AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])
fi
else
AC_MSG_CHECKING(whether to enable Java/JNI support)
AC_MSG_RESULT([disabled])
fi
AC_SUBST(JNI_INCLUDE,$JNI_INCLUDE)
dnl ---------------------------------------------------------------------------
dnl Provide a mechanism to disable real mutex support (if lacking win32 or
dnl posix mutexes for instance).
dnl ---------------------------------------------------------------------------
AC_ARG_WITH([mutex],
AS_HELP_STRING([--without-mutex],
[Disable real mutex locks (lacking pthreads)]),,)
AC_MSG_CHECKING([for mutexes])
THREAD_LIB=""
if test "$with_mutex" = yes -o x"$with_mutex" = x ; then
MUTEX_SETTING=pthread
AC_CHECK_LIB(pthread,pthread_create,PTHREAD_EXISTS=YES,,,)
if test -n "$PTHREAD_EXISTS" ; then
THREAD_LIB="-lpthread"
fi
AC_CHECK_LIB(pthread,pthread_mutexattr_settype,,,)
AC_CHECK_DECL(PTHREAD_MUTEX_RECURSIVE,
AC_DEFINE(HAVE_PTHREAD_MUTEX_RECURSIVE, [], [Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE]),
,
[#include <pthread.h>])
AC_MSG_RESULT([enabled, pthread])
else
MUTEX_SETTING=stub
AC_MSG_RESULT([disabled by user])
fi
AC_SUBST(MUTEX_SETTING,$MUTEX_SETTING)
AC_SUBST(THREAD_LIB,$THREAD_LIB)
AC_CONFIG_FILES([Makefile cmake/Makefile src/Makefile
man/Makefile man/man1/Makefile man/man3/Makefile nad/Makefile
jniwrap/Makefile jniwrap/org/Makefile jniwrap/org/proj4/Makefile])
AC_CONFIG_FILES([nad/install], [chmod +x nad/install])
AC_CONFIG_FILES([proj.pc])
AC_OUTPUT