-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·3476 lines (3070 loc) · 97.3 KB
/
configure
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
#!/bin/sh
#
# GPAC configure script
# (c) 2003-2018 Telecom ParisTech
# Authors: Jean Le Feuvre, Romain Bouqueau
#
#set -v
#set temporary file name
if test ! -z "$TMPDIR" ; then
TMPDIR1="${TMPDIR}"
elif test ! -z "$TEMPDIR" ; then
TMPDIR1="${TEMPDIR}"
else
TMPDIR1="/tmp"
fi
#remember the ./configure command line
GPAC_CONFIGURATION="$@"
TMPC="${TMPDIR1}/gpac-conf-${RANDOM}-$$-${RANDOM}.c"
TMPH="${TMPDIR1}/gpac-conf-${RANDOM}-$$-${RANDOM}.h"
TMPCXX="${TMPDIR1}/gpac-conf-${RANDOM}-$$-${RANDOM}.cpp"
TMPE="${TMPDIR1}/gpac-conf-${RANDOM}-$$-${RANDOM}"
TMPO="${TMPDIR1}/gpac-conf-${RANDOM}-$$-${RANDOM}.o"
TMPS="${TMPDIR1}/gpac-conf-${RANDOM}-$$-${RANDOM}.S"
TMPL="${TMPDIR1}/gpac-conf-${RANDOM}-$$-${RANDOM}.LOG"
#default parameters
DESTDIR=""
prefix="/usr/local"
mandir=""
cross_prefix=""
targetos=""
dxsdk_path=""
moz_path="local"
cc_orig=$CC
if test "$cc_orig" = "" ; then
cc_orig="gcc"
fi
cxx_orig=$CXX
if test "$cxx_orig" = "" ; then
cxx_orig="g++"
fi
ar="ar"
ranlib="ranlib"
make="make"
strip="strip"
pkg_config="pkg-config"
windres="windres"
readelf="readelf"
install="${INSTALL:=install}"
instflags="${INSTFLAGS:=-p}"
cpu=`uname -m`
debuginfo="no"
sdl_path=""
sdl_local="no"
sdl_static="no"
verbose="no"
xulsdk_path="/usr/lib/xulrunner/sdk/include"
xul_flags=""
libdir="lib"
#GPAC module config
static_modules="no"
js_flags="XP_UNIX"
js_lib="-ljs"
lm_lib=""
has_mingw_directx="no"
has_js="no"
has_platinum="no"
has_ft="no"
has_jpeg="no"
has_png="no"
has_xvid="no"
has_mad="no"
has_faad="no"
has_ffmpeg="no"
has_amr_nb_fixed="no"
has_amr_nb="no"
has_amr_wb="no"
has_ogg="no"
has_vorbis="no"
has_theora="no"
has_a52="no"
has_pulseaudio="no"
has_oss_audio="no"
has_alsa="no"
has_jack="no"
has_directfb="no"
has_x11="no"
has_x11_shm="no"
has_x11_xv="no"
no_gcc_opt="no"
use_fixed_point="no"
use_memory_tracking="no"
has_opengl="no"
has_tinygl="no"
enable_tinygl="no"
has_ssl="no"
has_ipv6="no"
has_dvb4linux="no"
has_xmlrpc="no"
has_openjpeg="no"
gprof_build="no"
static_build="no"
want_pic="no"
want_gcov="no"
has_joystick="no"
has_xul="no"
has_hid="no"
enable_joystick="no"
static_mp4box="no"
disable_core_tools="no"
disable_3d="no"
disable_svg="no"
disable_vrml="no"
disable_x3d="no"
disable_od="no"
disable_bifs="no"
disable_bifs_enc="no"
disable_laser="no"
disable_saf="no"
disable_smgr="no"
disable_seng="no"
disable_qtvr="no"
disable_avi="no"
disable_m2ps="no"
disable_m2ts="no"
disable_m2ts_mux="no"
disable_ogg="no"
disable_parsers="no"
disable_import="no"
disable_export="no"
disable_swf="no"
disable_scene_stats="no"
disable_scene_dump="no"
disable_scene_encode="no"
disable_loader_isoff="no"
disable_loader_bt="no"
disable_loader_xmt="no"
disable_od_dump="no"
disable_od_parse="no"
disable_isom_dump="no"
disable_crypto="no"
disable_mpd="no"
disable_dash="no"
disable_isoff="no"
disable_isoff_write="no"
disable_isoff_frag="no"
disable_isoff_hint="no"
disable_isoff_frag="no"
disable_isoff_hds="no"
disable_streaming="no"
disable_player="no"
disable_scenegraph="no"
disable_dvbx="yes"
disable_vobsub="no"
disable_ttxt="no"
disable_ttml="no"
disable_hevc="no"
disable_atsc="no"
disable_mcrypt="no"
enable_depth_compositor="no"
enable_renoir="no"
has_avcap="no"
avcap_cflags=""
avcap_ldflags="-lavcap"
has_opensvc="no"
has_openhevc="no"
win32="no"
mingw32="no"
cygwin="no"
linux="no"
freebsd="no"
darwin="no"
sunos="no"
alt_macosx_dir=""
Mac_Applications=""
extralibs="-lm"
bigendian="no"
SHFLAGS=-shared
need_inet_aton="no"
CFLAGS=""
CXXFLAGS=""
GPAC_SH_FLAGS=-lpthread
DYN_LIB_SUFFIX=".so"
X11_PATH="/usr/X11R6"
OSS_CFLAGS=""
OSS_LDFLAGS=""
INSTFLAGS=""
is_64="no"
ffmpeg_extra_ldflags=""
logs="config.log"
echo "Logs for GPAC configure $GPAC_CONFIGURATION" > $logs
#configure usage
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
cat << EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]
GPAC configuration options:
--help print this message
--prefix=PREFIX install in PREFIX [$prefix]
--mandir=DIR man documentation in DIR [PREFIX/man]
--verbose enable verbose building [$verbose]
--source-path=PATH path of source code [$source_path]
--cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
--target-os=TARGETOS use TARGETOS for compile tools [$targetos]
--cc=CC use C compiler CC [$cc]
--cxx=CXX use C++ compiler CXX [$cxx]
--make=MAKE use specified make [$make]
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
--extra-libs=ELIBS add ELIBS [$ELIBS]
--cpu=CPU force cpu to CPU [$cpu]
--sdl-cfg=SDL_PATH specify path to sdl-config for local install [$sdl_path]
--enable-sdl-static use static SDL linking [default=no]
--X11-path=X11_PATH specify path for X11 includes and libraries [$X11_PATH]
--dxsdk-path=DX_PATH specify directX SDK for MinGW [$dxsdk_path]
--xulsdk-path=XUL_PATH specify Mozilla XUL (Gecko) SDK include path [$xulsdk_path]
--mozdir=MOZ_PATH specify mozilla main directory path for system install
--extra-ff-ldflags=ELDFLAGS add ELDFLAGS to FFMPEG LDFLAGS [$ffmpeg_extra_ldflags]
--enable-debug produce debug version
--enable-gprof enable profiling
--enable-gcov enable coverage
--enable-pic enable Position Independant Code for shared objects
--strip enable strip
--std-allocator uses standard lib memory allocator
--static-modules includes static modules in libgpac whenever possible
--enable-mem-track enable tracking of all memory allocated by gpac
--disable-opt disable GCC optimizations
--disable-ipv6 disable IPV6 support
--disable-wx disable wxWidgets support
--disable-platinum disable Platinum UPnP support
--disable-alsa disable Alsa audio
--disable-oss-audio disable OSS audio
--enable-jack enable Jack audio
--disable-jack disable Jack audio
--enable-pulseaudio enable Pulse audio
--disable-pulseaudio disable Pulse audio
--disable-x11 disable X11
--disable-x11-shm disable X11 shared memory support
--disable-x11-xv disable X11 Xvideo support
--enable-fixed-point enable fixed-point math
--enable-tinygl enable TinyGL support
--enable-joystick enable joystick support
--disable-ssl disable OpenSSL support
--enable-amr-nb-fixed enable AMR NB fixed-point decoder
--enable-amr-nb enable AMR NB library
--enable-amr-wb enable AMR WB library
--enable-amr enable both AMR NB and WB libraries
--enable-static-bin link statically against libgpac
--static-mp4box configure for static linking of MP4Box only.
--enable-depth enables depth handling in the compositor
Configuration options for libgpac - all options can be enabled with --enable-optname
--disable-all disables all features in libgpac
--disable-3d disable 3D rendering
--disable-svg disable SVG
--disable-vrml disable MPEG-4/VRML/X3D
--disable-x3d disable X3D only
--disable-odf disable full support of MPEG-4 OD Framework
--disable-bifs disable BIFS
--disable-bifs-enc disable BIFS coder
--disable-laser disable LASeR coder
--disable-saf disable SAF container
--disable-seng disable scene encoder engine
--disable-qtvr disable import of Cubic QTVR files
--disable-avi disable AVI
--disable-ogg disable OGG
--disable-m2ps disable MPEG2 PS
--disable-m2ts disable MPEG2 TS
--disable-m2ts-mux disable MPEG2 TS Multiplexer
--disable-dvb4linux disable dvb4linux support
--disable-parsers disable AV parsers
--disable-import disable media importers
--disable-export disable media exporters
--disable-swf disable SWF import
--disable-scene-stats disable scene graph statistics
--disable-scene-dump disable scene graph dump
--disable-scene-encode disable BIFS & LASeR to ISO File Format encoding
--disable-loader-isoff disable scene loading from ISO File Format
--disable-loader-bt disable scene loading from ISO File Format
--disable-loader-xmt disable scene loading from ISO File Format
--disable-od-dump disable OD dump
--disable-isom-dump disable ISOM dump
--disable-crypt disable crypto tools
--disable-isoff disable ISO File Format
--disable-isoff-write disable ISO File Format edit/write
--disable-isoff-hint disable ISO File Format hinting
--disable-isoff-frag disable fragments in ISO File Format
--disable-isoff-hds disable HDS support in ISO File Format
--disable-streaming disable RTP/RTSP/SDP
--disable-dvbx disable DVB-specific tools (MPE, FEC, DSM-CC)
--disable-vobsub disable VobSub support
--disable-sman disable scene manager
--disable-ttxt disable TTXT (3GPP / MPEG-4 Timed Text) support
--disable-player disable player (terminal and compositor)
--disable-scenegraph disable scenegraph, scene parsers and player (terminal and compositor)
--disable-hevc disable HEVC support
--disable-atsc disable ATSC3 support
--disable-mcrypt disable MCRYPT support
Extra libraries configuration. You can turn a libray off or force using the local version in gpac/extra_lib/
--use-js=OPT force SpiderMonkey ECMAScript OPT=[no,local]
--use-ft=OPT force FreeType OPT=[no,local]
--use-zlib=OPT force ZLIB OPT=[no,system,local]
--use-jpeg=OPT force JPEG OPT=[no,local]
--use-png=OPT force PNG OPT=[no,local]
--use-faad=OPT force FAAD OPT=[no,local]
--use-mad=OPT force MAD OPT=[no,local]
--use-xvid=OPT force XVID OPT=[no,local]
--use-ffmpeg=OPT force FFMPEG OPT=[no,local]
--use-ogg=OPT force OGG OPT=[no,system,local]
--use-vorbis=OPT force vorbis OPT=[no,system,local]
--use-theora=OPT force theora OPT=[no,system,local]
--use-openjpeg=OPT force openjpeg OPT=[no,system,local]
--use-a52=OPT force a52 (ac3) OPT=[no,system,local]
NOTE: The object files are build at the place where configure is launched
EOF
exit 1
fi
for opt do
case "$opt" in
--prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
;;
--libdir=*) libdir=`echo $opt | cut -d '=' -f 2`
;;
--mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
;;
--cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` && echo "cross-prefix detected: $cross_prefix"
;;
--target-os=*) targetos=`echo $opt | cut -d '=' -f 2` && echo "target-os detected: $targetos"
;;
--cc=*) cc_orig=`echo $opt | cut -d '=' -f 2`
;;
--cxx=*) cxx_orig=`echo $opt | cut -d '=' -f 2`
;;
--cpp=*) cxx_orig=`echo $opt | cut -d '=' -f 2`
;;
--make=*) make=`echo $opt | cut -d '=' -f 2`
;;
--extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
;;
--extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
;;
--extra-ff-ldflags=*) ffmpeg_extra_ldflags=`echo $opt | cut -d '=' -f 2`
;;
--extra-libs=*) extralibs=${opt#--extra-libs=}
;;
--cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
;;
--enable-debug) debuginfo="yes"; no_gcc_opt="yes"
;;
--disable-opt) no_gcc_opt="yes"
;;
--enable-pic) want_pic="yes";
;;
--enable-gcov) want_gcov="yes";
;;
--verbose) verbose="yes";
;;
esac
done
cc="${cc_orig}"
cxx="${cxx_orig}"
case "$cpu" in
i386|i486|i586|i686|i86pc|BePC)
cpu="x86"
;;
x86_64|amd64)
cpu="x86"
if [ "$linux" = "yes" -o "$darwin" = "yes" ] ; then
is_64="yes"
fi
case `uname -s` in
SunOS)
canon_arch=`isainfo -n`
;;
Darwin)
canon_arch="x86_64"
;;
*)
canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
;;
esac
if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
cpu="x86_64"
want_pic="yes"
is_64="yes"
fi
fi
;;
armv4l|arm)
cpu="armv4l"
;;
alpha)
cpu="alpha"
;;
ppc64)
cpu="powerpc"
;;
"Power Macintosh"|ppc)
cpu="powerpc"
;;
mips)
cpu="mips"
;;
sh4|sh4a|sh)
cpu="sh4"
;;
sun4u|sun4v)
cpu="sparc"
if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
is_64="yes"
PIC_CFLAGS="-fPIC -DPIC"
want_pic="yes"
fi
;;
*)
cpu="unknown"
;;
esac
#checking for CFLAGS
if test -z "$CFLAGS"; then
CFLAGS=""
fi
cc="${cross_prefix}${cc}"
#for ccache
cc="${cc}"
cxx="${cross_prefix}${cxx}"
ar="${cross_prefix}${ar}"
ranlib="${cross_prefix}${ranlib}"
strip="${cross_prefix}${strip}"
pkg_config="${pkg_config}"
windres="${cross_prefix}${windres}"
#check pkg_config
if test "$cross_prefix" = "" ; then
if ! $pkg_config --version >/dev/null 2>>$logs ; then
pkg_config="no"
fi
fi
#find source path
source_path="`echo $0 | sed -e 's#/configure##'`"
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
source_path="`pwd`"
source_path_used="no"
build_path=$source_path
else
source_path="`cd \"$source_path\"; pwd`"
build_path="`pwd`"
fi
#OS specific
if test "$targetos" = "" ; then
targetos=`uname -s`
fi
case $targetos in
BeOS)
js_flags=-DXP_BEOS
xul_flags=-DXP_BEOS
prefix="/boot/home/config"
CFLAGS="$CFLAGS -DPIC -fomit-frame-pointer"
# 3 gcc releases known for BeOS, each with ugly bugs
gcc_version="$($cc -v 2>>$logs | grep version | cut -d ' ' -f3-)"
case "$gcc_version" in
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
;;
*20010315*) echo "BeBits gcc"
CFLAGS="$CFLAGS -fno-expensive-optimizations"
;;
esac
SHFLAGS=-nostart
#no need for libm, but the inet stuff
#check for BONE
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
extralibs="-lbind -lsocket"
else
need_inet_aton="yes"
extralibs="-lnet"
fi
;;
SunOS)
make="gmake"
readelf="greadelf"
LDFLAGS="$LDFLAGS"
instflags=""
#check for 64-bit
cat > $TMPC << EOF
#include <stdio.h>
int main( void ) { return 0; }
EOF
CFLAGS_NO_LTO=$(echo ${CFLAGS} | sed -e 's/\ -flto[-A-Za-z0-9=]*//g')
$cc ${CFLAGS_NO_LTO} -o $TMPO $TMPC 2>>$logs && $($readelf -h $TMPO | grep "Class:.*ELF64$" >/dev/null 2>>$logs)
if test $? -eq 0; then
is_64="yes"
fi
if test "$is_64" = "yes"; then
if test "$cpu" = "x86_64"; then
libdir=lib/amd64
elif test "$cpu" = "sparc"; then
libdir=lib/sparcv9
fi
fi
sunos="yes"
need_inet_aton="yes"
extralibs="$extralibs -lsocket -lnsl"
;;
FreeBSD)
make="gmake"
LDFLAGS="$LDFLAGS -export-dynamic"
CFLAGS="$CFLAGS -pthread"
GPAC_SH_FLAGS=-pthread
freebsd="yes"
js_flags="-DXP_UNIX -I/usr/include/js"
;;
BSD/OS)
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
;;
Darwin)
js_flags=-DXP_MAC
xul_flags=-DXP_MAC
CFLAGS_DIR="-I$prefix/include"
LDFLAGS="-L$prefix/lib"
if test -d /sw/bin ; then
alt_macosx_dir="/sw"
CFLAGS_DIR="-I/sw/include $CFLAGS_DIR"
LDFLAGS="-L/sw/lib $LDFLAGS"
elif test -d /opt/local/bin ; then
alt_macosx_dir="/opt/local"
CFLAGS_DIR="-I/opt/local/include $CFLAGS_DIR"
LDFLAGS="-L/opt/local/lib $LDFLAGS"
fi
Mac_Applications="/Applications"
SHFLAGS="-dynamiclib"
DYN_LIB_SUFFIX=".dylib"
extralibs=""
GPAC_SH_FLAGS=""
strip="strip -x"
if test "$is_64" = "yes" ; then
LDFLAGS="$LDFLAGS"
fi
darwin="yes"
gcc_version=`$cc -v 2>>$logs | grep version | cut -d ' ' -f3`
case "$gcc_version" in
*2.95*)
CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
;;
3.*)
CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -mdynamic-no-pic -fno-common"
;;
4.*)
CFLAGS="$CFLAGS -pipe -fomit-frame-pointer -fno-common"
;;
esac
;;
MINGW32*|mingw32|MINGW64*|mingw64|msys*|MSYS*)
js_flags="-DXP_PC -D_declspec=__declspec"
mingw32="yes"
win32="yes"
want_pic="no"
#ugly patch for msys2 mingw32/mingw64 where toolchain is not properly setup
if [ x"$MSYSTEM" = x"MSYS" ] && [ -e /mingw64 ]; then
extralibs="$extralibs -lws2_32 -lwinmm -limagehlp"
CFLAGS="$CFLAGS -I/mingw64/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
LDFLAGS="$LDFLAGS -L/mingw64/lib"
elif [ x"$MSYSTEM" = x"MSYS" ] && [ -e /mingw32 ]; then
extralibs="-L/mingw32/lib $extralibs -lws2_32 -lwinmm -limagehlp"
CFLAGS="$CFLAGS -I/mingw32/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
LDFLAGS="$LDFLAGS -L/mingw32/lib"
else
extralibs="$extralibs -lws2_32 -lwinmm -limagehlp"
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
fi
LDFLAGS="$LDFLAGS"
if test "$cross_prefix" != "" ; then
GPAC_SH_FLAGS=""
fi
;;
CYGWIN*|cygwin*)
js_flags=-DXP_PC
extralibs="$extralibs -lws2_32 -lwinmm"
cygwin="yes"
win32="yes"
;;
Linux|linux|android)
js_flags="-DXP_UNIX -I/usr/include/js"
LDFLAGS="$LDFLAGS -Wl,--warn-common -Wl,-z,defs"
linux="yes"
case "$cpu" in
sh4)
CFLAGS="$CFLAGS -isystem \"$prefix/include\""
;;
esac
cat > $TMPC << EOF
#include <sys/cdefs.h>
#if !defined (__BIONIC__)
#error
#endif
EOF
if $cc -c $CFLAGS $TMPC 0>/dev/null 2>$TMPL ; then
#bionic libc (android)
CFLAGS="$CFLAGS -DPTHREAD_HAS_NO_CANCEL"
GPAC_SH_FLAGS=""
fi
;;
*) ;;
esac
#defines directory for binaries and libs (ex. for TinyGL)
target_bin_dir=""
if test "$cross_prefix" = "" ; then
target_bin_dir=`${cc} -v 2>>$logs | sed -n '2p' | awk ' {print $2}'`-${cc_orig}
else
target_bin_dir=${cross_prefix}${cc_orig}
fi
#if test "$source_path_used" = "yes" ; then
mkdir -p extra_lib
mkdir -p extra_lib/lib
mkdir -p extra_lib/lib/gcc
#fi
#OK check for all local & systems lib
local_inc=$source_path/extra_lib/include
local_lib=$source_path/extra_lib/lib/gcc
dolog() {
rv=$?
if [ $rv -eq 0 ] ; then
return 0;
fi
echo "*** CC/CXX Test Failed (args $@) : ">>$logs
echo "">>$logs
cat $TMPL >> $logs
echo "">>$logs
echo "Source was: ">>$logs
cat $TMPC >> $logs
echo "">>$logs
echo "">>$logs
return 1;
}
docc() {
$cc -o $TMPO $TMPC $@ 0>/dev/null 2>$TMPL
dolog $@
}
docxx() {
$cc -o $TMPO $TMPC $@ 0>/dev/null 2>$TMPL
dolog $@
}
#check GCC flags support
cat > $TMPC << EOF
#include <stdio.h>
int main( void ) { return 0; }
EOF
CFLAGS="$CFLAGS -Wall"
if docc -fno-strict-aliasing ; then
CFLAGS="$CFLAGS -fno-strict-aliasing"
fi
CXXFLAGS="$CFLAGS"
if docc -lz -Wno-pointer-sign ; then
CFLAGS="$CFLAGS -Wno-pointer-sign"
fi
#GCC opt
if test "$no_gcc_opt" = "no"; then
CFLAGS="-O3 $CFLAGS"
else
CFLAGS="-O0 $CFLAGS"
fi
#GCC PIC
if test "$cross_prefix" != "" ; then
want_pic="no"
fi
if test "$want_pic" = "yes" ; then
CFLAGS="$CFLAGS -fPIC -DPIC"
CXXFLAGS="$CXXFLAGS -fPIC -DPIC"
fi
if test "$want_gcov" = "yes" ; then
CFLAGS="$CFLAGS --coverage"
CXXFLAGS="$CXXFLAGS --coverage"
LDFLAGS="$LDFLAGS --coverage"
fi
#force use of cflags with cc
cc_naked=$cc
cxx_naked=$cxx
cc="$cc $CFLAGS"
cxx="$cxx $CXXFLAGS"
#look for zlib
cat > $TMPC << EOF
#include <emmintrin.h>
int main( void ) { return 0; }
EOF
if docc -msse2 $LDFLAGS ; then
CFLAGS="$CFLAGS -msse2"
fi
#look for zlib
cat > $TMPC << EOF
#include <string.h>
#include <stdio.h>
#include <zlib.h>
int main( void ) { if (strcmp(zlibVersion(), ZLIB_VERSION)) { puts("zlib version differs !!!"); return 1; } return 0; }
EOF
has_zlib="no"
if docc -lz $LDFLAGS ; then
has_zlib="system"
fi
if test "$has_zlib" = "no" ; then
if docc -I"$local_inc/zlib" -L$local_lib -lz ; then
has_zlib="local"
fi
fi
#check dlopen
cat > $TMPC << EOF
#include <dlfcn.h>
int main( void ) { dlopen("foo", 0); return 0; }
EOF
if docc ; then
dlopen="yes"
elif docc $LDFLAGS -ldl ; then
GPAC_SH_FLAGS="$GPAC_SH_FLAGS -ldl"
fi
#look for spidermonkey JS support
mozjs_pkgcfg="no"
#spidermonkey test for new API
if test "$has_js" = "no" ; then
cat > $TMPC << EOF
#include <jsapi.h>
int main( void ) { JSContext *cx=NULL; jsval rp; return JS_AddValueRoot(cx, &rp); }
EOF
#try local
js_inc="$local_inc/js"
js_flags="-DXP_UNIX -I$local_inc/js"
if test "$pkg_config" != "no"; then
#try pkg-config
if $pkg_config --exists mozilla-js ; then
mozjs_pkgcfg="mozilla-js"
elif $pkg_config --exists mozjs ; then
mozjs_pkgcfg="mozjs"
elif $pkg_config --exists mozjs185 ; then
mozjs_pkgcfg="mozjs185"
elif docc $js_flags -L$local_lib -ljs -lpthread ; then
has_js="local"
#dc added
fi
if test $mozjs_pkgcfg != "no" ; then
js_flags=`$pkg_config --cflags $mozjs_pkgcfg`
js_lib_pkg=`$pkg_config --libs $mozjs_pkgcfg`
if docc $js_flags $js_lib_pkg $LDFLAGS -lpthread ; then
has_js="system"
js_lib=`$pkg_config --libs $mozjs_pkgcfg`
fi
#try firefox folders (starting at ubuntu 11.10, no pkg-config)
elif ls -d /usr/lib/firefox* > /dev/null 2>>$logs ; then
firefox_version=`cd /usr/lib ; ls -d firefox* | grep -v addons | grep -v devel ; cd - > /dev/null`
for i in $firefox_version ; do
if test "$has_js" = "no" ; then
js_inc="/usr/include/$i"
js_flags="-DXP_UNIX -I$js_inc"
js_lib="-L/usr/lib/$i/ -lxul -lmozsqlite3 -lmozalloc -lnssutil3 -lnss3 -lnspr4 -lsmime3"
if docc $js_flags $js_lib ; then
has_js="$i"
elif docc $js_flags -lnssutil3 $js_lib -lssl3 ; then
#firefox 11 compatibility
has_js="$i"
js_lib="-lnssutil3 $js_lib -lssl3"
fi
fi
done
fi
if test "$has_js" = "no" ; then
#try prefix (DC)
js_inc="$prefix/include/js"
js_flags="-DXP_UNIX -I$prefix/include/js"
if docc $js_flags -L$prefix/lib -ljs -lpthread ; then
has_js="prefix"
#dc added end
else
if docc $js_flags $LDFLAGS -ljs -lpthread ; then
js_inc="/usr/include"
has_js="system"
elif docc -DXP_UNIX -I$alt_macosx_dir/include/js -L$alt_macosx_dir/lib $LDFLAGS -ljs -lpthread 2>>$logs ; then
has_js="system"
js_flags="-DXP_UNIX -I$alt_macosx_dir/include/js"
js_lib="-L$alt_macosx_dir/lib -ljs"
js_inc="$alt_macosx_dir/include/js"
else
#debian spidermonkey (smjs)
js_flags="-DXP_UNIX -I/usr/include/smjs"
js_inc="/usr/include/smjs"
if docc $js_flags $LDFLAGS -lsmjs -lpthread ; then
has_js="system"
js_lib="-lsmjs"
else
#debian spidermonkey (mozjs)
js_flags="-DXP_UNIX -I/usr/include/mozjs"
js_inc="/usr/include/mozjs"
if docc $js_flags $LDFLAGS -lmozjs -lpthread ; then
has_js="system"
js_lib="-lmozjs"
fi
fi
fi
fi
fi
fi
fi
new_js_api="no"
if test "$has_js" != "no" ; then
js_flags="-DSPIDERMONKEY_NEW_API $js_flags"
new_js_api="yes"
fi
#spidermonkey test for regular API
if test "$has_js" = "no" ; then
cat > $TMPC << EOF
#include <jsapi.h>
int main( void ) { return 0; }
EOF
#try local
js_inc="$local_inc/js"
js_flags="-DXP_UNIX -I$local_inc/js"
if test "$cpu" = "sh4" ; then
lm_lib="-lm"
fi
if docc $js_flags $lm_lib -L$local_lib -ljs ; then
has_js="local"
#dc added
else
#try prefix (DC)
js_inc="$prefix/include/js"
js_flags="-DXP_UNIX -I$prefix/include/js"
if docc $js_flags -L$prefix/lib -ljs ; then
has_js="prefix"
#dc added end
elif test "$pkg_config" != "no"; then
if $pkg_config --exists mozilla-js ; then
mozjs_pkgcfg="mozilla-js"
elif $pkg_config --exists mozjs ; then
mozjs_pkgcfg="mozjs"
elif $pkg_config --exists mozjs185 ; then
mozjs_pkgcfg="mozjs185"
fi
if test $mozjs_pkgcfg != "no" ; then
js_flags=`$pkg_config --cflags $mozjs_pkgcfg`
js_lib_pkg=`$pkg_config --libs $mozjs_pkgcfg`
if docc $js_flags $js_lib_pkg $LDFLAGS -lpthread ; then
has_js="system"
js_lib=`$pkg_config --libs $mozjs_pkgcfg`
fi
fi
fi
if test "$has_js" = "no" ; then
if docc $js_flags $LDFLAGS -ljs ; then
js_inc="/usr/include"
has_js="system"
elif docc -DXP_UNIX -I$alt_macosx_dir/include/js -L$alt_macosx_dir/lib $LDFLAGS -ljs 2>>$logs ; then
has_js="system"
js_flags="-DXP_UNIX -I$alt_macosx_dir/include/js"
js_lib="-L$alt_macosx_dir/lib -ljs"
js_inc="$alt_macosx_dir/include/js"
else
#debian spidermonkey (smjs)
js_flags="-DXP_UNIX -I/usr/include/smjs"
js_inc="/usr/include/smjs"
if docc $js_flags $LDFLAGS -lsmjs ; then
has_js="system"
js_lib="-lsmjs"
else
#debian spidermonkey (mozjs)
js_flags="-DXP_UNIX -I/usr/include/mozjs"
js_inc="/usr/include/mozjs"
if docc $js_flags $LDFLAGS -lmozjs ; then
has_js="system"
js_lib="-lmozjs"
fi
fi
fi
fi
fi
fi
if test "$has_js" != "no" ; then
if test "$linux" = "yes" ; then
if test "$cpu" != "sh4"; then
#WARNING: there is a bug in MOZJS packages, the MOZILLA_1_8_BRANCH macro is not signaled, there is no way of knowing
#if the lib has been compiled with or without the macro. We currently just decide that if the macro is present
#in the header, it was enabled in the build
if test "$new_js_api" = "no" ; then
if grep MOZILLA_1_8_BRANCH $js_inc/jsapi.h > /dev/null 2>>$logs ; then
js_flags="-DMOZILLA_1_8_BRANCH $js_flags"
echo "WARNING: Turning on MOZILLA_1_8_BRANCH SpiderMonkey macro"
echo "If you have troubles with scripts in GPAC, disable this macro and recompile"
fi
else
cat > $TMPC << EOF
#include <jsapi.h>
int main( void ) { JSObject *obj; JS_GetPrivate(obj); return 0; }
EOF
if docc $js_flags $LDFLAGS $js_lib ; then
cat > $TMPC << EOF
#include <jsapi.h>
int main( void ) { jsval vp; JSContext *cx=NULL; JSObject *obj = JS_NewObjectForConstructor(cx, &vp); return 0; }
EOF
if docc $js_flags $LDFLAGS $js_lib ; then
js_flags="-DUSE_FFDEV_12 $js_flags"
elif grep JSMutableHandleValue $js_inc/jsapi.h | grep JSHasInstanceOp > /dev/null 2>>$logs ; then
js_flags="-DUSE_FFDEV_18 $js_flags"
elif grep JSMutableHandleValue $js_inc/jsapi.h > /dev/null 2>>$logs ; then
js_flags="-DUSE_FFDEV_18 $js_flags"
elif ! grep JS_ConstructObject $js_inc/jsapi.h > /dev/null 2>>$logs ; then
js_flags="-DUSE_FFDEV_16 $js_flags"
elif grep JSHandleObject $js_inc/jsapi.h > /dev/null 2>>$logs ; then
js_flags="-DUSE_FFDEV_15 $js_flags"
else
js_flags="-DUSE_FFDEV_14 $js_flags"
fi
fi
fi
fi
fi
fi
if test "$has_js" != "no" ; then
cat > $TMPC << EOF