-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
3463 lines (3088 loc) · 102 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
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
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.62])
dnl ***********************************
dnl *** include special GLib macros ***
dnl ***********************************
m4_define(glib_configure_ac)
#
# The following version number definitions apply to GLib, GModule, GObject,
# GThread and GIO as a whole, so if changes occurred in any of them, they are
# all treated with the same interface and binary age.
#
# Making releases:
# glib_micro_version += 1;
# glib_interface_age += 1;
# glib_binary_age += 1;
# if any functions have been added, set glib_interface_age to 0.
# if backwards compatibility has been broken,
# set glib_binary_age _and_ glib_interface_age to 0.
#
# remember to add a GLIB_VERSION_2_xx macro every time the minor version is
# bumped, as well as the GLIB_DEPRECATED_IN and GLIB_AVAILABLE_IN macros
# for that version - see gversion.h for further information.
#
# in easier to understand terms:
#
# <mclasen> on the stable branch, interface age == micro
# <mclasen> on the unstable (ie master), interface age = 0
m4_define([glib_major_version], [2])
m4_define([glib_minor_version], [47])
m4_define([glib_micro_version], [6])
m4_define([glib_interface_age], [0])
m4_define([glib_binary_age],
[m4_eval(100 * glib_minor_version + glib_micro_version)])
m4_define([glib_version],
[glib_major_version.glib_minor_version.glib_micro_version])
# libtool version related macros
m4_define([glib_lt_release], [glib_major_version.glib_minor_version])
m4_define([glib_lt_current],
[m4_eval(100 * glib_minor_version + glib_micro_version - glib_interface_age)])
m4_define([glib_lt_revision], [glib_interface_age])
m4_define([glib_lt_age], [m4_eval(glib_binary_age - glib_interface_age)])
m4_define([glib_lt_current_minus_age],
[m4_eval(glib_lt_current - glib_lt_age)])
# if the minor version number is odd, then we want debugging. Otherwise
# we only want minimal debugging support.
m4_define([glib_debug_default],
[m4_if(m4_eval(glib_minor_version % 2), [1], [yes], [minimum])])dnl
AC_INIT(glib, [glib_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=glib])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([glib/glib.h])
AC_CONFIG_MACRO_DIR([m4macros])
# Save this value here, since automake will set cflags later
cflags_set=${CFLAGS:+set}
AM_INIT_AUTOMAKE([1.11 -Wno-portability no-define no-dist-gzip dist-xz tar-ustar])
AM_MAINTAINER_MODE([enable])
# Support silent build rules. Disable
# by either passing --disable-silent-rules to configure or passing V=1
# to make
AM_SILENT_RULES([yes])
GLIB_MAJOR_VERSION=glib_major_version
GLIB_MINOR_VERSION=glib_minor_version
GLIB_MICRO_VERSION=glib_micro_version
GLIB_INTERFACE_AGE=glib_interface_age
GLIB_BINARY_AGE=glib_binary_age
GLIB_VERSION=glib_version
AC_SUBST(GLIB_MAJOR_VERSION)
AC_SUBST(GLIB_MINOR_VERSION)
AC_SUBST(GLIB_MICRO_VERSION)
AC_SUBST(GLIB_VERSION)
AC_SUBST(GLIB_INTERFACE_AGE)
AC_SUBST(GLIB_BINARY_AGE)
AC_DEFINE(GLIB_MAJOR_VERSION, [glib_major_version],
[Define to the GLIB major version])
AC_DEFINE(GLIB_MINOR_VERSION, [glib_minor_version],
[Define to the GLIB minor version])
AC_DEFINE(GLIB_MICRO_VERSION, [glib_micro_version],
[Define to the GLIB micro version])
AC_DEFINE(GLIB_INTERFACE_AGE, [glib_interface_age],
[Define to the GLIB interface age])
AC_DEFINE(GLIB_BINARY_AGE, [glib_binary_age],
[Define to the GLIB binary age])
# libtool versioning
LT_RELEASE=glib_lt_release
LT_CURRENT=glib_lt_current
LT_REVISION=glib_lt_revision
LT_AGE=glib_lt_age
LT_CURRENT_MINUS_AGE=glib_lt_current_minus_age
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_SUBST(LT_CURRENT_MINUS_AGE)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_USE_SYSTEM_EXTENSIONS
AM_CONDITIONAL(HAVE_GCC, [test "$GCC" = "yes"])
AC_CANONICAL_HOST
dnl
AC_MSG_CHECKING([for Win32])
LIB_EXE_MACHINE_FLAG=X86
case "$host" in
*-*-mingw*)
glib_native_win32=yes
glib_pid_type='void *'
glib_pollfd_format='%#x'
glib_cv_stack_grows=no
# Unfortunately the mingw implementations of C99-style snprintf and vsnprintf
# don't seem to be quite good enough, at least not in mingw-runtime-3.14.
# (Sorry, I don't know exactly what is the problem, but it is related to
# floating point formatting and decimal point vs. comma.)
# The simple tests in AC_FUNC_VSNPRINTF_C99 and AC_FUNC_SNPRINTF_C99 aren't
# rigorous enough to notice, though.
# So preset the autoconf cache variables.
ac_cv_func_vsnprintf_c99=no
ac_cv_func_snprintf_c99=no
case "$host" in
x86_64-*-*)
LIB_EXE_MACHINE_FLAG=X64
glib_pollfd_format='%#I64x'
;;
esac
AC_DEFINE([_WIN32_WINNT], [0x0501], [Target the Windows XP API])
;;
*)
glib_native_win32=no
glib_pid_type=int
glib_pollfd_format='%d'
;;
esac
case $host in
*-*-linux*)
glib_os_linux=yes
;;
esac
AC_MSG_RESULT([$glib_native_win32])
AC_MSG_CHECKING([for the Android])
case $host in
*android*)
glib_native_android="yes"
;;
*)
glib_native_android="no"
;;
esac
AC_MSG_RESULT([$glib_native_android])
AC_SUBST(LIB_EXE_MACHINE_FLAG)
glib_have_carbon=no
AC_MSG_CHECKING([for Mac OS X Carbon support])
AC_TRY_CPP([
#include <Carbon/Carbon.h>
#include <CoreServices/CoreServices.h>
], glib_have_carbon=yes)
AC_MSG_RESULT([$glib_have_carbon])
glib_have_cocoa=no
AC_MSG_CHECKING([for Mac OS X Cocoa support])
AC_TRY_CPP([
#include <Cocoa/Cocoa.h>
#ifdef GNUSTEP_BASE_VERSION
#error "Detected GNUstep, not Cocoa"
#endif
], glib_have_cocoa=yes)
AC_MSG_RESULT([$glib_have_cocoa])
AM_CONDITIONAL(OS_WIN32, [test "$glib_native_win32" = "yes"])
AM_CONDITIONAL(OS_WIN32_X64, [test "$LIB_EXE_MACHINE_FLAG" = "X64"])
AM_CONDITIONAL(OS_UNIX, [test "$glib_native_win32" != "yes"])
AM_CONDITIONAL(OS_LINUX, [test "$glib_os_linux" = "yes"])
AM_CONDITIONAL(OS_CARBON, [test "$glib_have_carbon" = "yes"])
AM_CONDITIONAL(OS_COCOA, [test "$glib_have_cocoa" = "yes"])
AS_IF([test "$glib_native_win32" = "yes"], [
AC_CHECK_TOOL(WINDRES, windres, no)
if test "$WINDRES" = no; then
AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
fi
AC_CHECK_TOOL(NM, nm, no)
if test "$NM" = no; then
AC_MSG_ERROR([*** Could not find an implementation of nm in your PATH.])
fi
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(DLLTOOL, dlltool, :)
AC_CHECK_PROG(ms_librarian, [lib.exe], [yes], [no])
])
AM_CONDITIONAL(MS_LIB_AVAILABLE, [test x$ms_librarian = xyes])
AS_IF([test "x$glib_have_carbon" = "xyes"], [
AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
CARBON_LIBS="-Wl,-framework,Carbon"
LDFLAGS="$LDFLAGS $CARBON_LIBS"
], [CARBON_LIBS=""])
AC_SUBST([CARBON_LIBS])
AS_IF([test "x$glib_have_cocoa" = "xyes"], [
AC_DEFINE(HAVE_COCOA, 1, [define to 1 if Cocoa is available])
COCOA_LIBS="-Wl,-framework,Foundation"
LDFLAGS="$LDFLAGS $COCOA_LIBS"
osx_version=`sw_vers -productVersion`
osx_min_version="10.9.0"
AC_MSG_CHECKING([OSX version >= $osx_min_version])
AS_VERSION_COMPARE([$osx_version], [$osx_min_version], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([OSX version is too old!])
])
AC_MSG_RESULT([yes])
], [COCOA_LIBS=""])
AC_SUBST([COCOA_LIBS])
dnl declare --enable-* args and collect ac_help strings
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
[turn on debugging @<:@default=glib_debug_default@:>@]),,
enable_debug=glib_debug_default)
AC_ARG_ENABLE(gc_friendly,
[AS_HELP_STRING([--enable-gc-friendly],
[turn on garbage collector friendliness [default=no]])],,
[enable_gc_friendly=no])
AC_ARG_ENABLE(mem_pools,
[AS_HELP_STRING([--disable-mem-pools],
[disable all glib memory pools])],,
[disable_mem_pools=no])
AC_ARG_ENABLE(rebuilds,
[AS_HELP_STRING([--disable-rebuilds],
[disable all source autogeneration rules])],,
[enable_rebuilds=yes])
GLIB_TESTS
AC_MSG_CHECKING([whether to enable garbage collector friendliness])
AS_IF([test "x$enable_gc_friendly" = "xyes"], [
AC_DEFINE(ENABLE_GC_FRIENDLY_DEFAULT, 1, [Whether to enable GC friendliness by default])
AC_MSG_RESULT([yes])
], [ AC_MSG_RESULT([no]) ])
AC_MSG_CHECKING([whether to disable memory pools])
AS_IF([test "x$disable_mem_pools" = "xno"], [
AC_MSG_RESULT([no])
], [
AC_DEFINE(DISABLE_MEM_POOLS, [1], [Whether to disable memory pools])
AC_MSG_RESULT([yes])
])
dnl location to install runtime libraries, e.g. ../../lib to install
dnl to /lib if libdir is /usr/lib
AC_ARG_WITH(runtime-libdir,
[AS_HELP_STRING([--with-runtime-libdir=RELPATH],
[install runtime libraries relative to libdir])],
[],
[with_runtime_libdir=""])
GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
AC_SUBST(GLIB_RUNTIME_LIBDIR)
AM_CONDITIONAL(HAVE_GLIB_RUNTIME_LIBDIR, [test "x$with_runtime_libdir" != "x"])
dnl Check for a working C++ compiler, but do not bail out, if none is found.
AC_CHECK_TOOLS(CXX, [$CCC c++ g++ gcc CC cxx cc++ cl], [gcc])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(,[class a { int b; } c;], ,CXX=)
AM_CONDITIONAL(HAVE_CXX, [test "$CXX" != ""])
AC_LANG_RESTORE
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_SYS_LARGEFILE
PKG_PROG_PKG_CONFIG(0.16)
if test "x$enable_debug" = "xyes"; then
if test "x$cflags_set" != "x" ; then
case " $CFLAGS " in
*[[\ \ ]]-g[[\ \ ]]*) ;;
*) CFLAGS="$CFLAGS -g" ;;
esac
fi
GLIB_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
else
GLIB_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"
if test "x$enable_debug" = "xno"; then
GLIB_DEBUG_FLAGS="$GLIB_DEBUG_FLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
fi
fi
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
# gcc2 uses "-fnative-struct".
if test x"$glib_native_win32" = xyes; then
if test x"$GCC" = xyes; then
msnative_struct=''
AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
if test -z "$ac_cv_prog_CC"; then
our_gcc="$CC"
else
our_gcc="$ac_cv_prog_CC"
fi
case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
2.)
if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
msnative_struct='-fnative-struct'
fi
;;
*)
if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
msnative_struct='-mms-bitfields'
fi
;;
esac
if test x"$msnative_struct" = x ; then
AC_MSG_RESULT([no way])
AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
else
CFLAGS="$CFLAGS $msnative_struct"
AC_MSG_RESULT([${msnative_struct}])
fi
fi
fi
GLIB_EXTRA_CFLAGS="${msnative_struct}"
AC_SUBST(GLIB_EXTRA_CFLAGS)
AC_EXEEXT
# define a MAINT-like variable REBUILD which is set if Perl
# and awk are found, so autogenerated sources can be rebuilt
AC_PROG_AWK
AC_CHECK_PROGS(PERL, [perl5 perl])
# We would like indent, but don't require it.
AC_CHECK_PROG(INDENT, indent, indent)
REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
test -n "$PERL" && \
$PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
test -n "$AWK" ; then
REBUILD=
fi
AC_SUBST(REBUILD)
# Need full path to Perl for glib-mkenums
#
if test "x$PERL" != x ; then
AC_PATH_PROG(PERL_PATH, [$PERL])
fi
if test "x$PERL_PATH" = x ; then
PERL_PATH="/usr/bin/env perl"
fi
AC_SUBST(PERL_PATH)
# option to specify python interpreter to use; this just sets $PYTHON, so that
# we will fallback to reading $PYTHON if --with-python is not given, and
# python.m4 will get the expected input
AC_ARG_WITH(python,
AS_HELP_STRING([--with-python=PATH],
[Path to Python interpreter; searches $PATH if only a program name is given; if not given, searches for a few standard names such as "python3" or "python2"]),
[PYTHON="$withval"], [])
if test x"$PYTHON" = xyes; then
AC_MSG_ERROR([--with-python option requires a path or program argument])
fi
AM_PATH_PYTHON(2.5,,PYTHON="/usr/bin/env python2.5")
dnl ***********************
dnl *** Tests for iconv ***
dnl ***********************
dnl
dnl We do this before the gettext checks, to avoid distortion
dnl On Windows we use a native implementation
AS_IF([ test x"$glib_native_win32" = xyes], [
with_libiconv=native
], [
AC_ARG_WITH(libiconv,
[AS_HELP_STRING([--with-libiconv=@<:@no/gnu/native@:>@],
[use the libiconv library])],,
[with_libiconv=maybe])
found_iconv=no
case $with_libiconv in
maybe)
# Check in the C library first
AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
# Check if we have GNU libiconv
if test $found_iconv = "no"; then
AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
fi
# Check if we have a iconv in -liconv, possibly from vendor
if test $found_iconv = "no"; then
AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
fi
;;
no)
AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
;;
gnu|yes)
AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
;;
native)
AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
;;
esac
if test "x$found_iconv" = "xno" ; then
AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv])
fi
])
dnl
dnl zlib support
dnl
PKG_CHECK_MODULES([ZLIB], [zlib], [found_zlib=yes], [found_zlib=no])
AS_IF([test "x$found_zlib" = "xno"], [
AC_CHECK_LIB(z, inflate, [AC_CHECK_HEADER(zlib.h, found_zlib=yes)])
if test "x$found_zlib" = "xno" ; then
AC_MSG_ERROR([*** Working zlib library and headers not found ***])
fi
ZLIB_LIBS='-lz'
AC_SUBST(ZLIB_LIBS)
])
PKG_CHECK_MODULES(LIBFFI, [libffi >= 3.0.0])
AC_SUBST(LIBFFI_CFLAGS)
AC_SUBST(LIBFFI_LIBS)
dnl
dnl gettext support
dnl
ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
GLIB_GNU_GETTEXT
if test "$gt_cv_have_gettext" != "yes" ; then
AC_MSG_ERROR([
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
])
fi
LIBS="$INTLLIBS $LIBS"
GETTEXT_PACKAGE=glib20
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"],
[Define the gettext package to be used])
GLIB_DEFINE_LOCALEDIR(GLIB_LOCALE_DIR)
dnl
dnl Now we are done with gettext checks, figure out ICONV_LIBS
dnl
AS_IF([test x"$glib_native_win32" != xyes], [
if test x$with_libiconv != xno ; then
case " $INTLLIBS " in
*[[\ \ ]]-liconv[[\ \ ]]*) ;;
*) ICONV_LIBS="-liconv" ;;
esac
fi
])
AC_SUBST(ICONV_LIBS)
case $with_libiconv in
gnu)
AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv])
;;
native)
AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library])
;;
esac
dnl Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static win32-dll])
dnl when using libtool 2.x create libtool early, because it's used in configure
m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
AS_IF([test "$glib_native_win32" = "yes"], [
if test x$enable_static = xyes -a x$enable_shared = xyes; then
AC_MSG_ERROR([Can not build both shared and static at the same time on Windows.])
fi
if test x$enable_static = xyes; then
glib_win32_static_compilation=yes
GLIB_WIN32_STATIC_COMPILATION_DEFINE="#define GLIB_STATIC_COMPILATION 1
#define GOBJECT_STATIC_COMPILATION 1"
AC_SUBST(GLIB_WIN32_STATIC_COMPILATION_DEFINE)
fi
])
AM_CONDITIONAL(OS_WIN32_AND_DLL_COMPILATION, [test x$glib_native_win32 = xyes -a x$glib_win32_static_compilation != xyes])
# Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 issetugid)
AC_CHECK_FUNCS(timegm gmtime_r strerror_r)
AC_CACHE_CHECK([for __libc_enable_secure], glib_cv_have_libc_enable_secure,
[AC_TRY_LINK([#include <unistd.h>
extern int __libc_enable_secure;],
[return __libc_enable_secure;],
glib_cv_have_libc_enable_secure=yes,
glib_cv_have_libc_enable_secure=no)])
AS_IF([test x$glib_cv_have_libc_enable_secure = xyes], [
AC_DEFINE(HAVE_LIBC_ENABLE_SECURE, 1,
[Define if you have the __libc_enable_secure variable (GNU libc, eglibc)])
])
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(__int64)
AC_CACHE_CHECK([for sig_atomic_t], ac_cv_type_sig_atomic_t,
[AC_TRY_LINK([#include <signal.h>
#include <sys/types.h>
sig_atomic_t val = 42;],
[return val == 42 ? 0 : 1],
ac_cv_type_sig_atomic_t=yes,
ac_cv_type_sig_atomic_t=no)])
if test x$ac_cv_type_sig_atomic_t = xyes; then
AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
[Define if you have the 'sig_atomic_t' type.])
fi
if test x$ac_cv_sizeof_long = x8 || test x$ac_cv_sizeof_long_long = x8 || test x$ac_cv_sizeof___int64 = x8 ; then
:
else
AC_MSG_ERROR([
*** GLib requires a 64 bit type. You might want to consider
*** using the GNU C compiler.
])
fi
AS_IF([test x$glib_native_win32 != xyes && test x$ac_cv_sizeof_long_long = x8], [
# long long is a 64 bit integer.
AC_MSG_CHECKING(for format to printf and scanf a guint64)
AC_CACHE_VAL(glib_cv_long_long_format,[
for format in ll q I64; do
AC_TRY_RUN([#include <stdio.h>
int main()
{
long long b, a = -0x3AFAFAFAFAFAFAFALL;
char buffer[1000];
sprintf (buffer, "%${format}u", a);
sscanf (buffer, "%${format}u", &b);
exit (b!=a);
}
],
[glib_cv_long_long_format=${format}
break],
[],[:])
done])
AS_IF([ test -n "$glib_cv_long_long_format"], [
AC_MSG_RESULT(%${glib_cv_long_long_format}u)
AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
if test x"$glib_cv_long_long_format" = xI64; then
AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64])
fi
], [AC_MSG_RESULT(none)])
],[ test x$ac_cv_sizeof___int64 = x8], [
# __int64 is a 64 bit integer.
AC_MSG_CHECKING(for format to printf and scanf a guint64)
# We know this is MSVCRT.DLL, and what the formats are
glib_cv_long_long_format=I64
AC_MSG_RESULT(%${glib_cv_long_long_format}u)
AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64])
])
AC_C_CONST
dnl
dnl check in which direction the stack grows
dnl
AC_CACHE_CHECK([for growing stack pointer],glib_cv_stack_grows,[
AC_TRY_RUN([
volatile int *a = 0, *b = 0;
void f (int i) { volatile int x = 5; if (i == 0) b = &x; else f (i - 1); }
int main () { volatile int y = 7; a = &y; f (100); return b > a ? 0 : 1; }
],
glib_cv_stack_grows=yes
,
glib_cv_stack_grows=no
,)
])
# check for flavours of varargs macros
AC_MSG_CHECKING(for ISO C99 varargs macros in C)
AC_TRY_COMPILE([],[
int a(int p1, int p2, int p3);
#define call_a(...) a(1,__VA_ARGS__)
call_a(2,3);
],g_have_iso_c_varargs=yes,g_have_iso_c_varargs=no)
AC_MSG_RESULT($g_have_iso_c_varargs)
AC_MSG_CHECKING(for ISO C99 varargs macros in C++)
AS_IF([test "$CXX" = ""], [
dnl No C++ compiler
g_have_iso_cxx_varargs=no
else
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([],[
int a(int p1, int p2, int p3);
#define call_a(...) a(1,__VA_ARGS__)
call_a(2,3);
],g_have_iso_cxx_varargs=yes,g_have_iso_cxx_varargs=no)
AC_LANG_C
])
AC_MSG_RESULT($g_have_iso_cxx_varargs)
AC_MSG_CHECKING(for GNUC varargs macros)
AC_TRY_COMPILE([],[
int a(int p1, int p2, int p3);
#define call_a(params...) a(1,params)
call_a(2,3);
],g_have_gnuc_varargs=yes,g_have_gnuc_varargs=no)
AC_MSG_RESULT($g_have_gnuc_varargs)
# check for GNUC visibility support
AC_MSG_CHECKING(for GNUC visibility attribute)
GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
void
__attribute__ ((visibility ("hidden")))
f_hidden (void)
{
}
void
__attribute__ ((visibility ("internal")))
f_internal (void)
{
}
void
__attribute__ ((visibility ("protected")))
f_protected (void)
{
}
void
__attribute__ ((visibility ("default")))
f_default (void)
{
}
int main (void)
{
f_hidden();
f_internal();
f_protected();
f_default();
return 0;
}
]])],g_have_gnuc_visibility=yes,g_have_gnuc_visibility=no)
AC_MSG_RESULT($g_have_gnuc_visibility)
AM_CONDITIONAL(HAVE_GNUC_VISIBILITY, [test x$g_have_gnuc_visibility = xyes])
AC_MSG_CHECKING([whether using Sun Studio C compiler])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550)
#else
# include "error: this is not Sun Studio."
#endif
]], [[]])], [ g_have_sunstudio_visibility=yes ], [ g_have_sunstudio_visibility=no ])
AC_MSG_RESULT($g_have_sunstudio_visibility)
AM_CONDITIONAL(HAVE_SUNSTUDIO_VISIBILITY, [test x$g_have_sunstudio_visibility = xyes])
# check for bytesex stuff
AC_C_BIGENDIAN
if test x$ac_cv_c_bigendian = xuniversal ; then
AC_MSG_ERROR([Universal builds not supported: see https://bugs.gnome.org/742548])
fi
# check for header files
AC_CHECK_HEADERS([sys/param.h sys/resource.h mach/mach_time.h])
AC_CHECK_HEADERS([sys/select.h stdint.h inttypes.h sched.h malloc.h])
AC_CHECK_HEADERS([sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h sys/filio.h])
AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h])
AC_CHECK_HEADERS([linux/magic.h sys/prctl.h])
# Some versions of MSC lack these
AC_CHECK_HEADERS([dirent.h sys/time.h])
# We don't care about this, but we need to keep including it in
# glibconfig.h for backward compatibility
AC_CHECK_HEADERS([values.h])
AC_CHECK_HEADERS([sys/mount.h sys/sysctl.h], [], [],
[#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])
AC_CHECK_FUNCS(sysctlbyname)
AC_HEADER_MAJOR
AC_CHECK_HEADERS([xlocale.h])
# check for structure fields
AC_CHECK_MEMBERS([struct stat.st_mtimensec, struct stat.st_mtim.tv_nsec, struct stat.st_atimensec, struct stat.st_atim.tv_nsec, struct stat.st_ctimensec, struct stat.st_ctim.tv_nsec, struct stat.st_birthtime, struct stat.st_birthtimensec, struct stat.st_birthtim, struct stat.st_birthtim.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct statfs.f_fstypename, struct statfs.f_bavail],,, [#include <sys/types.h>
#include <sys/stat.h>
#ifdef G_OS_UNIX
#include <unistd.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif])
# struct statvfs.f_basetype is available on Solaris but not for Linux.
AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [#include <sys/statvfs.h>])
AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [#include <sys/statvfs.h>])
AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[#include <time.h>])
AC_STRUCT_DIRENT_D_TYPE
# Checks for libcharset
AM_LANGINFO_CODESET
gl_GLIBC21
# check additional type sizes
AC_CHECK_SIZEOF(size_t)
dnl Try to figure out whether gsize should be long or int
AC_MSG_CHECKING([for the appropriate definition for size_t])
case $ac_cv_sizeof_size_t in
$ac_cv_sizeof_short)
glib_size_type=short
;;
$ac_cv_sizeof_int)
glib_size_type=int
;;
$ac_cv_sizeof_long)
glib_size_type=long
;;
$ac_cv_sizeof_long_long)
glib_size_type='long long'
;;
$ac_cv_sizeof__int64)
glib_size_type='__int64'
;;
*) AC_MSG_ERROR([No type matching size_t in size])
;;
esac
dnl If int/long are the same size, we see which one produces
dnl warnings when used in the location as size_t. (This matters
dnl on AIX with xlc)
dnl
AS_IF([test $ac_cv_sizeof_size_t = $ac_cv_sizeof_int &&
test $ac_cv_sizeof_size_t = $ac_cv_sizeof_long], [
GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
#if defined(_AIX) && !defined(__GNUC__)
#pragma options langlvl=stdc89
#endif
#include <stddef.h>
int main ()
{
size_t s = 1;
unsigned int *size_int = &s;
return (int)*size_int;
}
]])],glib_size_type=int,
[GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
#if defined(_AIX) && !defined(__GNUC__)
#pragma options langlvl=stdc89
#endif
#include <stddef.h>
int main ()
{
size_t s = 1;
unsigned long *size_long = &s;
return (int)*size_long;
}
]])],glib_size_type=long)])
])
AC_MSG_RESULT(unsigned $glib_size_type)
AC_CHECK_SIZEOF(ssize_t)
dnl Try to figure out whether gssize should be long or int
AC_MSG_CHECKING([for the appropriate definition for ssize_t])
case $ac_cv_sizeof_ssize_t in
$ac_cv_sizeof_short)
glib_ssize_type=short
;;
$ac_cv_sizeof_int)
glib_ssize_type=int
;;
$ac_cv_sizeof_long)
glib_ssize_type=long
;;
$ac_cv_sizeof_long_long)
glib_ssize_type='long long'
;;
$ac_cv_sizeof__int64)
glib_ssize_type='__int64'
;;
*) AC_MSG_ERROR([No type matching ssize_t in size])
;;
esac
dnl If int/long are the same size, we see which one produces
dnl warnings when used in the location as ssize_t. (This matters
dnl on Android where ssize_t is long and size_t is unsigned int)
dnl
AS_IF([test $ac_cv_sizeof_ssize_t = $ac_cv_sizeof_int &&
test $ac_cv_sizeof_ssize_t = $ac_cv_sizeof_long], [
GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
#if defined(_AIX) && !defined(__GNUC__)
#pragma options langlvl=stdc89
#endif
#include <stddef.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#include <sys/types.h>
int main ()
{
ssize_t s = 1;
int *size_int = &s;
return (int)*size_int;
}
]])],glib_ssize_type=int,
[GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
#if defined(_AIX) && !defined(__GNUC__)
#pragma options langlvl=stdc89
#endif
#include <stddef.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#include <sys/types.h>
int main ()
{
ssize_t s = 1;
long *size_long = &s;
return (int)*size_long;
}
]])],glib_ssize_type=long)])
])
AC_MSG_RESULT($glib_ssize_type)
# Check for some functions
AC_CHECK_FUNCS(lstat strsignal vsnprintf stpcpy strcasecmp strncasecmp poll vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem)
AC_CHECK_FUNCS(lchmod lchown fchmod fchown utimes getresuid)
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat fallocate)
case $host_os in aix*) ac_cv_func_splice=no ;; esac # AIX splice() is something else
AC_CHECK_FUNCS(splice)
AC_CHECK_FUNCS(prlimit)
# To avoid finding a compatibility unusable statfs, which typically
# successfully compiles, but warns to use the newer statvfs interface:
AS_IF([test $ac_cv_header_sys_statvfs_h = yes], [AC_CHECK_FUNCS([statvfs])])
AS_IF([test $ac_cv_header_sys_statfs_h = yes -o $ac_cv_header_sys_mount_h = yes], [AC_CHECK_FUNCS([statfs])])
AC_MSG_CHECKING([whether to use statfs or statvfs])
# Some systems have both statfs and statvfs, pick the most "native" for these
AS_IF([test x$ac_cv_func_statfs = xyes && test x$ac_cv_func_statvfs = xyes],
[
# on solaris and irix, statfs doesn't even have the f_bavail field
AS_IF([test x$ac_cv_member_struct_statfs_f_bavail = xno],
[ac_cv_func_statfs=no],
# else, at least on linux, statfs is the actual syscall
[ac_cv_func_statvfs=no])
])
AS_IF([test x$ac_cv_func_statfs = xyes],
[
AC_DEFINE([USE_STATFS], [1], [Define to use statfs()])
AC_MSG_RESULT([statfs])
],
[test x$ac_cv_func_statvfs = xyes],
[
AC_DEFINE([USE_STATVFS], [1], [Define to use statvfs()])
AC_MSG_RESULT([statvfs])
],
[ AC_MSG_RESULT([neither])])
AC_CHECK_HEADERS(crt_externs.h)
AC_CHECK_FUNCS(_NSGetEnviron)
AC_CHECK_FUNCS(newlocale uselocale strtod_l strtoll_l strtoull_l)
# Internet address families
if test $glib_native_win32 = yes; then
glib_inet_includes=["
#include <winsock2.h>
"]
else
glib_inet_includes=["
#include <sys/types.h>
#include <sys/socket.h>
"]
fi
glib_failed=false
GLIB_CHECK_VALUE(AF_INET, $glib_inet_includes, glib_failed=true)
GLIB_CHECK_VALUE(AF_INET6, $glib_inet_includes, glib_failed=true)
# winsock defines this even though it doesn't support it
GLIB_CHECK_VALUE(AF_UNIX, $glib_inet_includes, glib_failed=true)
if $glib_failed ; then
AC_MSG_ERROR([Could not determine values for AF_INET* constants])
fi
glib_failed=false
GLIB_CHECK_VALUE(MSG_PEEK, $glib_inet_includes, glib_failed=true)
GLIB_CHECK_VALUE(MSG_OOB, $glib_inet_includes, glib_failed=true)
GLIB_CHECK_VALUE(MSG_DONTROUTE, $glib_inet_includes, glib_failed=true)
if $glib_failed ; then
AC_MSG_ERROR([Could not determine values for MSG_* constants])
fi
AC_CHECK_FUNCS(getprotobyname_r endservent if_nametoindex if_indextoname sendmmsg recvmmsg)
AS_IF([test $glib_native_win32 = yes], [
# <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
# inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
# they aren't present at run-time (on Windows 2000).
AC_CHECK_HEADER([wspiapi.h], [WSPIAPI_INCLUDE="#include <wspiapi.h>"])
AC_SUBST(WSPIAPI_INCLUDE)
], [
# Android does not have C_IN in public headers, we define it wherever necessary
AS_IF([test $glib_native_android != yes], [
AC_MSG_CHECKING([if arpa/nameser_compat.h is needed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <arpa/nameser.h>],
[int qclass = C_IN;])],
[AC_MSG_RESULT([no])],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <arpa/nameser.h>
#include <arpa/nameser_compat.h>],
[int qclass = C_IN;])],
[AC_MSG_RESULT([yes])
NAMESER_COMPAT_INCLUDE="#include <arpa/nameser_compat.h>"],
[AC_MSG_ERROR([could not compile test program either way])])])])
AC_SUBST(NAMESER_COMPAT_INCLUDE)
# We can't just use AC_CHECK_FUNC/AC_CHECK_LIB here. Bug 586150
NETWORK_LIBS=""
AC_MSG_CHECKING([for res_query])
AC_TRY_LINK([#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
],[
res_query("test", 0, 0, (void *)0, 0);
],[AC_MSG_RESULT([yes])],
[save_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>