-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·3267 lines (2872 loc) · 94.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-2012 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"
#default parameters
DESTDIR=""
prefix="/usr/local"
mandir=""
cross_prefix=""
targetos=""
dxsdk_path=""
moz_path="local"
cc_orig="gcc"
cxx_orig="g++"
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"
use_std_alloc="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"
has_joystick="no"
has_xul="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_mcrypt="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"
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"
#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
--enable-debug produce debug version
--enable-gprof enable profiling
--enable-pic enable Position Independant Code for shared objects
--strip enable strip
--std-allocator uses standard lib memory allocator
--static-modules uses static modules whenever possible
--track-memory 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-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 GPAC static build
--static-mp4box configure for static linking of MP4Box.
--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-mcrypt disable mcrypt
--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
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 "\ncross-prefix detected: $cross_prefix"
;;
--target-os=*) targetos=`echo $opt | cut -d '=' -f 2` && echo "\ntarget-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-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";
;;
--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
#if test "$win32" = "yes" ; then
# cross_prefix=""
#fi
#if test "$mingw32" = "yes" ; then
# cross_prefix=""
#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>&1 ; 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"
else
source_path="`cd \"$source_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>&1 | 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>/dev/null && $($readelf -h $TMPO | grep "Class:.*ELF64$" >/dev/null 2>&1)
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
if test -d /sw/bin ; then
alt_macosx_dir="/sw"
CFLAGS_DIR="-I/sw/include"
LDFLAGS="-L/sw/lib $LDFLAGS"
elif test -d /opt/local/bin ; then
alt_macosx_dir="/opt/local"
CFLAGS_DIR="-I/opt/local/include"
LDFLAGS="-L/opt/local/lib $LDFLAGS"
fi
cc="cc"
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>&1 | 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*)
js_flags="-DXP_PC -D_declspec=__declspec"
mingw32="yes"
win32="yes"
extralibs="$extralibs -lws2_32 -lwinmm"
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
if test "$cross_prefix" != "" ; then
GPAC_SH_FLAGS=""
fi
;;
CYGWIN*)
js_flags=-DXP_PC
extralibs="$extralibs -lws2_32 -lwinmm"
cygwin="yes"
win32="yes"
;;
Linux)
js_flags="-DXP_UNIX -I/usr/include/js"
LDFLAGS="$LDFLAGS -Wl,--warn-common -Wl,-z,defs"
#OSS_LDFLAGS="-laoss"
linux="yes"
case "$cpu" in
sh4)
CFLAGS="$CFLAGS -isystem \"$prefix/include\""
#LDFLAGS="$LDFLAGS -L$prefix/lib"
;;
esac
;;
*) ;;
esac
#defines directory for binaries and libs (ex. for TinyGL)
target_bin_dir=""
if test "$cross_prefix" = "" ; then
target_bin_dir=`${cc} -v 2>&1 | 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=extra_lib/lib/gcc
#check GCC flags support
cat > $TMPC << EOF
#include <stdio.h>
int main( void ) { return 0; }
EOF
CFLAGS="$CFLAGS -Wall"
if $cc -o $TMPO $TMPC -fno-strict-aliasing 2> /dev/null ; then
CFLAGS="$CFLAGS -fno-strict-aliasing"
fi
CXXFLAGS="$CFLAGS"
if $cc -o $TMPO $TMPC -lz -Wno-pointer-sign 2> /dev/null ; 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
#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 ) { }
EOF
if $cc -o $TMPO $TMPC -msse2 $LDFLAGS 2> /dev/null ; then
CFLAGS="$CFLAGS -msse2"
fi
#look for zlib
cat > $TMPC << EOF
#include <zlib.h>
int main( void ) { if (strcmp(zlibVersion(), ZLIB_VERSION)) { puts("zlib version differs !!!"); return 1; } return 0; }
EOF
has_zlib="no"
#if test "$cross_prefix" = "" ; then
if $cc -o $TMPO $TMPC -lz $LDFLAGS 2> /dev/null ; then
has_zlib="system"
fi
#fi
if test "$has_zlib" = "no" ; then
if $cc -o $TMPO $TMPC -I"$local_inc/zlib" -L$local_lib -lz 2> /dev/null ; then
has_zlib="local"
fi
fi
#check dlopen
cat > $TMPC << EOF
#include <dlfcn.h>
int main( void ) { return (int) dlopen("foo", 0); }
EOF
if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
dlopen="yes"
elif $cc -o $TMPE $TMPC $LDFLAGS -ldl > /dev/null 2>&1 ; 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; jsval *rp; return JS_AddValueRoot(cx, rp); }
EOF
#try local
js_inc="$local_inc/js"
js_flags="-DXP_UNIX -I$local_inc/js"
if $cc -o $TMPO $TMPC $js_flags -L$local_lib -ljs -lpthread 2> /dev/null ; then
has_js="local"
#dc added
elif test "$pkg_config" != "no"; then
#try pkg-config
if $pkg_config --exists mozilla-js 2> /dev/null ; then
mozjs_pkgcfg="mozilla-js"
elif $pkg_config --exists mozjs 2> /dev/null ; then
mozjs_pkgcfg="mozjs"
elif $pkg_config --exists mozjs185 2> /dev/null ; 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 $cc -o $TMPO $TMPC $js_flags $js_lib_pkg $LDFLAGS -lpthread 2> /dev/null ; 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>&1 ; 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 $cc -o $TMPO $TMPC $js_flags $js_lib 2> /dev/null ; then
has_js="$i"
elif $cc -o $TMPO $TMPC $js_flags -lnssutil3 $js_lib -lssl3 2> /dev/null ; 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 $cc -o $TMPO $TMPC $js_flags -L$prefix/lib -ljs -lpthread 2> /dev/null ; then
has_js="prefix"
#dc added end
else
if $cc -o $TMPO $TMPC $js_flags $LDFLAGS -ljs -lpthread 2> /dev/null ; then
js_inc="/usr/include"
has_js="system"
elif $cc -o $TMPO $TMPC -DXP_UNIX -I$alt_macosx_dir/include/js -L$alt_macosx_dir/lib $LDFLAGS -ljs -lpthread 2> /dev/null ; 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 $cc -o $TMPO $TMPC $js_flags $LDFLAGS -lsmjs -lpthread 2> /dev/null ; 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 $cc -o $TMPO $TMPC $js_flags $LDFLAGS -lmozjs -lpthread 2> /dev/null ; 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 $cc -o $TMPO $TMPC $js_flags $lm_lib -L$local_lib -ljs 2> /dev/null ; then
has_js="local"
#dc added
else
#try prefix (DC)
js_inc="$prefix/include/js"
js_flags="-DXP_UNIX -I$prefix/include/js"
if $cc -o $TMPO $TMPC $js_flags -L$prefix/lib -ljs 2> /dev/null ; then
has_js="prefix"
#dc added end
elif test "$pkg_config" != "no"; then
if $pkg_config --exists mozilla-js 2> /dev/null ; then
mozjs_pkgcfg="mozilla-js"
elif $pkg_config --exists mozjs 2> /dev/null ; then
mozjs_pkgcfg="mozjs"
elif $pkg_config --exists mozjs185 2> /dev/null ; 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 $cc -o $TMPO $TMPC $js_flags $js_lib_pkg $LDFLAGS -lpthread 2> /dev/null ; then
has_js="system"
js_lib=`$pkg_config --libs $mozjs_pkgcfg`
fi
fi
fi
if test "$has_js" = "no" ; then
if $cc -o $TMPO $TMPC $js_flags $LDFLAGS -ljs 2> /dev/null ; then
js_inc="/usr/include"
has_js="system"
elif $cc -o $TMPO $TMPC -DXP_UNIX -I$alt_macosx_dir/include/js -L$alt_macosx_dir/lib $LDFLAGS -ljs 2> /dev/null ; 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 $cc -o $TMPO $TMPC $js_flags $LDFLAGS -lsmjs 2> /dev/null ; 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 $cc -o $TMPO $TMPC $js_flags $LDFLAGS -lmozjs 2> /dev/null ; 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>&1 ; 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); }
EOF
if $cc -o $TMPO $TMPC $js_flags $LDFLAGS $js_lib 2> /dev/null ; then
cat > $TMPC << EOF
#include <jsapi.h>
int main( void ) { jsval *vp; JSObject *obj = JS_NewObjectForConstructor(c, vp); }
EOF
if $cc -o $TMPO $TMPC $js_flags $LDFLAGS $js_lib 2> /dev/null ; then
js_flags="-DUSE_FFDEV_12 $js_flags"
elif grep JSMutableHandleValue $js_inc/jsapi.h | grep JSHasInstanceOp > /dev/null 2>&1 ; then
js_flags="-DUSE_FFDEV_18 $js_flags"
elif grep JSMutableHandleValue $js_inc/jsapi.h > /dev/null 2>&1 ; then
js_flags="-DUSE_FFDEV_18 $js_flags"
elif ! grep JS_ConstructObject $js_inc/jsapi.h > /dev/null 2>&1 ; then
js_flags="-DUSE_FFDEV_16 $js_flags"
elif grep JSHandleObject $js_inc/jsapi.h > /dev/null 2>&1 ; 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
cat > $TMPC << EOF
#include <jsapi.h>
int main( void ) { JSContext *cx; JS_SetRuntimeThread(cx); }
EOF
if $cc -o $TMPO $TMPC $js_flags $LDFLAGS $js_lib 2> /dev/null ; then
js_flags="$js_flags"
else
js_flags="-DNO_JS_RUNTIMETHREAD $js_flags"
fi
fi
#end JS test
#look for platinum support
cat > $TMPC << EOF
#include <Platinum.h>
int main( void ) { return 0; }
EOF
if $cxx -o $TMPO $TMPC -I$local_inc/platinum $LDFLAGS -L$local_lib -lPlatinum -lPltMediaServer -lPltMediaConnect -lPltMediaRenderer -lNeptune -lZlib -lpthread 2> /dev/null ; then
has_platinum="yes"
fi
#look for avcap support
avcap_cflags=""
avcap_ldflags="-lavcap"
cat > $TMPC << EOF
#include <avcap/avcap.h>
using namespace avcap;
int main( void ) {
const DeviceCollector::DeviceList& dl = DEVICE_COLLECTOR::instance().getDeviceList();
DeviceDescriptor* dd = 0;
for (DeviceCollector::DeviceList::const_iterator i = dl.begin(); i != dl.end(); i++) {
dd = *i;
std::cout << dd->getName().c_str() << "\n";
}
return 0;
}
EOF
if $cxx -o $TMPO $TMPC $LDFLAGS $avcap_cflags $avcap_ldflags 2> /dev/null ; then
has_avcap="yes"
else
if test "$darwin" = "yes" ; then
avcap_cflags="-I$local_inc -I$local_inc/avcap/osx"
avcap_ldflags="${wl}-flat_namespace -lavcap -lpthread -framework QuickTime -framework QuartzCore"
else
avcap_cflags="-I$local_inc -I$local_inc/avcap/linux"
avcap_ldflags="-lavcap -lpthread"
fi
if $cxx -o $TMPO $TMPC $avcap_cflags $LDFLAGS -L$local_lib $avcap_ldflags 2> /dev/null ; then
has_avcap="yes"
avcap_ldflags="-L../../$local_lib $avcap_ldflags"
fi
fi
#look for opensvc support
if test "$darwin" = "yes" ; then
osvc_cflags="-I/usr/include -I/usr/local/include"
osvc_ldflags="-L/usr/lib -L/usr/local/lib -lOpenSVCDec"
else
osvc_cflags=""
osvc_ldflags="-lOpenSVCDec"
fi
cat > $TMPC << EOF
#include <OpenSVCDecoder/SVCDecoder_ietr_api.h>
int main( void ) { return 0; }
EOF