-
Notifications
You must be signed in to change notification settings - Fork 28
/
configure.in
9564 lines (8559 loc) · 313 KB
/
configure.in
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
dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
dnl ***** BEGIN LICENSE BLOCK *****
dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
dnl
dnl The contents of this file are subject to the Mozilla Public License Version
dnl 1.1 (the "License"); you may not use this file except in compliance with
dnl the License. You may obtain a copy of the License at
dnl http://www.mozilla.org/MPL/
dnl
dnl Software distributed under the License is distributed on an "AS IS" basis,
dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
dnl for the specific language governing rights and limitations under the
dnl License.
dnl
dnl The Original Code is this file as it was released upon August 6, 1998.
dnl
dnl The Initial Developer of the Original Code is
dnl Christopher Seawood.
dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
dnl the Initial Developer. All Rights Reserved.
dnl
dnl Contributor(s):
dnl Jamie Zawinski <[email protected]>
dnl gettimeofday args check
dnl Christopher Blizzard <[email protected]>
dnl gnomefe update & enable-pthreads
dnl Ramiro Estrugo <[email protected]>
dnl X11 makedepend support
dnl Insure support.
dnl Henry Sobotka <[email protected]>
dnl OS/2 support
dnl Dan Mosedale <[email protected]>
dnl LDAP support
dnl Seth Spitzer <[email protected]>
dnl xpctools support
dnl Benjamin Smedberg <[email protected]>
dnl Howard Chu <[email protected]>
dnl MSYS support
dnl Mark Mentovai <[email protected]>:
dnl Mac OS X 10.4 support
dnl Giorgio Maone <[email protected]>
dnl MSVC l10n compatible version check
dnl Ben Turner <[email protected]>
dnl Windows x64 support
dnl Makoto Kato <[email protected]>
dnl
dnl Alternatively, the contents of this file may be used under the terms of
dnl either the GNU General Public License Version 2 or later (the "GPL"), or
dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
dnl in which case the provisions of the GPL or the LGPL are applicable instead
dnl of those above. If you wish to allow use of your version of this file only
dnl under the terms of either the GPL or the LGPL, and not to allow others to
dnl use your version of this file under the terms of the MPL, indicate your
dnl decision by deleting the provisions above and replace them with the notice
dnl and other provisions required by the GPL or the LGPL. If you do not delete
dnl the provisions above, a recipient may use your version of this file under
dnl the terms of any one of the MPL, the GPL or the LGPL.
dnl
dnl ***** END LICENSE BLOCK *****
dnl Process this file with autoconf to produce a configure script.
dnl ========================================================
AC_PREREQ(2.13)
AC_INIT(config/config.mk)
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
AC_CANONICAL_SYSTEM
TARGET_CPU="${target_cpu}"
TARGET_VENDOR="${target_vendor}"
TARGET_OS="${target_os}"
MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
AC_SUBST(MOZ_DEB_TIMESTAMP)
dnl ========================================================
dnl =
dnl = Don't change the following two lines. Doing so breaks:
dnl =
dnl = CFLAGS="-foo" ./configure
dnl =
dnl ========================================================
CFLAGS="${CFLAGS=}"
CPPFLAGS="${CPPFLAGS=}"
CXXFLAGS="${CXXFLAGS=}"
LDFLAGS="${LDFLAGS=}"
HOST_CFLAGS="${HOST_CFLAGS=}"
HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
HOST_LDFLAGS="${HOST_LDFLAGS=}"
dnl ========================================================
dnl = Preserve certain environment flags passed to configure
dnl = We want sub projects to receive the same flags
dnl = untainted by this configure script
dnl ========================================================
_SUBDIR_CC="$CC"
_SUBDIR_CXX="$CXX"
_SUBDIR_CFLAGS="$CFLAGS"
_SUBDIR_CPPFLAGS="$CPPFLAGS"
_SUBDIR_CXXFLAGS="$CXXFLAGS"
_SUBDIR_LDFLAGS="$LDFLAGS"
_SUBDIR_HOST_CC="$HOST_CC"
_SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
_SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
_SUBDIR_CONFIG_ARGS="$ac_configure_args"
dnl Set the version number of the libs included with mozilla
dnl ========================================================
MOZJPEG=62
MOZPNG=10401
MOZZLIB=0x1230
NSPR_VERSION=4
NSS_VERSION=3
dnl Set the minimum version of toolkit libs used by mozilla
dnl ========================================================
GLIB_VERSION=1.2.0
LIBIDL_VERSION=0.6.3
PERL_VERSION=5.006
PYTHON_VERSION=2.5
CAIRO_VERSION=1.10
PANGO_VERSION=1.14.0
GTK2_VERSION=2.10.0
WINDRES_VERSION=2.14.90
W32API_VERSION=3.14
GNOMEVFS_VERSION=2.0
GNOMEUI_VERSION=2.2.0
GCONF_VERSION=1.2.1
GIO_VERSION=2.18
STARTUP_NOTIFICATION_VERSION=0.8
DBUS_VERSION=0.60
SQLITE_VERSION=3.7.5
LIBNOTIFY_VERSION=0.4
MSMANIFEST_TOOL=
dnl Set various checks
dnl ========================================================
MISSING_X=
AC_PROG_AWK
dnl Initialize the Pthread test variables early so they can be
dnl overridden by each platform.
dnl ========================================================
USE_PTHREADS=
_PTHREAD_LDFLAGS=""
dnl Do not allow a separate objdir build if a srcdir build exists.
dnl ==============================================================
_topsrcdir=`cd \`dirname $0\`; pwd`
_objdir=`pwd`
if test "$_topsrcdir" != "$_objdir"
then
# Check for a couple representative files in the source tree
_conflict_files=
for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
if test -f $file; then
_conflict_files="$_conflict_files $file"
fi
done
if test "$_conflict_files"; then
echo "***"
echo "* Your source tree contains these files:"
for file in $_conflict_files; do
echo "* $file"
done
cat 1>&2 <<-EOF
* This indicates that you previously built in the source tree.
* A source tree build can confuse the separate objdir build.
*
* To clean up the source tree:
* 1. cd $_topsrcdir
* 2. gmake distclean
***
EOF
exit 1
break
fi
fi
MOZ_BUILD_ROOT=`pwd`
dnl Default to MSVC for win32 and gcc-4.2 for darwin
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
case "$target" in
*-mingw*)
if test -z "$CC"; then CC=cl; fi
if test -z "$CXX"; then CXX=cl; fi
if test -z "$CPP"; then CPP="cl -E -nologo"; fi
if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
if test -z "$LD"; then LD=link; fi
if test -z "$AS"; then
case "${target_cpu}" in
i*86)
AS=ml;
;;
x86_64)
AS=ml64;
;;
esac
fi
if test -z "$MIDL"; then MIDL=midl; fi
;;
*-darwin*)
if test -z "$CC"; then CC=gcc-4.2; fi
if test -z "$CXX"; then CXX=g++-4.2; fi
;;
esac
fi
COMPILE_ENVIRONMENT=1
MOZ_ARG_DISABLE_BOOL(compile-environment,
[ --disable-compile-environment
Disable compiler/library checks.],
COMPILE_ENVIRONMENT= )
AC_SUBST(COMPILE_ENVIRONMENT)
MOZ_ARG_WITH_STRING(l10n-base,
[ --with-l10n-base=DIR path to l10n repositories],
L10NBASEDIR=$withval)
if test -n "$L10NBASEDIR"; then
if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
AC_MSG_ERROR([--with-l10n-base must specify a path])
elif test -d "$L10NBASEDIR"; then
L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
else
AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
fi
fi
AC_SUBST(L10NBASEDIR)
dnl Check for Perl first -- needed for win32 SDK checks
MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
if test -z "$PERL" -o "$PERL" = ":"; then
AC_MSG_ERROR([perl not found in \$PATH])
fi
dnl ========================================================
dnl = Android uses a very custom (hacky) toolchain; we need to do this
dnl = here, so that the compiler checks can succeed
dnl ========================================================
MOZ_ARG_WITH_STRING(android-ndk,
[ --with-android-ndk=DIR
location where the Android NDK can be found],
android_ndk=$withval)
MOZ_ARG_WITH_STRING(android-toolchain,
[ --with-android-toolchain=DIR
location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
android_toolchain=$withval)
MOZ_ARG_WITH_STRING(android-version,
[ --with-android-version=VER
android platform version, default 5],
android_version=$withval,
android_version=5)
MOZ_ARG_WITH_STRING(android-sdk,
[ --with-android-sdk=DIR
location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
android_sdk=$withval)
MOZ_ARG_WITH_STRING(android-platform,
[ --with-android-platform=DIR
location of platform dir, default NDK/build/platforms/android-5/arch-arm],
android_platform=$withval)
MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
[ --enable-android-libstdcxx
use GNU libstdc++ instead of STLPort for NDK >= 5],
MOZ_ANDROID_LIBSTDCXX=1,
MOZ_ANDROID_LIBSTDCXX= )
case "$target" in
arm-linux*-android*|*-linuxandroid*)
android_tool_prefix="arm-linux-androideabi"
;;
arm-android-eabi)
android_tool_prefix="arm-eabi"
;;
*)
android_tool_prefix="$target_os"
;;
esac
case "$target" in
*-android*|*-linuxandroid*)
if test -z "$android_ndk" ; then
AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
fi
if test -z "$android_sdk" ; then
AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
fi
android_platform_tools="$android_sdk"/../../platform-tools
if test ! -d "$android_platform_tools" ; then
android_platform_tools="$android_sdk"/tools # SDK Tools < r8
fi
if test -z "$android_toolchain" ; then
AC_MSG_CHECKING([for android toolchain directory])
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
# With newer NDK, the toolchain path has changed.
if ! test -d "$android_toolchain" ; then
android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
fi
if test -d "$android_toolchain" ; then
AC_MSG_RESULT([$android_toolchain])
else
AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
fi
fi
if test -z "$android_platform" ; then
AC_MSG_CHECKING([for android platform directory])
android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
# With newer NDK, the platform path has changed.
if ! test -d "$android_platform" ; then
android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
fi
if test -d "$android_platform" ; then
AC_MSG_RESULT([$android_platform])
else
AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
fi
fi
dnl set up compilers
AS="$android_toolchain"/bin/"$android_tool_prefix"-as
CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libstdc++.a" ; then
AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
fi
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a"
STLPORT_LIBS="-lstdc++"
elif test -e "$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/"
STLPORT_LIBS="-lstlport_static"
elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/armeabi-v7a"
STLPORT_LIBS="-lstlport_static"
elif test "$target" != "arm-android-eabi"; then
dnl fail if we're not building with NDKr4
AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
fi
CPPFLAGS="-I$android_platform/usr/include $STLPORT_CPPFLAGS $CPPFLAGS"
CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
LIBS="$LIBS $STLPORT_LIBS"
dnl Add -llog by default, since we use it all over the place.
dnl Add --allow-shlib-undefined, because libGLESv2 links to an
dnl undefined symbol (present on the hardware, just not in the
dnl NDK.)
LDFLAGS="-mandroid $STLPORT_LDFLAGS -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
dnl prevent cross compile section from using these flags as host flags
if test -z "$HOST_CPPFLAGS" ; then
HOST_CPPFLAGS=" "
fi
if test -z "$HOST_CFLAGS" ; then
HOST_CFLAGS=" "
fi
if test -z "$HOST_CXXFLAGS" ; then
HOST_CXXFLAGS=" "
fi
if test -z "$HOST_LDFLAGS" ; then
HOST_LDFLAGS=" "
fi
ANDROID_NDK="${android_ndk}"
ANDROID_TOOLCHAIN="${android_toolchain}"
ANDROID_PLATFORM="${android_platform}"
ANDROID_SDK="${android_sdk}"
ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
ANDROID_VERSION="${android_version}"
if test -z "$ANDROID_PACKAGE_NAME" ; then
ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
fi
AC_DEFINE(ANDROID)
AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
AC_SUBST(ANDROID_VERSION)
CROSS_COMPILE=1
MOZ_CHROME_FILE_FORMAT=omni
ZLIB_DIR=yes
;;
*-linux*)
AC_PATH_PROG(OBJCOPY,objcopy)
;;
esac
AC_SUBST(ANDROID_NDK)
AC_SUBST(ANDROID_TOOLCHAIN)
AC_SUBST(ANDROID_PLATFORM)
AC_SUBST(ANDROID_SDK)
AC_SUBST(ANDROID_PLATFORM_TOOLS)
AC_SUBST(ANDROID_PACKAGE_NAME)
AC_SUBST(OBJCOPY)
dnl ========================================================
dnl Checks for compilers.
dnl ========================================================
dnl Set CROSS_COMPILE in the environment when running configure
dnl to use the cross-compile setup for now
dnl ========================================================
dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
AR_FLAGS='cr $@'
if test "$COMPILE_ENVIRONMENT"; then
if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
echo "cross compiling from $host to $target"
cross_compiling=yes
_SAVE_CC="$CC"
_SAVE_CFLAGS="$CFLAGS"
_SAVE_LDFLAGS="$LDFLAGS"
AC_MSG_CHECKING([for host c compiler])
AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
if test -z "$HOST_CC"; then
AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
fi
AC_MSG_RESULT([$HOST_CC])
AC_MSG_CHECKING([for host c++ compiler])
AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
if test -z "$HOST_CXX"; then
AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
fi
AC_MSG_RESULT([$HOST_CXX])
if test -z "$HOST_CFLAGS"; then
HOST_CFLAGS="$CFLAGS"
fi
if test -z "$HOST_CXXFLAGS"; then
HOST_CXXFLAGS="$CXXFLAGS"
fi
if test -z "$HOST_LDFLAGS"; then
HOST_LDFLAGS="$LDFLAGS"
fi
if test -z "$HOST_AR_FLAGS"; then
HOST_AR_FLAGS="$AR_FLAGS"
fi
AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
CC="$HOST_CC"
CFLAGS="$HOST_CFLAGS"
LDFLAGS="$HOST_LDFLAGS"
AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
AC_TRY_COMPILE([], [return(0);],
[ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
CC="$HOST_CXX"
CFLAGS="$HOST_CXXFLAGS"
AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
AC_TRY_COMPILE([], [return(0);],
[ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
CC=$_SAVE_CC
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
case "$build:$target" in
powerpc-apple-darwin8*:i?86-apple-darwin*)
dnl The Darwin cross compiler doesn't necessarily point itself at a
dnl root that has libraries for the proper architecture, it defaults
dnl to the system root. The libraries in the system root on current
dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
dnl checks will fail. Fake a working SDK in that case.
_SAVE_CFLAGS=$CFLAGS
_SAVE_CXXFLAGS=$CXXLAGS
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
;;
esac
AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
unset ac_cv_prog_CC
AC_PROG_CC
AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
unset ac_cv_prog_CXX
AC_PROG_CXX
case "$build:$target" in
powerpc-apple-darwin8*:i?86-apple-darwin*)
dnl Revert the changes made above. From this point on, the target
dnl compiler will never be used without applying the SDK to CFLAGS
dnl (see --with-macos-sdk below).
CFLAGS=$_SAVE_CFLAGS
CXXFLAGS=$_SAVE_CXXFLAGS
;;
esac
AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
AC_DEFINE(CROSS_COMPILE)
else
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
MOZ_PATH_PROGS(AS, $AS as, $CC)
AC_CHECK_PROGS(AR, ar, :)
AC_CHECK_PROGS(LD, ld, :)
AC_CHECK_PROGS(STRIP, strip, :)
AC_CHECK_PROGS(WINDRES, windres, :)
if test -z "$HOST_CC"; then
HOST_CC='$(CC)'
fi
if test -z "$HOST_CFLAGS"; then
HOST_CFLAGS='$(CFLAGS)'
fi
if test -z "$HOST_CXX"; then
HOST_CXX='$(CXX)'
fi
if test -z "$HOST_CXXFLAGS"; then
HOST_CXXFLAGS='$(CXXFLAGS)'
fi
if test -z "$HOST_LDFLAGS"; then
HOST_LDFLAGS='$(LDFLAGS)'
fi
if test -z "$HOST_RANLIB"; then
HOST_RANLIB='$(RANLIB)'
fi
if test -z "$HOST_AR"; then
HOST_AR='$(AR)'
fi
if test -z "$HOST_AR_FLAGS"; then
HOST_AR_FLAGS='$(AR_FLAGS)'
fi
fi
GNU_AS=
GNU_LD=
GNU_CC=
GNU_CXX=
CC_VERSION='N/A'
CXX_VERSION='N/A'
if test "$GCC" = "yes"; then
GNU_CC=1
CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
fi
if test "$GXX" = "yes"; then
GNU_CXX=1
CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
fi
if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
GNU_AS=1
fi
if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
GNU_LD=1
fi
if test "$GNU_CC"; then
if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
GCC_USE_GNU_LD=1
fi
fi
INTEL_CC=
INTEL_CXX=
if test "$GCC" = yes; then
if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
INTEL_CC=1
fi
fi
if test "$GXX" = yes; then
if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
INTEL_CXX=1
fi
fi
CLANG_CC=
CLANG_CXX=
if test "$GCC" = yes; then
if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
CLANG_CC=1
fi
fi
if test "$GXX" = yes; then
if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
CLANG_CXX=1
fi
fi
dnl ========================================================
dnl Special win32 checks
dnl ========================================================
WINVER=502
dnl Target the Windows 7 SDK by default
WINSDK_TARGETVER=601
MOZ_ARG_WITH_STRING(windows-version,
[ --with-windows-version=WINSDK_TARGETVER
Highest Windows version to target using this SDK
502: Windows Server 2003
600: Windows Vista
601: Windows 7],
WINSDK_TARGETVER=$withval)
case "$WINSDK_TARGETVER" in
502|600|601)
MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
;;
*)
AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
;;
esac
if test -n "$COMPILE_ENVIRONMENT"; then
if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
# We can't build parental controls either
MOZ_DISABLE_PARENTAL_CONTROLS=1
fi
fi
case "$target" in
*-mingw*)
if test "$GCC" != "yes"; then
# Check to see if we are really running in a msvc environemnt
_WIN32_MSVC=1
AC_CHECK_PROGS(MIDL, midl)
# Make sure compilers are valid
CFLAGS="$CFLAGS -TC -nologo"
CXXFLAGS="$CXXFLAGS -TP -nologo"
AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILE([#include <stdio.h>],
[ printf("Hello World\n"); ],,
AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <new.h>],
[ unsigned *test = new unsigned(42); ],,
AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
AC_LANG_RESTORE
changequote(,)
_MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
changequote([,])
# Determine compiler version
CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
_CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
_CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
_CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
_CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
_MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
_CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
fi
if test "$_CC_MAJOR_VERSION" = "14"; then
dnl Require VC8SP1 or newer.
dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
if test "$_CC_RELEASE" -lt 50727 -o \
\( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
fi
_CC_SUITE=8
AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
elif test "$_CC_MAJOR_VERSION" = "15"; then
_CC_SUITE=9
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
elif test "$_CC_MAJOR_VERSION" = "16"; then
_CC_SUITE=10
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
else
AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
fi
_MOZ_RTTI_FLAGS_ON='-GR'
_MOZ_RTTI_FLAGS_OFF='-GR-'
_MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
_MOZ_EXCEPTIONS_FLAGS_OFF=''
AC_DEFINE(HAVE_SEH_EXCEPTIONS)
if test -n "$WIN32_REDIST_DIR"; then
if test ! -d "$WIN32_REDIST_DIR"; then
AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
fi
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
fi
dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
dnl not something else like "magnetic tape manipulation utility".
MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
if test -z "$MSMT_TOOL"; then
AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
fi
changequote(,)
_MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
changequote([,])
MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
if test -z "$MSMANIFEST_TOOL_VERSION"; then
AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
fi
MSMANIFEST_TOOL=1
unset MSMT_TOOL
# Check linker version
_LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
_LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
fi
INCREMENTAL_LINKER=1
# Check midl version
_MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
_MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
_MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
_MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
# Add flags if necessary
AC_MSG_CHECKING([for midl flags])
case "$target" in
i*86-*)
if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
# MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
# MIDL version 7.00.0500 or later has no problem.
MIDL_FLAGS="${MIDL_FLAGS} -env win32"
AC_MSG_RESULT([need -env win32])
else
AC_MSG_RESULT([none needed])
fi
;;
x86_64-*)
MIDL_FLAGS="${MIDL_FLAGS} -env x64"
;;
*)
AC_MSG_RESULT([none needed])
;;
esac
# Identify which version of the SDK we're building with
# Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
# from there
MOZ_CHECK_HEADERS([winsdkver.h])
if test "$ac_cv_header_winsdkver_h" = "yes"; then
# Get the highest _WIN32_WINNT and NTDDI versions supported
# Take the higher of the two
# This is done because the Windows 7 beta SDK reports its
# NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
AC_CACHE_CHECK(for highest Windows version supported by this SDK,
ac_cv_winsdk_maxver,
[cat > conftest.h <<EOF
#include <winsdkver.h>
#include <sdkddkver.h>
#if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
#define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
#else
#define WINSDK_MAXVER NTDDI_MAXVER
#endif
WINSDK_MAXVER
EOF
ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
rm -f conftest.h
])
MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
else
# The Vista SDK is the only one to have sdkddkver.h but not
# WinSDKVer.h
MOZ_CHECK_HEADERS([sdkddkver.h])
if test "$ac_cv_header_sdkddkver_h" = "yes"; then
MOZ_WINSDK_MAXVER=0x06000000
else
# Assume the Server 2003 Platform SDK
MOZ_WINSDK_MAXVER=0x05020000
fi
fi
unset _MSVC_VER_FILTER
AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
_SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
AC_TRY_COMPILE([#include <exception>],
[std::_Throw(std::exception()); return 0;],
ac_cv_have_std__Throw="yes",
ac_cv_have_std__Throw="no")
CXXFLAGS="$_SAVE_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_cv_have_std__Throw" = "yes"; then
AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
ac_cv_have_dllimport_exception_bug,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
_SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
AC_TRY_LINK([#include <vector>],
[std::vector<int> v; return v.at(1);],
ac_cv_have_dllimport_exception_bug="no",
ac_cv_have_dllimport_exception_bug="yes")
CXXFLAGS="$_SAVE_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
WRAP_STL_INCLUDES=1
MOZ_MSVC_STL_WRAP__Throw=1
AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
fi
else
AC_CACHE_CHECK(for overridable _RAISE,
ac_cv_have__RAISE,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
_SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
AC_TRY_COMPILE([#include <xstddef>
#undef _RAISE
#define _RAISE(x) externallyDefinedFunction((x).what())
#include <vector>
],
[std::vector<int> v; return v.at(1);],
ac_cv_have__RAISE="no",
ac_cv_have__RAISE="yes")
CXXFLAGS="$_SAVE_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_cv_have__RAISE" = "yes"; then
WRAP_STL_INCLUDES=1
MOZ_MSVC_STL_WRAP__RAISE=1
AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
else
AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
fi
fi
if test "$WRAP_STL_INCLUDES" = "1"; then
STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
fi
else
# Check w32api version
_W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
_W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
AC_TRY_COMPILE([#include <w32api.h>],
#if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
(__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
__W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
#error "test failed."
#endif
, [ res=yes ], [ res=no ])
AC_MSG_RESULT([$res])
if test "$res" != "yes"; then
AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
fi
# Check windres version
AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
_WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
AC_MSG_RESULT([$_WINDRES_VERSION])
_WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
_WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
_WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
"$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
"$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
"$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
"$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
"$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
then
AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
fi
MOZ_WINSDK_MAXVER=0x06010000
fi # !GNU_CC
AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
# Require OS features provided by IE 5.0
AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
# If the maximum version supported by this SDK is lower than the target
# version, error out
AC_MSG_CHECKING([for Windows SDK being recent enough])
if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
AC_MSG_RESULT("yes")
else
AC_MSG_RESULT("no")
AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
fi
AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
# Definitions matching sdkddkver.h
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
;;
esac
dnl Test breaks icc on OS/2 && MSVC
if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
AC_PROG_CC_C_O
if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
USING_HCC=1
_OLDCC=$CC
_OLDCXX=$CXX
CC="${srcdir}/build/hcc '$CC'"
CXX="${srcdir}/build/hcpp '$CXX'"
fi
fi
AC_PROG_CPP
AC_PROG_CXXCPP
if test -n "$_WIN32_MSVC"; then
SKIP_PATH_CHECKS=1
SKIP_COMPILER_CHECKS=1
SKIP_LIBRARY_CHECKS=1
# Since we're skipping compiler and library checks, hard-code
# some facts here.
AC_DEFINE(HAVE_IO_H)
AC_DEFINE(HAVE_SETBUF)
AC_DEFINE(HAVE_ISATTY)
fi
fi # COMPILE_ENVIRONMENT
AC_SUBST(MIDL_FLAGS)
AC_SUBST(_MSC_VER)
AC_SUBST(GNU_AS)
AC_SUBST(GNU_LD)
AC_SUBST(GNU_CC)
AC_SUBST(GNU_CXX)
AC_SUBST(INTEL_CC)
AC_SUBST(INTEL_CXX)
AC_SUBST(CLANG_CC)
AC_SUBST(CLANG_CXX)
AC_SUBST(STL_FLAGS)
AC_SUBST(WRAP_STL_INCLUDES)
AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
dnl ========================================================
dnl Checks for programs.