-
Notifications
You must be signed in to change notification settings - Fork 41
/
configure.ac
1458 lines (1256 loc) · 40.1 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
#
#=BEGIN SONGBIRD GPL
#
# This file is part of the Songbird web player.
#
# Copyright(c) 2005-2010 POTI, Inc.
# http://www.songbirdnest.com
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#=END SONGBIRD GPL
#
#
# Process this file with autoconf to produce a configure script.
#
AC_PREREQ(2.56)
AC_INIT(build/rules.mk)
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
AC_CANONICAL_SYSTEM
#
# We're going to hardcode our obj and dist directory names for the moment.
# These MUST match the vars in nightingale.mk or bad things will happen!
#
OBJDIRNAME="compiled"
DISTDIRNAME="dist"
#
# Defaults, we should probably add more as time permits.
#
SB_ENABLE_TEST_HARNESS=
AC_SUBST(OBJDIRNAME)
AC_SUBST(DISTDIRNAME)
#
# Check for --enable-debug
#
AC_ARG_ENABLE(debug,
[ --enable-debug compile a debug version (default=no)])
if test "$enable_debug" = "yes"; then
DEBUG=1
SB_CONFIGURATION="debug"
AC_DEFINE(DEBUG)
AC_DEFINE(_DEBUG)
else
DEBUG=
SB_CONFIGURATION="release"
AC_DEFINE(NDEBUG)
fi
AC_SUBST(DEBUG)
AC_SUBST(SB_CONFIGURATION)
#
# Check for --enable-jars
#
AC_ARG_ENABLE(jars,
[ --enable-jars create jar files (default=yes,debug=no)])
if test "$enable_jars" == "yes"; then
FORCE_JARS=1
fi
if test "$enable_jars" == "no"; then
PREVENT_JARS=1
fi
AC_SUBST(FORCE_JARS)
AC_SUBST(PREVENT_JARS)
#
# Check for --enable-official
#
SONGBIRD_BRANDING_DIR='branding'
AC_ARG_ENABLE(official,
[ --enable-official create an official build (default=no)])
if test "$enable_official" == "yes"; then
SONGBIRD_OFFICIAL=1
SONGBIRD_BRANDING_DIR='branding'
fi
AC_SUBST(SONGBIRD_OFFICIAL)
AC_SUBST(SONGBIRD_BRANDING_DIR)
#
# Check for --enable-nightly
#
AC_ARG_ENABLE(nightly,
[ --enable-nightly create a nightly build (default=no)])
if test "$enable_nightly" == "yes"; then
SONGBIRD_NIGHTLY=1
SB_ENABLE_TEST_HARNESS=1
fi
AC_SUBST(SONGBIRD_NIGHTLY)
if test "$SONGBIRD_OFFICIAL$SONGBIRD_NIGHTLY" == 1; then
AC_CHECK_PROG(GIT, git, git)
fi
#
# Check for --enable-tests
#
AC_ARG_ENABLE(tests,
[ --enable-tests build tests (defaults: debug=yes release=no)])
if test "$enable_tests" == "yes"; then
SB_ENABLE_TESTS=1
SB_ENABLE_TEST_HARNESS=1
fi
AC_SUBST(SB_ENABLE_TESTS)
#
# Check for --enable-test-harness
#
AC_ARG_ENABLE(test-harness,
[ --enable-test-harness build the test harness (default=when tests enabled)])
if test "$enable_test_harness" == "yes"; then
SB_ENABLE_TEST_HARNESS=1
fi
if test "$enable_test_harness" == "no"; then
SB_ENABLE_TEST_HARNESS=
fi
AC_SUBST(SB_ENABLE_TEST_HARNESS)
#
# Check for --enable-jemalloc
#
SB_USE_JEMALLOC=1
AC_ARG_ENABLE(jemalloc,
[ --enable-jemalloc use the jemalloc memory allocator (default=yes)])
if test "$enable_jemalloc" == "no"; then
SB_USE_JEMALLOC=
fi
AC_SUBST(SB_USE_JEMALLOC)
#
# Check for --enable-update-channel
#
AC_ARG_ENABLE(update-channel,
[ --enable-update-channel=CHANNEL which update channel to use ("default")],
SB_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
if test -z "$SB_UPDATE_CHANNEL"; then
SB_UPDATE_CHANNEL=default
fi
AC_SUBST(SB_UPDATE_CHANNEL)
#
# Check for --with-deadly-warnings
#
SB_WITH_DEADLY_WARNINGS=
AC_ARG_WITH(deadly-warnings,
[ --with-deadly-warnings=LIST conditions under which compiler warnings are considered
build failures (<debug,release,all,none,force>, default=release)],
[ SB_WITH_DEADLY_WARNINGS=$withval ],
[ SB_WITH_DEADLY_WARNINGS=all])
case "$SB_WITH_DEADLY_WARNINGS" in
debug|release|all|none|force)
;;
*)
AC_MSG_ERROR([Unknown --with-deadly warnings option; use debug, release, all, none, or force])
;;
esac
AC_SUBST(SB_WITH_DEADLY_WARNINGS)
#
# Check for --with-songbird-extensions
#
SB_BIRD_EXTENSIONS=default
AC_ARG_WITH(songbird-extensions,
[ --with-songbird-extensions=LIST list of songbird extensions to build
(default=platform dependent)],
[ SB_BIRD_EXTENSIONS=$withval ],
[ SB_BIRD_EXTENSIONS=default])
AC_SUBST(SB_BIRD_EXTENSIONS)
#
# Check for --with-extensions
#
SB_EXTENSIONS=default
AC_ARG_WITH(extensions,
[ --with-extensions=LIST list of extensions to build (default: xpcom_helloworld)],
[ SB_EXTENSIONS=$withval ],
[ SB_EXTENSIONS=default])
AC_SUBST(SB_EXTENSIONS)
#
# Check for enabled library performance tests
#
AC_SUBST(SB_ENABLE_LIBRARY_PERF)
#
# Check for --enable-sqlite-debug
#
SB_SQLITE_DEBUG=
AC_ARG_ENABLE(sqlite-debug,
[ --enable-sqlite-debug enable sqlite debug assertions (default=no)])
if test "$enable_sqlite_debug" == "yes"; then
SB_SQLITE_DEBUG=1
fi
AC_SUBST(SB_SQLITE_DEBUG)
#
# Check for --enable-device-drivers
#
AC_ARG_ENABLE(device-drivers,
[ --enable-device-drivers include device drivers (default=yes)])
if test "$enable_device_drivers" == "no"; then
SB_ENABLE_DEVICE_DRIVERS=0
else
SB_ENABLE_DEVICE_DRIVERS=1
fi
AC_SUBST(SB_ENABLE_DEVICE_DRIVERS)
#
# Check platform
#
case "$target" in
*-cygwin*|*-mingw*|*-msvc*|*-mks*)
SB_PLATFORM="windows"
case "$target_cpu" in
*i*86*)
SB_ARCH="$target_cpu"
;;
*)
AC_MSG_ERROR(Unsupported architecture)
;;
esac
# Check that we're MSYS
case "$target" in
*-mingw*)
# no cygwin wrapper for mingw
;;
*)
AC_MSG_ERROR(Songbird must be built using MozillaBuild/MSYS)
;;
esac
;;
*darwin*)
SB_PLATFORM="macosx"
case "$target_cpu" in
powerpc* | ppc)
SB_ARCH="ppc"
;;
*i*86* | x86_64)
SB_ARCH="i686"
;;
*)
AC_MSG_ERROR(Unsupported architecture)
;;
esac
;;
*linux*)
SB_PLATFORM="linux"
case "$target_cpu" in
*86)
SB_ARCH="$target_cpu"
;;
x86_64)
SB_ARCH="$target_cpu"
;;
powerpc | ppc)
SB_ARCH="ppc"
;;
powerpc64 | ppc64)
SB_ARCH="ppc64"
;;
*)
AC_MSG_ERROR(Unsupported architecture)
;;
esac
;;
*solaris*)
SB_PLATFORM="solaris"
case "$target_cpu" in
*86)
SB_ARCH="$target_cpu"
;;
x86_64)
SB_ARCH="$target_cpu"
;;
sparc)
SB_ARCH="$target_cpu"
;;
*)
AC_MSG_ERROR(Unsupported architecture)
;;
esac
;;
*)
AC_MSG_ERROR(Unsupported platform $target)
;;
esac
AC_SUBST(SB_PLATFORM)
AC_SUBST(SB_ARCH)
#
# Check for --enable-installer
#
# Always set SB_INSTALLER_SUFFIXES so that the installer can be built
# manually as expected. These are the defaults.
case $SB_PLATFORM in
windows) SB_INSTALLER_SUFFIXES=exe;;
macosx) SB_INSTALLER_SUFFIXES=dmg;;
*) SB_INSTALLER_SUFFIXES=tar.gz;;
esac
# Now process --enable-installer options.
AC_ARG_ENABLE(installer,
[ --enable-installer=TYPE create installer (default=no, use "nsis", "dmg", "pkg",
"tar". "yes" will build default installer type.)],
[enable_installer=`echo $enableval | tr 'A-Z,' 'a-z '`])
case $enable_installer in
yes)
MAKE_INSTALLER=1
;;
no)
AS_UNSET(MAKE_INSTALLER)
;;
*)
AS_UNSET(MAKE_INSTALLER)
for word in $enable_installer; do
case $word in
nsis)
AS_IF([test $SB_PLATFORM = "windows"],
[SB_INSTALLER_SUFFIXES="$SB_INSTALLER_SUFFIXES $word"],
[AC_MSG_ERROR([NSIS installer not supported on $SB_PLATFORM])])
MAKE_INSTALLER=1
;;
dmg|pkg)
AS_IF([test $SB_PLATFORM = "macosx"],
[SB_INSTALLER_SUFFIXES="$SB_INSTALLER_SUFFIXES $word"],
[AC_MSG_ERROR([$word installer not supported on $SB_PLATFORM])])
MAKE_INSTALLER=1
;;
tar.gz)
AS_IF([test $SB_PLATFORM != "windows" -a $SB_PLATFORM != "macosx"],
[SB_INSTALLER_SUFFIXES="$SB_INSTALLER_SUFFIXES $word"],
[AC_MSG_ERROR([$word installer not supported on $SB_PLATFORM])])
MAKE_INSTALLER=1
;;
*)
AC_MSG_ERROR([Installer type $word not recognized])
;;
esac
done
;;
esac
AC_SUBST(MAKE_INSTALLER)
AC_SUBST(SB_INSTALLER_SUFFIXES)
#
# Check for --with-macosx-developer-tools
#
SB_MACOSX_DEV_ROOT_DEFAULT=
SB_MACOSX_DEV_ROOT=
case $SB_PLATFORM in
macosx)
SB_MACOSX_DEV_ROOT_DEFAULT=/Developer
;;
esac
AC_SUBST(SB_MACOSX_DEV_ROOT_DEFAULT)
AC_ARG_WITH(macosx-developer-tools,
[ --with-macosx-developer-tools=DIR path to directory containing the Mac OS X
developer tools (default=/Developer) ],
[ SB_MACOSX_DEV_ROOT=$withval ],
[ SB_MACOSX_DEV_ROOT=$SB_MACOSX_DEV_ROOT_DEFAULT])
AC_SUBST(SB_MACOSX_DEV_ROOT)
#
# Handle SDK detection
#
#
# Initialize SDK paths to nothing for all platforms, and try to guess the
# location of SDKs for certain platforms; we protect this in a case statement
# so we're not running e.g. win32-detection commands on mac.
#
SB_MACOSX_SDK_DEFAULT=
case $SB_PLATFORM in
macosx)
SB_MACOSX_SDK_DEFAULT=$SB_MACOSX_DEV_ROOT/SDKs/MacOSX10.5.sdk
;;
esac
#
# Check for --with-macosx-sdk
#
AC_ARG_WITH(macosx-sdk,
[ --with-macosx-sdk=DIR path to directory containing the Mac OS X SDK
(default=<dev-tools>/SDKs/MacOSX10.5.sdk) ],
[ SB_MACOSX_SDK=$withval ],
[ SB_MACOSX_SDK=$SB_MACOSX_SDK_DEFAULT])
#
# Breakpad support
#
AC_ARG_ENABLE(breakpad,
[ --enable-breakpad enable breakpad (default=yes in official builds)])
# off by default in non-official builds
if test -n "$SONGBIRD_OFFICIAL"; then
SB_ENABLE_BREAKPAD=1
fi
# allow explicit overrides
if test "$enable_breakpad" == "yes"; then
SB_ENABLE_BREAKPAD=1
elif test "$enable_breakpad" == "no"; then
SB_ENABLE_BREAKPAD=
fi
# breakpad is not yet implemented on x86_64
if test "$SB_ARCH" == "x86_64"; then
SB_ENABLE_BREAKPAD=
fi
AC_SUBST(SB_ENABLE_BREAKPAD)
#
# Experimental static build support
#
AC_ARG_ENABLE(static,
[ --enable-static experimental single-component static build support
(default=no)])
if test "$enable_static" == "yes"; then
SB_ENABLE_STATIC=1
else
SB_ENABLE_STATIC=
fi
AC_SUBST(SB_ENABLE_STATIC)
#
# Compiler environment checks
#
AC_ARG_ENABLE(compiler-environment-checks,
[ --enable-compiler-environment-checks check the compiler environment (default=yes)])
if test "$enable_compiler_environment_checks" == "no"; then
SB_ENABLE_COMPILER_ENVIRONMENT_CHECKS=
AC_MSG_WARN([Compiler environment checks disabled.])
else
SB_ENABLE_COMPILER_ENVIRONMENT_CHECKS=1
fi
#
# Checks for programs.
#
# Use the developer tools specified by --with-macosx-developer-tools
if test "$SB_PLATFORM" == "macosx"; then
PATH="${SB_MACOSX_DEV_ROOT}/usr/bin:${PATH}"
fi
# Don't let autoconf hijack our flags
_SAVE_CFLAGS=$CFLAGS
_SAVE_CXXFLAGS=$CXXFLAGS
#
# Must use gcc 4.x on Mac OS X with the 10.5 SDK.
# NOTE: gcc4.0 is the default compiler on 10.5 but not on 10.6 and we still
# support back to 10.4. See bug 17752 for juicy details.
#
case "$SB_PLATFORM" in
windows)
AC_PROG_CC(cl gcc)
AC_PROG_CXX(cl g++)
;;
solaris)
AC_PROG_CC(cc gcc)
AC_PROG_CXX(CC g++)
;;
macosx)
AC_PROG_CC(gcc-4.0 gcc)
AC_PROG_CXX(g++-4.0 g++)
;;
*)
AC_PROG_CC
AC_PROG_CXX
;;
esac
# Restore saved flags
CFLAGS=$_SAVE_CFLAGS
CXXFLAGS=$_SAVE_CXXFLAGS
GNU_CC=$GCC
AC_SUBST(GNU_CC)
AC_CHECK_PROGS(AWK, ${AWK} gawk awk)
if test -z "$AWK"; then AC_MSG_ERROR(Awk not found); fi
AC_CHECK_PROG(CHMOD, chmod, chmod)
if test -z "$CHMOD"; then AC_MSG_ERROR(Chmod not found); fi
AC_CHECK_PROGS(CP, ${CP} gnucp gcp cp)
if test -z "$CP"; then AC_MSG_ERROR(Cp not found); fi
AC_CHECK_PROGS(DIFF, ${DIFF} gdiff diff, "")
AC_CHECK_PROGS(DOXYGEN, ${DOXYGEN} doxygen, "")
AC_CHECK_PROGS(GREP, ${GREP} ggrep grep)
AC_CHECK_PROG(GZIP, gzip, gzip)
AC_CHECK_PROG(GUNZIP, gunzip, gunzip)
AC_CHECK_PROG(FIND, find, find)
if test -z "$FIND"; then AC_MSG_ERROR(Find not found); fi
AC_CHECK_PROGS(INSTALL, ${INSTALL} install)
if test -z "$INSTALL"; then AC_MSG_ERROR(Install not found); fi
AC_CHECK_PROG(LN, ln, ln)
if test -z "$LN"; then AC_MSG_ERROR(Ln not found); fi
AC_PATH_PROGS(MACPKGMAKER, packagemaker, false, $SB_MACOSX_DEV_ROOT/usr/bin)
AC_CHECK_PROGS(MD5SUM, ${MD5SUM} gmd5sum md5sum md5, "")
AC_CHECK_PROG(MKDIR, mkdir, mkdir)
if test -z "$MKDIR"; then AC_MSG_ERROR(Mkdir not found); fi
AC_CHECK_PROG(MV, mv, mv)
if test -z "$MV"; then AC_MSG_ERROR(Mv not found); fi
AC_CHECK_PROG(PERL, perl, perl)
if test -z "$PERL"; then AC_MSG_ERROR(Perl not found); fi
AC_CHECK_PROGS(PYTHON, python2 python, python)
if test -z "$PYTHON"; then AC_MSG_ERROR(Python not found); fi
AC_CHECK_PROG(RM, rm, rm)
if test -z "$RM"; then AC_MSG_ERROR(Rm not found); fi
AC_CHECK_PROGS(SED, ${SED} gsed sed, "")
AC_CHECK_PROGS(SHA1SUM, ${SHA1SUM} gsha1sum sha1sum, "")
AC_CHECK_PROGS(SORT, ${SORT} sort, "")
AC_CHECK_PROGS(TAR, ${TAR} gtar tar)
AC_CHECK_PROGS(TOUCH, ${TOUCH} touch, "")
AC_CHECK_PROG(UNZIP, unzip, unzip)
if test -z "$UNZIP"; then AC_MSG_ERROR(Unzip not found); fi
AC_CHECK_PROG(ZIP, zip, zip)
if test -z "$ZIP"; then AC_MSG_ERROR(Zip not found); fi
#
# Check for extras.
#
HAS_EXTRAS=
if test -d "${srcdir}/extras"; then
HAS_EXTRAS=1
fi
AC_SUBST(HAS_EXTRAS)
case "$SB_PLATFORM" in
windows)
AC_CHECK_PROG(LD, link, link)
if test -z "$LD"; then AC_MSG_ERROR(Linker not found); fi
AC_CHECK_PROG(AR, lib, lib)
if test -z "$AR"; then AC_MSG_ERROR(Librarian not found); fi
AC_CHECK_PROG(RC, rc, rc)
if test -z "$RC"; then AC_MSG_ERROR(Rc not found); fi
AC_CHECK_PROG(MIDL, midl, midl)
if test -z "$MIDL"; then AC_MSG_ERROR(Midl not found); fi
AC_CHECK_PROG(REBASE, rebase, rebase, "EDITBIN /DYNAMICBASE:no /REBASE:")
if test -z "$REBASE"; then AC_MSG_ERROR(Rebase not found); fi
# Check midl version
changequote(,)
_MIDL_VER_FILTER='s|.* \([0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
changequote([,])
_MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -ne "$_MIDL_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.
DEFAULT_MIDL_FLAGS="${MIDL_FLAGS} -env win32 -Oicf -robust"
AC_MSG_RESULT([need -env win32])
else
AC_MSG_RESULT([none needed])
fi
;;
*)
AC_MSG_RESULT([none needed])
;;
esac
# Tests for bits of the Windows SDK
AC_CHECK_HEADERS(wmsdk.h, [], AC_MSG_ERROR(Missing wmsdk.h; install the Windows SDK))
# Only run this check if we don't have extras; if we do, we'll find it
# that way.
if test -z "$HAS_EXTRAS"; then
AC_CHECK_HEADERS([devioctl.h], [], AC_MSG_ERROR([Missing devioctl.h; install the Windows Driver Kit]))
fi
_SAVE_LIBS=$LIBS
LIBS="$LIBS wmvcore.lib"
AC_MSG_CHECKING([wmvcore.lib])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <wmsdk.h>
int main() { return WMCreateSyncReader(NULL, 0, NULL); }])],
AC_MSG_RESULT([yes]),
AC_MSG_ERROR([Missing wmvcore.lib; install the Windows SDK]))
LIBS=$_SAVE_LIBS
#
# Force use of the freely-downloadable MSVC Express compiler
#
AC_LANG_PUSH([C++])
AC_ARG_WITH(msvc-express,
[ --with-msvc-express limit to features buildable with MSVC Express],
[SB_WITH_MSVC_EXPRESS=1
AC_MSG_WARN([Limiting functionality to MSVC Express-compatible])],
[SB_WITH_MSVC_EXPRESS=
AC_CHECK_HEADER([atlbase.h],
[],
[AC_MSG_ERROR([Missing altbase.h])])])
AC_SUBST([SB_WITH_MSVC_EXPRESS])
AC_LANG_POP([C++])
;;
*)
AC_CHECK_PROG(LD, ${CXX}, ${CXX})
if test -z "$LD"; then AC_MSG_ERROR(Linker not found); fi
AC_CHECK_PROG(AR, ar, ar)
if test -z "$AR"; then AC_MSG_ERROR(Archiver not found); fi
AC_CHECK_PROG(RANLIB, ranlib, ranlib)
if test -z "$RANLIB"; then AC_MSG_ERROR(Ranlib not found); fi
if test -z "$GZIP"; then AC_MSG_ERROR(Gzip not found); fi
if test -z "$GUNZIP"; then AC_MSG_ERROR(Gunzip not found); fi
if test -z "$TAR"; then AC_MSG_ERROR(Tar not found); fi
AC_CHECK_PROGS(STRIP, ${STRIP} strip)
if test -z "$STRIP"; then AC_MSG_WARN(strip not found); fi
;;
esac
#
# Set platform-specific defines
#
case "$SB_PLATFORM" in
windows)
BIN_SUFFIX=".exe"
OBJ_SUFFIX=".obj"
LIB_PREFIX=""
LIB_SUFFIX=".lib"
DLL_SUFFIX=".dll"
INSTALLER_SUFFIX=".exe"
AC_DEFINE(UNICODE)
AC_DEFINE(_UNICODE)
AC_DEFINE(_WINDOWS)
AC_DEFINE(_WIN32)
AC_DEFINE(WIN32)
AC_DEFINE(XP_WIN)
AC_DEFINE(XP_WIN32)
AC_DEFINE(WIN32_LEAN_AND_MEAN)
AC_DEFINE(SB_USE_JEMALLOC)
;;
macosx)
BIN_SUFFIX=
OBJ_SUFFIX=".o"
LIB_PREFIX="lib"
LIB_SUFFIX=".a"
DLL_SUFFIX=".dylib"
INSTALLER_SUFFIX=".dmg"
AC_DEFINE(XP_MACOSX)
AC_DEFINE(XP_UNIX)
AC_DEFINE(NO_X11)
;;
linux|solaris)
BIN_SUFFIX=
OBJ_SUFFIX=".o"
LIB_PREFIX="lib"
LIB_SUFFIX=".a"
DLL_SUFFIX=".so"
INSTALLER_SUFFIX=".tar.gz"
AC_DEFINE(XP_UNIX)
AC_DEFINE(_REENTRANT)
;;
esac
AC_SUBST(BIN_SUFFIX)
AC_SUBST(OBJ_SUFFIX)
AC_SUBST(LIB_PREFIX)
AC_SUBST(LIB_SUFFIX)
AC_SUBST(DLL_SUFFIX)
AC_SUBST(INSTALLER_SUFFIX)
#
# Set platform-specific flags
#
case "$SB_PLATFORM" in
windows)
# We use MSVC8 on Windows
_CC_SUPPORTED_MAJOR_VERSION=14
changequote(,)
_MSVC_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
changequote([,])
# Determine compiler version
CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
_CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
_CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
_CC_BUILD_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
_MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
CXX_VERSION=`"${CXX}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
_CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
if test -z "$SB_ENABLE_COMPILER_ENVIRONMENT_CHECKS"; then
AC_MSG_WARN([The major versions of \$CC and \$CXX do not match. Songbird Bugzilla reports should not be filed against builds produced using them.])
else
AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
fi
fi
case "$_CC_MAJOR_VERSION" in
14)
_CC_SUITE=8
SB_ARCH=$SB_ARCH-msvc8
# We need at least SP1 (bug 21339)
if test "$_CC_BUILD_VERSION" -lt 762 ; then
# SP0 is 14.00.50727.42
# SP1 is 14.00.50727.762
if test -z "$SB_ENABLE_COMPILER_ENVIRONMENT_CHECKS"; then
AC_MSG_WARN([Visual Studio 8 (2005) without Service Pack 1 detected; your build may not complete.])
else
AC_MSG_ERROR([Visual Studio 8 (2005) requires Service Pack 1 to build Songbird. Please install KB926601.])
fi
fi
;;
15)
_CC_SUITE=9
;;
16)
_CC_SUITE=10
;;
esac
if test "$_CC_MAJOR_VERSION" -lt "$_CC_SUPPORTED_MAJOR_VERSION"; then
if test -z "$SB_ENABLE_COMPILER_ENVIRONMENT_CHECKS"; then
AC_MSG_WARN([This version of the MSVC compiler, $CC_VERSION, is unsupported. Songbird Bugzilla reports should not be filed against builds produced using it.])
else
AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION, is unsupported.])
fi
fi
# mozilla bug #249782
# ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
if test "$_CC_SUITE" -ge "8"; then
changequote(,)
_MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
changequote([,])
MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
if test -n "$MSMT_TOOL"; then
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="mt"
unset MSMT_TOOL
else
AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
fi
fi
# Check linker version
_LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_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
MSVC_COMPILER_FLAGS="-nologo -W3 -WL -GS -EHsc -Zi -c"
if test "$_CC_SUITE" -ge "8"; then
# MSVC 8+ use native wchar_t, but Mozilla builds without it
MSVC_COMPILER_FLAGS="$MSVC_COMPILER_FLAGS -Zc:wchar_t-"
fi
if test "$enable_debug" = "yes"; then
MSVC_COMPILER_FLAGS="$MSVC_COMPILER_FLAGS -Od -RTC1 -RTCc"
else
MSVC_COMPILER_FLAGS="$MSVC_COMPILER_FLAGS -Ox"
fi
if test "$enable_debug" == "yes"; then
CFLAGS_STATIC_LIBC="-MTd"
else
CFLAGS_STATIC_LIBC="-MT"
fi
if test "$SB_USE_JEMALLOC" != "1"; then
MSVC_COMPILER_FLAGS="$MSVC_COMPILER_FLAGS $CFLAGS_STATIC_LIBC"
fi
# We always want to include "mozilla-config.h"
MSVC_COMPILER_FLAGS="$MSVC_COMPILER_FLAGS -FI \"mozilla-config.h\" -FI \"xpcom-config.h\""
MSVC_LINKER_FLAGS="-NOLOGO -INCREMENTAL:NO -SUBSYSTEM:WINDOWS -MACHINE:X86 -DEBUG"
if test "$enable_debug" != "yes"; then
MSVC_LINKER_FLAGS="$MSVC_LINKER_FLAGS -OPT:REF -OPT:ICF"
fi
if test "$SB_USE_JEMALLOC" == "1"; then
if test "$enable_debug" == "yes"; then
MOZ_CRT_DLL_NAME="mozcrt19d"
else
MOZ_CRT_DLL_NAME="mozcrt19"
fi
MSVC_DLL_LINKER_FLAGS="-NODEFAULTLIB:MSVCRT -NODEFAULTLIB:MSVCRTD -NODEFAULTLIB:LIBCMT -NODEFAULTLIB:LIBCMTD -DEFAULTLIB:$MOZ_CRT_DLL_NAME"
fi
CFLAGS="$CFLAGS $MSVC_COMPILER_FLAGS -TC"
CXXFLAGS="$CXXFLAGS $MSVC_COMPILER_FLAGS -TP"
CFLAGS_INCLUDE_PREFIX="-I"
CFLAGS_INCLUDE_SUFFIX=""
CFLAGS_PREPROCESS="-P"
CFLAGS_ASSEMBLER="-FAs"
# Always disable warning 4624, because the XPCOM elicits this warning.
# Also disable warning 4800, it isn't useful, and using nsString with
# std::map causes it
CFLAGS_WARNING_IS_ERROR="-wd4624 -wd4800"
LDFLAGS="$LDFLAGS $MSVC_LINKER_FLAGS"
LDFLAGS_DLL="-DLL $MSVC_DLL_LINKER_FLAGS"
LDFLAGS_BIN=""
LDFLAGS_LIB=""
LDFLAGS_OUT_PREFIX="-OUT:\""
LDFLAGS_OUT_SUFFIX="\""
LDFLAGS_PATH_PREFIX="-LIBPATH:\""
LDFLAGS_PATH_SUFFIX="\""
LDFLAGS_IMPORT_PREFIX=""
LDFLAGS_IMPORT_SUFFIX="${LIB_SUFFIX}"
DEFAULT_LIBS="kernel32 user32 gdi32 winmm wsock32 advapi32 comctl32 ole32 oleaut32"
LNFLAGS="-f --symbolic"
ARFLAGS="-NOLOGO"
ARFLAGS_OUT_PREFIX="-OUT:\""
ARFLAGS_OUT_SUFFIX="\""
ARFLAGS_PATH_PREFIX=""
ARFLAGS_PATH_SUFFIX=""
ARFLAGS_LIB=""
UNZIPFLAGS="-u -o -q -X"
UNZIPFLAGS_EXTRACT="-d"
XULRUNNERDIR="/xulrunner"
COMPILER_GARBAGE="vc70.pdb vc71.pdb vc80.pdb vc90.pdb"
;;
macosx)
if ! test -e $SB_MACOSX_SDK/SDKSettings.plist; then
AC_ERROR(Invalid Mac OS X SDK directory: $SB_MACOSX_SDK)
fi
MACOSX_APPBUNDLE="Nightingale.app"
MACOSX_CONTENTS="/$MACOSX_APPBUNDLE/Contents"
MACOSX_RESOURCES="$MACOSX_CONTENTS/Resources"
MACOSX_FRAMEWORKS="$MACOSX_CONTENTS/Frameworks"
XULRUNNERDIR="/XUL.framework"
GCC_COMPILER_FLAGS="-c -fexceptions -fnon-call-exceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -fpascal-strings -no-cpp-precomp -Wall -Wconversion -Wpointer-arith -Wcast-align -Wno-long-long -fshort-wchar -pipe"
GCC_CPP_COMPILER_FLAGS="-Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti"
if test "$enable_debug" = "yes"; then
GCC_COMPILER_FLAGS="$GCC_COMPILER_FLAGS -g -ggdb3 -fno-inline"
else
# Use -O2 on OS X, better than -Os according to moz perf tests
GCC_COMPILER_FLAGS="$GCC_COMPILER_FLAGS -gstabs+ -O2"
fi
# We always want to include "mozilla-config.h"
GCC_COMPILER_FLAGS="$GCC_COMPILER_FLAGS -include \"mozilla-config.h\""
GCC_LINKER_FLAGS="-lpthread -lobjc -shared-libgcc -lstdc++ -Wl,-executable_path,\$(topsrcdir)/$OBJDIRNAME/$DISTDIRNAME$MACOSX_FRAMEWORKS$XULRUNNERDIR"
CFLAGS="$CFLAGS $GCC_COMPILER_FLAGS"
CXXFLAGS="$CXXFLAGS $GCC_COMPILER_FLAGS $GCC_CPP_COMPILER_FLAGS"
CMMFLAGS="$CMMFLAGS $GCC_COMPILER_FLAGS $GCC_CPP_COMPILER_FLAGS -fobjc-exceptions -DUSE_COCOA"
CFLAGS_INCLUDE_PREFIX="-I"
CFLAGS_INCLUDE_SUFFIX=""
CFLAGS_PREPROCESS="-E"
CFLAGS_ASSEMBLER="-S"
CFLAGS_WARNING_IS_ERROR=""
LDFLAGS="$LDFLAGS $GCC_LINKER_FLAGS"
LDFLAGS_DLL=""
LDFLAGS_BIN=""
LDFLAGS_LIB="-static"
LDFLAGS_OUT_PREFIX="-o "
LDFLAGS_OUT_SUFFIX=""
LDFLAGS_PATH_PREFIX="-L"
LDFLAGS_PATH_SUFFIX=""
LDFLAGS_IMPORT_PREFIX="-l"
LDFLAGS_IMPORT_SUFFIX=""
LNFLAGS="-f -s"
ARFLAGS="cr"
ARFLAGS_OUT_PREFIX=""
ARFLAGS_OUT_SUFFIX=""
ARFLAGS_PATH_PREFIX=""
ARFLAGS_PATH_SUFFIX=""
ARFLAGS_LIB=""
UNZIPFLAGS="-u -o -q -X"
UNZIPFLAGS_EXTRACT="-d"
USING_RANLIB=1
STRIP_FLAGS="-x -S"
AC_SUBST(SB_MACOSX_SDK)
;;
linux)
XULRUNNERDIR="/xulrunner"
_SAVE_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS([pthread_create], [pthread])
AC_SUBST(PTHREAD_LIBS, $LIBS)
LIBS=$_SAVE_LIBS
PKG_CHECK_MODULES(GTK, gtk+-2.0)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
PKG_CHECK_MODULES(GLIB, glib-2.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
# The iPod support needs dbus.
PKG_CHECK_MODULES(DBUS, dbus-glib-1)
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
# Breakpad needs stabs debugging data, so always explicitly request it with
GCC_COMPILER_FLAGS="-c -fPIC -fshort-wchar -fexceptions -fnon-call-exceptions -funwind-tables -fasynchronous-unwind-tables -fno-rtti -fno-strict-aliasing -Wall -Wno-conversion -Wno-attributes -Wpointer-arith -Wcast-align -Wno-long-long -pipe -pthread"
if test "$enable_debug" = "yes"; then
GCC_COMPILER_FLAGS="$GCC_COMPILER_FLAGS -g -ggdb3 -fno-inline"
else
GCC_COMPILER_FLAGS="$GCC_COMPILER_FLAGS -gstabs+"
fi
# We always want to include "mozilla-config.h"
GCC_COMPILER_FLAGS="$GCC_COMPILER_FLAGS -include \"mozilla-config.h\""
# hardcoding to just "clang" is lame. prevents "/usr/bin/clang", etc.
if test "$CC" == "clang" ; then
GCC_LINKER_FLAGS="-L\$(topsrcdir)/$OBJDIRNAME/$DISTDIRNAME$XULRUNNERDIR"