-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathacinclude.m4
More file actions
529 lines (470 loc) · 13.1 KB
/
Copy pathacinclude.m4
File metadata and controls
529 lines (470 loc) · 13.1 KB
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
dnl acinclude.m4 -- various bits of this have been borrowed from the m4
dnl configuration files for KDE and GNOME
AC_DEFUN([AC_INSTALL_DIRS],
[
AC_MSG_CHECKING(the fax spool directory)
dnl set up the defaults
SPOOLDIR="/var/spool/fax"
AC_ARG_WITH(spooldir,
[ --with-spooldir=DIR Where fax printer filter is installed (default is /var/spool/fax)],
[
if test "$withval" != "no"; dnl
then SPOOLDIR="$withval"
fi
])
AC_MSG_RESULT([SPOOLDIR is $SPOOLDIR])
AC_SUBST(SPOOLDIR)
])
dnl By checking for the libraries to be linked against this
dnl only checks for dynamic linking and therefore may not
dnl be very useful
AC_DEFUN([AC_CHECK_GTHREAD_HAS_PTHREADS],
[
AC_CACHE_VAL(ac_cv_gthread_has_pthreads, [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(whether glib compiled against pthreads)
GT_LIBS=`$PKG_CONFIG --libs "gthread-2.0"`
T_STRING=${GT_LIBS%pthread*}
if test ${#GT_LIBS} -gt ${#T_STRING}; then
succeeded=yes
fi
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ac_cv_gthread_has_pthreads="yes"
AC_MSG_RESULT(yes)
else
ac_cv_gthread_has_pthreads="no"
AC_MSG_ERROR([glib does not appear to be compiled against pthreads])
fi
])
])
AC_DEFUN([AC_CHECK_HAVE_IOS_NOCREATE],
[
AC_MSG_CHECKING(for fstream ios::nocreate flag)
AC_CACHE_VAL(ac_cv_have_ios_nocreate,
[
AC_LANG_CPLUSPLUS
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
[
#include <fstream>
],
[
std::fstream strm("dummy.txt", std::ios::in | std::ios::nocreate);
])
],
[ac_cv_have_ios_nocreate="yes"],
[ac_cv_have_ios_nocreate="no"]
) dnl end AC_COMPILE_IFELSE
])
AC_MSG_RESULT([$ac_cv_have_ios_nocreate])
if test "$ac_cv_have_ios_nocreate" = "yes" ; then
AC_DEFINE(HAVE_IOS_NOCREATE, 1, [ Define if the C++ fstream object has ios::nocreate ])
fi
])
AC_DEFUN([AC_CHECK_HAVE_ATTACH],
[
AC_MSG_CHECKING(for fstream attach)
AC_CACHE_VAL(ac_cv_have_attach,
[
AC_LANG_CPLUSPLUS
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
[
#include <fstream>
],
[
std::fstream strm;
strm.attach(1);
])
],
[ac_cv_have_attach="yes"],
[ac_cv_have_attach="no"]
) dnl end AC_COMPILE_IFELSE
])
AC_MSG_RESULT([$ac_cv_have_attach])
if test "$ac_cv_have_attach" = "yes" ; then
AC_DEFINE(HAVE_ATTACH, 1, [ Define if the C++ fstream object has fstream::attach(int fd) funtion ])
fi
])
AC_DEFUN([AC_CHECK_HAVE_STRINGSTREAM],
[
AC_MSG_CHECKING(for std::stringstream)
AC_CACHE_VAL(ac_cv_have_stringstream,
[
AC_LANG_CPLUSPLUS
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM([
#include <sstream>
],
[
std::ostringstream strm;
])
],
[ac_cv_have_stringstream="yes"],
[ac_cv_have_stringstream="no"]
) dnl end AC_COMPILE_IFELSE
])
AC_MSG_RESULT([$ac_cv_have_stringstream])
if test "$ac_cv_have_stringstream" = "yes" ; then
AC_DEFINE(HAVE_STRINGSTREAM, 1, [ Define if the C++ library contains std::stringstream ])
fi
])
AC_DEFUN([AC_CHECK_HAVE_STREAM_IMBUE],
[
AC_MSG_CHECKING(whether streams may have a locale imbued)
AC_CACHE_VAL(ac_cv_have_stream_imbue,
[
AC_LANG_CPLUSPLUS
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM([
#include <iostream>
#include <locale>
],
[
std::cout.imbue(std::locale::classic());
])
],
[ac_cv_have_stream_imbue="yes"],
[ac_cv_have_stream_imbue="no"]
) dnl end AC_COMPILE_IFELSE
])
AC_MSG_RESULT([$ac_cv_have_stream_imbue])
if test "$ac_cv_have_stream_imbue" = "yes" ; then
AC_DEFINE(HAVE_STREAM_IMBUE, 1, [ Define if the C++ library can imbue stream objects with a locale ])
fi
])
AC_DEFUN([AC_CHECK_SOCKLEN_T],
[
AC_CHECK_TYPES(socklen_t, , ,
[
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
])
])
AC_DEFUN([AC_CHECK_IN_ADDR_T],
[
AC_CHECK_TYPES(in_addr_t, , ,
[
#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
])
])
AC_DEFUN([AC_CHECK_COMPILERS],
[
AC_ARG_ENABLE(debug,[ --enable-debug creates debugging code [default=no]],
[
if test $enableval = "no"; dnl
then ac_use_debug_code="no"
else ac_use_debug_code="yes"
fi
], [ac_use_debug_code="no"])
dnl Just for configure --help
dnl this prevents stupid AC_PROG_CC from adding "-g" to the default CFLAGS
c_flags_in=$CFLAGS
AC_PROG_CC
AC_PROG_CPP
CFLAGS=$c_flags_in
if test -z "$CFLAGS"; then
if test "$GCC" = "yes"; then
if test "$ac_use_debug_code" = "yes"; then
CFLAGS="-g $CFLAGS"
else
CFLAGS="-O2 $CFLAGS"
fi
else
if test "$ac_use_debug_code" = "yes"; then
AC_CHECK_C_COMPILER_FLAG(g,
[
CFLAGS="-g $CFLAGS"
])
else
AC_CHECK_C_COMPILER_FLAG(O2,
[
CFLAGS="-O2 $CFLAGS"
])
fi
fi
AC_CHECK_C_COMPILER_FLAG(pthread,
[
CFLAGS="$CFLAGS -pthread"
])
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -Wall"
fi
fi
dnl this prevents stupid AC_PROG_CXX from adding "-g" to the default CXXFLAGS
cxx_flags_in=$CXXFLAGS
AC_PROG_CXX
AC_PROG_CXXCPP
CXXFLAGS=$cxx_flags_in
if test -z "$CXXFLAGS"; then
if test "$GXX" = "yes"; then
if test "$ac_use_debug_code" = "yes"; then
CXXFLAGS="-g $CXXFLAGS"
else
CXXFLAGS="-O2 $CXXFLAGS"
if test -z "$LDFLAGS"; then
LDFLAGS="-s"
fi
fi
else
if test "$ac_use_debug_code" = "yes"; then
AC_CHECK_COMPILER_FLAG(g,
[
CXXFLAGS="-g $CXXFLAGS"
])
else
AC_CHECK_COMPILER_FLAG(O2,
[
CXXFLAGS="-O2 $CXXFLAGS"
])
fi
fi
AC_CHECK_COMPILER_FLAG(fexceptions,
[
CXXFLAGS="$CXXFLAGS -fexceptions"
])
AC_CHECK_COMPILER_FLAG(frtti,
[
CXXFLAGS="$CXXFLAGS -frtti"
])
AC_CHECK_COMPILER_FLAG(fsigned-char,
[
CXXFLAGS="$CXXFLAGS -fsigned-char"
])
AC_CHECK_COMPILER_FLAG(fno-check-new,
[
CXXFLAGS="$CXXFLAGS -fno-check-new"
])
AC_CHECK_COMPILER_FLAG(pthread,
[
CXXFLAGS="$CXXFLAGS -pthread"
])
if test "$GXX" = "yes"; then
CXXFLAGS="$CXXFLAGS -Wall"
fi
fi
])
AC_DEFUN([AC_CHECK_COMPILER_FLAG],
[
AC_MSG_CHECKING(whether $CXX supports -$1)
flag_cache=`echo $1 | sed 'y%.=/+-%___p_%'`
AC_CACHE_VAL(ac_cv_prog_cxx_$flag_cache,
[
echo 'int main() { return 0; }' >conftest.cc
eval "ac_cv_prog_cxx_$flag_cache=no"
if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then
if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then
eval "ac_cv_prog_cxx_$flag_cache=yes"
fi
fi
rm -f conftest*
])
if eval "test \"`echo '$ac_cv_prog_cxx_'$flag_cache`\" = yes"; then
AC_MSG_RESULT(yes)
:
$2
else
AC_MSG_RESULT(no)
:
$3
fi
])
AC_DEFUN([AC_CHECK_C_COMPILER_FLAG],
[
AC_MSG_CHECKING(whether $CC supports -$1)
flag_cache=`echo $1 | sed 'y%.=/+-%___p_%'`
AC_CACHE_VAL(ac_cv_prog_c_$flag_cache,
[
echo 'int main() { return 0; }' >conftest.cc
eval "ac_cv_prog_c_$flag_cache=no"
if test -z "`$CC -$1 -c conftest.cc 2>&1`"; then
if test -z "`$CC -$1 -o conftest conftest.o 2>&1`"; then
eval "ac_cv_prog_c_$flag_cache=yes"
fi
fi
rm -f conftest*
])
if eval "test \"`echo '$ac_cv_prog_c_'$flag_cache`\" = yes"; then
AC_MSG_RESULT(yes)
:
$2
else
AC_MSG_RESULT(no)
:
$3
fi
])
AC_DEFUN([AC_CHECK_MKSTEMP],
[
AC_LANG_C
ac_cflags_safe=$CFLAGS
ac_ldflags_safe=$LDFLAGS
ac_libs_safe=$LIBS
CFLAGS=""
LDFLAGS=""
LIBS=""
AC_CHECK_FUNCS(mkstemp,,
AC_MSG_ERROR([Library function mkstemp is required and cannot be found]))
CFLAGS=$ac_cflags_safe
LDFLAGS=$ac_ldflags_safe
LIBS=$ac_libs_safe
])
AC_DEFUN([AC_CHECK_X11_XLIB_H],
[
ac_cflags_safe=$CFLAGS
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
if $PKG_CONFIG --exists gdk-2.0; then
CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gdk-2.0`"
fi
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
AC_CHECK_HEADERS([X11/Xlib.h])
CFLAGS=$ac_cflags_safe
])
AC_DEFUN([AC_CLOSING_MESSAGE],
[
echo
echo " Configuration complete."
echo
echo " To compile, enter \`make', and then enter \`make install'"
echo " -- \`make install' must be run as root."
echo
echo " To reconfigure, enter \`make clean' and then run \`./configure' again."
echo
])
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN([PKG_CHECK_MODULES], [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING($1_CFLAGS)
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT($$1_CFLAGS)
AC_MSG_CHECKING($1_LIBS)
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT($$1_LIBS)
else
$1_CFLAGS=""
$1_LIBS=""
AC_MSG_RESULT([no])
fi
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])
dnl PKG_CHECK_VERSION does the same as PKG_CHECK_MODULES except
dnl that it does not set *_CFLAGS and *_LIBS variables
AC_DEFUN([PKG_CHECK_VERSION], [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
else
AC_MSG_RESULT([no])
fi
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])
AC_DEFUN([PKG_CHECK_SIGC], [
SIGC_VER=0
PKG_CHECK_MODULES(SIGC, sigc++-2.0 >= 2.0.0,
[
SIGC_VER=20
],
[
PKG_CHECK_MODULES(SIGC, sigc++-1.2 >= 1.2.3)
SIGC_VER=12
])
AC_SUBST(SIGC_VER)
])
AC_DEFUN([PKG_CHECK_GTK_UNIX_PRINT], [
PKG_CHECK_MODULES(GTK_UNIX_PRINT, gtk+-unix-print-2.0 >= 2.10.0, ,
[
GTK_UNIX_PRINT_CFLAGS=""
GTK_UNIX_PRINT_LIBS=""
AC_SUBST(GTK_UNIX_PRINT_CFLAGS)
AC_SUBST(GTK_UNIX_PRINT_LIBS)
])
])