forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·8476 lines (7907 loc) · 289 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/bash
#
# A (not so) simple configure script.
#
# Authors: Christian Holm Christensen and Fons Rademakers.
#
# To help with debugging the script, some comments are preprended with
# 3 '#' echo and 3 '%' - replace that pattern with echo and 3 '%' to
# get printouts. When done replace the pattern echo and 3 '%' with the
# original pattern of 3 '#' echo and 3 '%'. Emacs command M-C-% does
# this easily.
#
######################################################################
echo "****************************************************************************************************************"
echo "* The classic configure/make method of building ROOT is now DEPRECATED in favor of the CMake one. *"
echo "* Refer to README/INSTALL file for updated instructions or visit the page https://root.cern.ch/building-root *"
echo "****************************************************************************************************************"
#
### echo %%% Some global variables
#
found_lib=no
found_dir=no
found_hdr=no
found_ext=
show_pkglist=no
fail_on_missing=no
noact="no"
nohowto="no"
logfile=config.log
altcc=
altcxx=
altf77=
altld=
altccset=
gcctoolchain=
usercflags=
usercxxflags=
host=
deprecated_options=" \
enable_mathcore \
enable_cern \
enable_editline \
enable_cintex \
enable_reflex \
enable_cxx11 \
"
options=" \
enable_afdsmgrd \
enable_afs \
enable_alien \
enable_alloc \
enable_asimage \
enable_astiff \
enable_bonjour \
enable_builtin_afterimage \
enable_builtin_ftgl \
enable_builtin_freetype \
enable_builtin_gl2ps \
enable_builtin_glew \
enable_builtin_pcre \
enable_builtin_unuran \
enable_builtin_zlib \
enable_builtin_lzma \
enable_builtin_llvm \
enable_cxx14 \
enable_cxxmodules \
enable_libcxx \
enable_castor \
enable_chirp \
enable_cocoa \
enable_davix \
enable_dcache \
enable_explicitlink \
enable_fink \
enable_fftw3 \
enable_fitsio \
enable_gviz \
enable_gdml \
enable_genvector \
enable_geocad \
enable_gfal \
enable_glite \
enable_globus \
enable_gsl_shared \
enable_hdfs \
enable_http \
enable_krb5 \
enable_ldap \
enable_mathmore \
enable_memstat \
enable_minuit2 \
enable_monalisa \
enable_mysql \
enable_odbc \
enable_opengl \
enable_oracle \
enable_pgsql \
enable_pythia6 \
enable_pythia8 \
enable_python \
enable_qt \
enable_qtgsi \
enable_roofit \
enable_r \
enable_ruby \
enable_rfio \
enable_rpath \
enable_search_usrlocal \
enable_sapdb \
enable_shadowpw \
enable_shared \
enable_soversion \
enable_sqlite \
enable_srp \
enable_ssl \
enable_table \
enable_tbb \
enable_tmva \
enable_unuran \
enable_vc \
enable_werror \
enable_winrtdebug \
enable_x11 \
enable_xft \
enable_xml \
enable_xrootd \
"
ENABLEALL="no"
DEFAULTENABLE="yes"
for flag in "$@"; do
case $flag in
--all)
ENABLEALL="yes"
break ;;
--gminimal)
DEFAULTENABLE="no"
MINIMALENABLE="enable_x11"
break ;;
--minimal)
DEFAULTENABLE="no"
MINIMALENABLE=""
break ;;
esac
done
#
# This sets all options to "yes" unless --minimal is specified.
# We turn off those we don't want on per default explictly afterwards.
#
for c in $options $deprecated_options; do
case ${c} in
${MINIMALENABLE}) eval ${c}="yes" ;;
enable_shared) eval ${c}="yes" ;;
*) eval ${c}="${DEFAULTENABLE}" ;;
esac
done
for c in $options ; do eval ${c}_explicit="" ; done
enable_cxx11=yes
enable_cxx14=no
enable_cxxmodules=no
enable_libcxx=no
enable_cocoa=
enable_afs=no
enable_alloc=no
enable_gdml=no
enable_geocad=no
enable_globus=no
enable_explicitlink=no
enable_gsl_shared=no
enable_http=no
enable_qt=no
enable_qtgsi=no
enable_r=no
enable_roofit=no
enable_minuit2=no
enable_rpath=no
enable_ruby=no
enable_shadowpw=
enable_soversion=no
enable_table=no
enable_tbb=no
enable_thread=yes # cannot be disabled (not in above options list)
enable_unuran=no
enable_vc=no
enable_werror=no
enable_winrtdebug=
enable_builtin_freetype=no
enable_builtin_ftgl=no
enable_builtin_gl2ps=no
enable_builtin_glew=no
enable_builtin_pcre=no
enable_builtin_unuran=no
enable_builtin_zlib=no
enable_builtin_lzma=no
enable_builtin_llvm=yes
enable_afdsmgrd=no
enable_search_usrlocal=yes
if test "x$ENABLEALL" = "xyes"; then
enable_gdml=yes
enable_geocad=yes
enable_http=yes
enable_qt=yes
enable_qtgsi=yes
enable_roofit=yes
enable_minuit2=yes
#enable_ruby=yes #not supported in ROOT v6.0.0 yet
enable_table=yes
enable_unuran=yes
enable_vc=yes
enable_r=yes
fi
# Remove old log file
rm -f $logfile
#
# ./configure arguments and defaults set via supported env vars
#
envvars="
THREAD \
ZLIB \
LIBTIFF \
LIBJPEG \
LIBPNG \
LZMA \
OPENGL \
MYSQL \
ORACLE \
PGSQL \
SQLITE \
QTDIR \
SAPDB \
RFIO \
CASTOR \
GFAL \
GSL \
HDFS \
PYTHIA6 \
PYTHIA8 \
FFTW3 \
CFITSIO \
GVIZ \
PYTHONDIR \
DCACHE \
CHIRP \
DNSSD \
AVAHI \
ALIEN \
ASIMAGE \
LDAP \
GLOBUS_LOCATION \
GLITE \
MEMSTAT \
MONALISA \
SRP \
SSL \
AFS \
ROOFIT \
MINUIT2 \
TABLE \
XMLDIR \
CASROOT \
VC \
DAVIX \
TBB \
"
configenvvars=
for c in $envvars ; do
cc=`eval echo "$"$c | sed 's,\\\,\\\\\\\,g'`
if test ! "x$cc" = "x" ; then
if test ! "x$configenvvars" = "x" ; then
configenvvars="$configenvvars $c=$cc"
else
configenvvars="$c=$cc"
fi
fi
done
configargs="$*"
# don't write --nohowto to config.h
configargs=`echo $configargs | sed 's, *--nohowto,,g'`
configoptions=
if test ! "x$configenvvars" = "x" ; then
configoptions=$configenvvars
fi
if test ! "x$configargs" = "x" ; then
if test ! "x$configoptions" = "x" ; then
configoptions="$configoptions $configargs"
else
configoptions=$configargs
fi
fi
configoptions=`echo $configoptions | sed 's,\\\,\\\\\\\,g'`
######################################################################
#
### echo %%% Some common functions
#
#_____________________________________________________________________
message() {
# Write a simple message to std out
if test $# -lt 1 ; then
echo "message: Too few arguments"
return 1
fi
echo $ac_n "$* ... $ac_c"
logmsg "$*"
}
#_____________________________________________________________________
logmsg() {
# Write a simple message to std out
if test $# -lt 1 ; then
echo "logmsg: Too few arguments"
return 1
fi
if test "x$1" = "x-n"; then
shift
echo -n "$*" >> $logfile
else
echo "$*" >> $logfile
fi
}
#_____________________________________________________________________
result() {
echo "$*"
logmsg "Result: $*"
}
#_____________________________________________________________________
checking_msg() {
# Write a simple "checking" message to std out.
if test $# -lt 1 ; then
echo "checking_msg: Too few arguments"
return 1
fi
echo $ac_n "Checking for$ac_c"
logmsg $ac_n "Checking for$ac_c"
while test $# -gt 1 ; do
echo $ac_n " $1,$ac_c"
logmsg $ac_n " $1,$ac_c"
shift
if test $# -eq 1 ; then
echo $ac_n " or$ac_c"
logmsg $ac_n " or$ac_c"
fi
done
echo $ac_n " $1 ... $ac_c"
logmsg " $1 ... "
}
#_____________________________________________________________________
check_libpic() {
# This function will try to find out if an archive library [$1]
# contains relocatable code. Currently works only for linux.
# The result of the check is stored in is_libpic, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
is_libpic=1
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "check_libpic: not 1 argument"
return 1
fi
case $platform in
linux) ;;
*) return 0;
;;
esac
# Save arguments in logical names
chklibpic=$1
if [ "x`basename $chklibpic .a`" != "x`basename $chklibpic`" ]; then
# we have an archive .a file
logmsg "Checking if $chklibpic contains relocatable code"
logmsg " objdump -r $chklibpic | grep -v ' .debug_' | grep 'R_X86_64_32'"
objdump -r $chklibpic | grep -v ' .debug_' | grep 'R_X86_64_32' > /dev/null 2>& 1
ret=$?
logmsg " result: $ret"
if test $ret -eq 0 ; then
is_libpic=0
logmsg " is not a relocatable library"
fi
fi
}
#_____________________________________________________________________
check_libcompat() {
# This function will try to find out if a library [$1] contains
# compatible 64 bit or 32 bit code matching the selected architecture.
# Currently only MacOS X supports universal libs.
# The result of the check is stored in is_libcompat, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
is_libcompat=0
is_libnotcompat=0
ret=0
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "check_libcompat: not 1 argument"
return 1
fi
# Save arguments in logical names
chklibcompat=$1
logmsg "Checking if $chklibcompat contains compatible code"
case $arch in
macosx)
case $chklibcompat in
*.tbd)
ret=1
;;
*)
logmsg " lipo $chklibcompat -verify_arch i386"
if lipo $chklibcompat -verify_arch i386 ; then
ret=1
fi
;;
esac
;;
macosx64|macosxicc)
case $chklibcompat in
*.tbd)
ret=1
;;
*)
logmsg " lipo $chklibcompat -verify_arch x86_64"
if lipo $chklibcompat -verify_arch x86_64 ; then
ret=1
fi
;;
esac
;;
esac
logmsg " result: $ret"
if test $ret -eq 1 ; then
is_libcompat=1
logmsg " is a compatible library"
else
is_libnotcompat=1
logmsg " is a not-compatible library"
fi
}
#_____________________________________________________________________
check_libcxxcompat() {
# This function will try to find out if a library [$1] is linked
# against a compatible C++ run-time library (either libstdc++ or libc++).
# Currently only MacOS X and Linux support libc++ and libstdc++.
# The result of the check is stored in is_libcxxcompat, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
# To skip this check, in case std types are not used in the public
# API of the library, set skipchecklibcxxcompat="yes".
is_libcxxcompat=1
ret=0
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "check_libcxxcompat: not 1 argument"
return 1
fi
# Can we skip the check in case library has no std C++ in public API
if test "x$skipchecklibcxxcompat" = "xyes"; then
skipchecklibcxxcompat=""
logmsg "check_libcxxcompat: skipping check for $1"
return
fi
# Save arguments in logical names
chklibcxxcompat=$1
logmsg "Checking if $chklibcxxcompat is linked against compatible C++ run-time"
if test "x$enable_libcxx" = "xyes"; then
case $arch in
macosx*)
logmsg " otool -L $chklibcxxcompat | grep libstdc++"
if otool -L $chklibcxxcompat | grep 'libstdc++' > /dev/null 2>& 1 ; then
ret=1
fi
;;
linux*)
logmsg " ldd $chklibcxxcompat | grep libstdc++"
if ldd $chklibcxxcompat | grep 'libstdc++' > /dev/null 2>& 1 ; then
ret=1
fi
;;
esac
else
case $arch in
macosx*)
logmsg " otool -L $chklibcxxcompat | grep libc++"
if otool -L $chklibcxxcompat | grep 'libc++' > /dev/null 2>& 1 ; then
ret=1
fi
;;
linux*)
logmsg " ldd $chklibcxxcompat | grep libc++"
if ldd $chklibcxxcompat | grep 'libc++' > /dev/null 2>& 1 ; then
ret=1
fi
;;
esac
fi
logmsg " result: $ret"
if test $ret -eq 1 ; then
is_libcxxcompat=0
logmsg " is linked against not-compatible C++ run-time library"
else
logmsg " is linked against compatible C++ run-time library"
fi
}
#_____________________________________________________________________
check_lib64() {
# This function will try to find out if a library [$1] contains 64 bit
# or 32 bit code. Currently works only for linux and solaris.
# The result of the check is stored in is_lib64, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
is_lib64=0
ret=0
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "check_lib64: not 1 argument"
return 1
fi
filearg=
case $platform in
linux) filearg="-L" ;;
solaris) ;;
*) return 1;;
esac
# Save arguments in logical names
chklib64=$1
logmsg "Checking if $chklib64 is a 64-bit library"
if [ "x`basename $chklib64 .a`" != "x`basename $chklib64`" ]; then
# we have an archive .a file
if [ "x$platform" = "xlinux" ]; then
logmsg " objdump -a $chklib64 | grep 'x86-64'"
if objdump -a $chklib64 | grep 'x86-64' > /dev/null 2>& 1 ; then
ret=1
fi
fi
if [ "x$platform" = "xsolaris" ]; then
chklib64file=`ar t $chklib64 | awk '{if (NR == 2) print $1}'`
logmsg " ar x $chklib64 $chklib64file"
ar x $chklib64 $chklib64file
logmsg " file $filearg $chklib64file | grep '64-bit'"
if file $filearg $chklib64file | grep '64-bit' > /dev/null 2>& 1 ; then
ret=1
fi
rm -f $chklib64file
fi
else
if file $filearg $chklib64 | grep 'ASCII' > /dev/null 2>& 1 ; then
check_link $chklib64
ret=$link_result
else
logmsg " file $filearg $chklib64 | grep '64-bit'"
if file $filearg $chklib64 | grep '64-bit' > /dev/null 2>& 1 ; then
ret=1
fi
fi
fi
logmsg " result: $ret"
if test $ret -eq 1 ; then
is_lib64=1
logmsg " is a 64bit library"
fi
}
#_____________________________________________________________________
check_library() {
# This function will try to locate a library [$1] in the specific
# directory [$3] or in a default path [$*]. If the second argument
# [$2] is not "no" or "staticonly", then shared libraries are favoured.
# The result of the search is stored in found_lib and found_dir,
# which should be immediately copied, since the variables value will
# be overwritten at next invocation of this function.
# Assert that we got enough arguments
if test $# -lt 4 ; then
echo "check_library: Too few arguments"
return 1
fi
# Save arguments in local names
lib=$1 ; shift
shared=$1 ; shift
libdirl=$1 ; shift
libdirs="$*"
if test ! "x$iossdk" = "x" ; then
sdklibs=""
for i in $libdirs; do
#if test $i = "/usr/lib"; then
sdklibs="$sdklibs ${iossdk}${i}"
#else
# sdklibs="$sdklibs $i"
#fi
done
libdirs="$sdklibs"
fi
if test "x$enable_search_usrlocal" = "xno" ; then
no_usrlocal=""
for i in $libdirs; do
if [[ $i != /usr/local/* ]] ; then
no_usrlocal="$no_usrlocal $i"
fi
done
libdirs="$no_usrlocal"
fi
# Write a message
checking_msg $lib
# check if we got a specific argument as to where the library
# is to be found
if test ! "x$libdirl" = "x" ; then
libdirs=$libdirl
fi
found_lib=no
found_dir=no
found_ext=
# Make list of libraries to search for. The .lib extension is for
# Windoze - note $shared is always "no" on windoze, since we need
# the .lib export library to link.
libs=""
for i in $lib ; do
for ext in .a .lib "" ; do # lib without extension for MacOS X
libs="$libs $i$ext"
done
done
slibs=""
for i in $lib ; do
for ext in .so .sl .tbd .dylib .dll.a ; do # .dll.a for cygwin gcc
slibs="$slibs $i$ext"
done
done
if test "x$shared" = "xno" ; then
libs="$libs $slibs"
elif test "x$shared" = "xstaticonly" ; then
libs="$libs"
else
libs="$slibs $libs"
fi
logmsg "libraries to check for: $libs"
# Loop over the list of possible directories, and see if we can
# find any of the library files as determind above.
for i in $libdirs ; do
# look first in the lib32 directories
if test "x$checklib32" = "xyes" ; then
i32=`echo $i | sed -e 's|lib$|lib32|' -e 's|lib/|lib32/|'`
i="$i32 $i"
#i="$i32"
fi
# look first in the lib64 directories
if test "x$checklinux64" = "xyes" ; then
i64=`echo $i | sed -e 's|lib$|lib64|' -e 's|lib/|lib64/|'`
i="$i64 $i"
fi
# look first in the DEB_HOST_MULTIARCH directories
if test "x$debmultiarch" != "x" ; then
i64=`echo $i | sed "s|\(lib\)$|\1/$debmultiarch|"`
i="$i64 $i"
fi
# look only in the lib64 directories
if test "x$checkonlylib64" = "xyes" ; then
i64=`echo $i | sed -e 's|lib$|lib64|' -e 's|lib/|lib64/|'`
i="$i64"
fi
# look only in the hpux64 directories
if test "x$checkhpux64" = "xyes" ; then
i64=`echo $i | sed 's|\(lib\)|\1/hpux64|'`
i="$i64"
fi
# look first in the amd64 directories
if test "x$checksolaris64" = "xyes" ; then
i64=`echo $i | sed 's|\(lib\)|\1/amd64|'`
i="$i64 $i"
fi
logmsg " Checking in directories $i for $libs"
for l in $i ; do
l=`echo $l | sed 's,^//,/,'`
if test ! -d $l ; then
continue
fi
for j in ${libs} ; do
logmsg " Checking for library $j in directory $l"
# if we found the file (it's readable by user), we set the
# logical variables and are on our way, otherwise we continue
liblist=`echo $l/$j` # expands wildcard in $l/$j
for n in ${liblist} ; do
logmsg " Checking $n"
if test -f $n ; then
logmsg " Found file $n"
if test "x$checklib64" = "xyes" ; then
check_lib64 $n
if test $is_lib64 -eq 1 ; then
found_dir=$l
found_lib=$j
break 4
fi
else
if test "x$checklibcompat" = "xyes" ; then
check_libcompat $n
if test $is_libcompat -eq 0 ; then
break 4
fi
fi
if test "x$checklibcxxcompat" = "xyes" ; then
check_libcxxcompat $n
if test $is_libcxxcompat -eq 0 ; then
break 4
fi
fi
found_dir=$l
found_lib=$j
if test "x$arch" = "xlinux"; then
check_lib64 $n
else
is_lib64=0
fi
if test $is_lib64 -eq 1 ; then
found_dir=no
found_lib=no
else
# skip cygwin libraries when in pure Win32 mode
if test "x$platform" = "xwin32"; then
case $found_dir in
/lib|/lib/*|/usr/*) found_dir=no ;;
*) break 4;;
esac
else
break 4
fi
fi
fi
else
logmsg " $j not found in $l"
fi
done
done
done
done
echo $found_dir
unset libs
unset libdirs
if test "x$found_dir" = "xno" || test "x$found_lib" = "xno" ; then
found_dir=""
found_lib=""
found_raw_lib=""
logmsg " library not found"
else
found_ext=`echo $found_lib | sed 's|^lib\(.*\)\.\(.*\)|\2|'`
flib=""
maclib=""
for i in $lib ; do
for ext in .a .lib "" ; do # lib without extension for MacOS X
if test "x$found_lib" = "x$i$ext" ; then
flib=$i$ext
if test "x$ext" = "x" ; then
maclib="yes"
fi
break 2
fi
done
done
if (test "x$found_lib" = "x$flib" && test "x$shared" = "xno") || \
test "x$maclib" = "xyes" ; then
found_raw_lib=${found_lib}
found_lib=${found_dir}/${found_lib}
found_raw_dir=${found_dir}
found_dir=""
else
found_raw_lib=${found_lib}
if test ! "x$shared" = "xstaticonly" ; then
found_lib=`echo $found_lib | sed 's|^lib\(.*\)\..*|-l\1|'`
fi
found_raw_dir=${found_dir}
if test ! "x$shared" = "xstaticonly" ; then
found_dir=-L${found_dir}
fi
# Avoid inclusion of /usr/lib, which is always included anyway
if test "x$found_dir" = "x-L/usr/lib" || \
test "x$found_dir" = "x-L/usr/lib32" || \
test "x$found_dir" = "x-L/usr/lib64" ; then
found_dir=""
fi
if test "x$debmultiarch" != "x" ; then
if test "x$found_dir" = "x-L/usr/lib/$debmultiarch" ; then
found_dir=""
fi
fi
if test "x$checksolaris64" = "xyes" ; then
if test "x$found_dir" = "x-L/usr/lib/amd64" || \
test "x$found_dir" = "x-L/usr/lib/64" ; then
found_dir=""
fi
fi
if test "x$checkhpux64" = "xyes" ; then
if test "x$found_dir" = "x-L/usr/lib/hpux64" ; then
found_dir=""
fi
fi
fi
# Correct path for win32
if test "x$platform" = "xwin32"; then
if test ! "x$found_lib" = "x" ; then
found_lib=`cygpath -m $found_lib`
fi
if test ! "x$found_dir" = "x" ; then
found_dir=`cygpath -m $found_dir`
fi
fi
fi
unset shared
unset slibs
unset lib
unset flib
unset maclib
unset libdirl
}
#_____________________________________________________________________
check_header() {
# This function will try to locate a header [$1] in the specific
# directory [$2] or in a default path [$*].
# The result of the search is stored in found_hdr and found_dir,
# which should be immediately copied, since the variables value will
# be overwritten at next invocation of this function.
# Assert that we got enough arguments
if test $# -lt 3 ; then
echo "check_header: Too few arguments"
return 1
fi
# Save arguments in logical names
hdrs=$1 ; shift
hdrdir=$1 ; shift
hdrdirs="$*"
if test ! "x$iossdk" = "x" ; then
sdkhdrs=""
for i in $hdrdirs; do
#if test $i = "/usr/include"; then
sdkhdrs="$sdkhdrs ${iossdk}${i}"
#else
# sdkhdrs="$sdkhdrs $i"
#fi
done
hdrdirs="$sdkhdrs"
fi
if test "x$enable_search_usrlocal" = "xno" ; then
no_usrlocal=""
for i in $hdrdirs; do
if [[ $i != /usr/local/* ]] ; then
no_usrlocal="$no_usrlocal $i"
fi
done
hdrdirs="$no_usrlocal"
fi
# Write a message
checking_msg $hdrs
# Check if we got a specific argument as to where the library
# is to be found
if test ! "x$hdrdir" = "x" ; then
hdrdirs=$hdrdir
fi
found_hdr=no
found_dir=no
# Loop over the list of possible directories, and see if we can
# find any of the library files as determind above.
for i in $hdrdirs; do
logmsg " Checking in directory $i"
for j in ${hdrs} ; do
logmsg " Checking for $j in directory $i"
# if we found the file (it's readable by user), we set the
# logical variables and are on our way, otherwise we continue
if test -r $i/$j ; then
logmsg " $i/$j is read-able"
found_dir=$i
found_hdr=$j
# skip cygwin headers when in pure Win32 mode
if test "x$platform" = "xwin32"; then
case $found_dir in
/usr/*) found_dir="no" ;;
*) break 2;;
esac
else
break 2
fi
fi
done
done
echo $found_dir
if test "x$found_hdr" = "xno" || test "x$found_dir" = "xno" ; then
found_hdr=""
found_dir=""
fi
# Avoid inclusion of /usr/include, which is always included anyway
#if test "x$found_dir" = "x/usr/include" ; then
# found_dir="include"
#fi
# Correct path for win32
if test "x$platform" = "xwin32"; then
if test ! "x$found_hdr" = "x" ; then
found_hdr=`cygpath -m $found_hdr`
fi
if test ! "x$found_dir" = "x" ; then
found_dir=`cygpath -m $found_dir`
fi
fi
unset hdrs
unset hdrdirs
unset hdrdir
}
#_____________________________________________________________________
check_code() {
# This function compiles a source file containing code from $1
# with extra CXXFLAGS $2 (can be empty), e.g. to pass -I.
# The result of the check is stored in include_result, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
# Assert that we got enough arguments
if test $# -lt 1 ; then
echo "check_include: Too few arguments"
return 1
fi
logmsg " Compiling $1 with flags '$2'"
echo "$1" > conftest.cxx
cat <<EOF > conftest.mk
include ${ac_srcdir}/config/Makefile.${arch}
CXX = ${altcxx}
conftest.o: conftest.cxx
\$(CXX) $2 -c \$^ -o \$@
EOF
$gnumake -f conftest.mk >> $logfile 2>&1
if test $? -eq 0 ; then
logmsg " supported"
include_result=1
else
logmsg " not supported"
include_result=0
fi
rm -f conftest.mk conftest.o conftest.cxx conftest.d
}
#_____________________________________________________________________
check_link() {
# This function will try to link a specific library [$1] in an
# optional directory [$2] and test, optionally, for a specified
# symbol [$3].
# The result of the check is stored in link_result, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.