-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
276 lines (241 loc) · 6.92 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
AC_INIT
AC_CONFIG_SRCDIR([src/gts.h])
dnl we to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they
dnl are available for $ac_help expansion (don't we all *love* autoconf?)
#AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
# Making releases:
# GTS_MICRO_VERSION += 1;
# GTS_INTERFACE_AGE += 1;
# GTS_BINARY_AGE += 1;
# if any functions have been added, set GTS_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set GTS_BINARY_AGE and GTS_INTERFACE_AGE to 0.
#
GTS_MAJOR_VERSION=0
GTS_MINOR_VERSION=7
GTS_MICRO_VERSION=6
GTS_INTERFACE_AGE=1
GTS_BINARY_AGE=1
GTS_VERSION=$GTS_MAJOR_VERSION.$GTS_MINOR_VERSION.$GTS_MICRO_VERSION
dnl
#AC_DIVERT_POP()dnl
AC_SUBST(GTS_MAJOR_VERSION)
AC_SUBST(GTS_MINOR_VERSION)
AC_SUBST(GTS_MICRO_VERSION)
AC_SUBST(GTS_VERSION)
# libtool versioning
LT_RELEASE=$GTS_MAJOR_VERSION.$GTS_MINOR_VERSION
LT_CURRENT=`expr $GTS_MICRO_VERSION - $GTS_INTERFACE_AGE`
LT_REVISION=$GTS_INTERFACE_AGE
LT_AGE=`expr $GTS_BINARY_AGE - $GTS_INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
# For automake.
VERSION=$GTS_VERSION
PACKAGE=gts
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
# Specify a configuration file
AM_CONFIG_HEADER(config.h)
AC_DEFINE_UNQUOTED(GTS_MAJOR_VERSION, $GTS_MAJOR_VERSION, [Major version])
AC_DEFINE_UNQUOTED(GTS_MINOR_VERSION, $GTS_MINOR_VERSION, [Minor version])
AC_DEFINE_UNQUOTED(GTS_MICRO_VERSION, $GTS_MICRO_VERSION, [Micro version])
AC_DEFINE_UNQUOTED(GTS_INTERFACE_AGE, $GTS_INTERFACE_AGE, [Interface age])
AC_DEFINE_UNQUOTED(GTS_BINARY_AGE, $GTS_BINARY_AGE, [Binary age])
dnl Initialize libtool
AM_PROG_LIBTOOL
dnl Initialize maintainer mode
AM_MAINTAINER_MODE
AC_PROG_CC
if test x$GCC = xyes ; then
CFLAGS="$CFLAGS -Wall -Werror-implicit-function-declaration -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
fi
AC_PROG_AWK
AC_ISC_POSIX
AC_HEADER_STDC
AC_CHECK_HEADER(pgm.h, netpbm="true", netpbm="false")
if test x$netpbm = xfalse ; then
AC_CHECK_HEADER(netpbm/pgm.h,
[netpbm="true"
AC_DEFINE(NETPBM_INCLUDE, 1,
[Define if netpbm include files are in netpbm/.])],
netpbm="false")
fi
if test x$netpbm = xtrue ; then
AC_CHECK_LIB(netpbm, pgm_init, netpbm="true", netpbm="false", [-lm])
fi
if test x$netpbm = xfalse ; then
AC_MSG_WARN([libnetpbm not found. Some programs will not be available.])
fi
AM_CONDITIONAL(HAS_NETPBM, test x$netpbm = xtrue)
AM_PATH_GLIB_2_0(2.4.0, has_glib2=yes, has_glib2=no, gthread gmodule)
if test x$has_glib2 = xyes; then
glib_cflags=`$PKG_CONFIG glib-2.0 --cflags`
glib_thread_cflags=`$PKG_CONFIG glib-2.0 --cflags gthread-2.0`
glib_module_cflags=`$PKG_CONFIG glib-2.0 --cflags gmodule-2.0`
glib_libs=`$PKG_CONFIG glib-2.0 --libs`
glib_thread_libs=`$PKG_CONFIG glib-2.0 --libs gthread-2.0`
glib_module_libs=`$PKG_CONFIG glib-2.0 --libs gmodule-2.0`
GLIB_LIBS="$glib_libs"
GLIB_DEPLIBS="$glib_libs"
else
if test x$with_glib = xyes ; then
AC_MSG_ERROR([
*** Directory must be specified for --with-glib])
fi
if test x$with_glib = x ; then
# Look for separately installed glib
GLIB_REQUIRED_VERSION=1.2.8
AM_PATH_GLIB($GLIB_REQUIRED_VERSION,,
AC_MSG_ERROR([
*** GLIB $GLIB_REQUIRED_VERSION or better is required. The latest version of GLIB
*** is always available from ftp://ftp.gtk.org/.]),
gmodule gthread)
glib_cflags=`$GLIB_CONFIG --cflags`
glib_thread_cflags=`$GLIB_CONFIG --cflags gthread`
glib_module_cflags=`$GLIB_CONFIG --cflags gmodule`
glib_libs=`$GLIB_CONFIG --libs`
glib_thread_libs=`$GLIB_CONFIG --libs gthread`
glib_module_libs=`$GLIB_CONFIG --libs gmodule`
GLIB_LIBS="$glib_libs"
GLIB_DEPLIBS="$glib_libs"
else
# Use uninstalled glib (assume they got the version right)
GLIB_CONFIG=$with_glib/glib-config
if test -x $GLIB_CONFIG ; then
:
else
AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
fi
# For use in gts-config
glib_cflags=`$GLIB_CONFIG --cflags`
glib_thread_cflags=`$GLIB_CONFIG --cflags gthread`
glib_module_cflags=`$GLIB_CONFIG --cflags gmodule`
glib_libs=`$GLIB_CONFIG --libs`
glib_thread_libs=`$GLIB_CONFIG --libs gthread`
glib_module_libs=`$GLIB_CONFIG --libs gmodule`
glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
# canonicalize relative paths
case $with_glib in
/*)
glib_dir=$with_glib
;;
*)
glib_dir="\$(top_builddir)/$with_glib"
;;
esac
GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule.la"
GLIB_DEPLIBS=
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
fi
fi
AC_SUBST(glib_cflags)
AC_SUBST(glib_libs)
AC_SUBST(glib_thread_cflags)
AC_SUBST(glib_thread_libs)
AC_SUBST(glib_module_cflags)
AC_SUBST(glib_module_libs)
AC_SUBST(GLIB_DEPLIBS)
CFLAGS="$CFLAGS $glib_cflags"
LDFLAGS="$LDFLAGS $glib_libs"
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
dnl generate `src/gtsconfig.h'
AC_CONFIG_COMMANDS([default-1],[[
echo creating src/gtsconfig.h
cat >src/gtsconfig.h <<\__EOF
/* gtsconfig.h
*
* This is a generated file. Please modify `configure.ac'
*/
#ifndef GTSCONFIG_H
#define GTSCONFIG_H
__EOF
case "$build" in
*-cray-unicos*)
echo "/* CRAY inlining directives */" >> src/gtsconfig.h
awk '
BEGIN {
nc = 10;
nf = 0;
}
{
if ($1 == "G_INLINE_FUNC") {
nc = 0;
start = 2;
}
else
start = 1;
for (i = start; i <= NF; i++) {
if (nc == 1) {
if (substr ($i, 1, 1) != "*") {
in_list = 0;
for (j = 0; j < nf && !inlist; j++)
if ($i == f[j])
inlist = 1;
if (!inlist)
f[nf++] = $i;
nc = 10;
}
}
else
nc++;
}
}
END {
if (nf > 0) {
printf ("#pragma _CRI inline %s", f[0]);
for (i = 1; i < nf; i++)
printf (", %s", f[i]);
printf ("\n");
}
}
' < src/gts.h >> src/gtsconfig.h
;;
esac
cat >>src/gtsconfig.h <<__EOF
$gts_defines
#endif /* GTSCONFIG_H */
__EOF
]],[[
gts_defines="
#define GTS_MAJOR_VERSION $GTS_MAJOR_VERSION
#define GTS_MINOR_VERSION $GTS_MINOR_VERSION
#define GTS_MICRO_VERSION $GTS_MICRO_VERSION"
build="$build"
]])
dnl checking for #warning cpp directive
AC_TRY_COMPILE(,
"{
#warning test
}",
AC_DEFINE(CPP_HAS_WARNING, 1,
[Define if C preprocessor supports warning directive.]),
AC_MSG_WARN(["C preprocessor does not support warning directive."]))
dnl header file checks
AC_CHECK_HEADERS(fpu_control.h, AC_DEFINE(HAVE_FPU_CONTROL_H))
AC_CHECK_HEADERS(floatingpoint.h, AC_DEFINE(HAVE_FLOATINGPOINT_H))
AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
AC_CHECK_HEADERS(getopt.h, AC_DEFINE(HAVE_GETOPT_H))
dnl functions checks
AC_CHECK_FUNCS(getopt_long)
AC_CONFIG_FILES([
Makefile
gts.pc
src/Makefile
src/gts-config
tools/Makefile
doc/Makefile
doc/manpages/Makefile
examples/Makefile
test/Makefile
test/boolean/Makefile
test/delaunay/Makefile
test/coarsen/Makefile
debian/Makefile
])
AC_OUTPUT