-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
configure
executable file
·770 lines (727 loc) · 21.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
#!/bin/sh
# This script was automatically generated by ACR v2.1.2
# @author: pancake <nopcode.org>
# @url: http://www.nopcode.org
# @repo: git clone https://github.com/radare/acr
[ -z "${AWK}" ] && AWK=awk
do_remove() {
if [ "${ACR_RMFILES}" ]; then
printf "cleaning temporally files... "
rm -f ${ACR_RMFILES}
echo "done"
fi
}
control_c() {
printf "\n\n^C control-c : script execution interrupted.\n"
do_remove
exit 1
}
trap control_c 2
HAVE_RUBY=0
READLINE=1
USBSNF=1
NONFREE=1
DEBUGGER=1
JAVA=0
WII=0
W32=0
SYSPROXY=0
VALA=1
WANT_EWF=1
HAVE_PERL=0
HAVE_PYTHON=0
MAEMO=0
HAVE_GUI=1
split_host() {
S="$"
while : ; do
ENVWORDS="${ENVWORDS} $1_CPU $1_OS"
STR=`eval "echo ${S}$1"`
SPLIT_CPU="`echo "$STR" | cut -d - -f 1`"
SPLIT_OS="`echo "$STR" | $AWK -F - '{
if ($2=="unknown"){
if (NF<3) { print $2; } else { print $3; }
} else {
if ($2=="linux") { print $2; } else
if (NF<3) { print $2; } else { print $3; }
}
}'`"
eval "$1_CPU=\"$SPLIT_CPU\""
eval "$1_OS=\"$SPLIT_OS\""
shift
[ -z "$1" ] && break
done
}
QUIET=0
be_quiet() {
QUIET=1
}
VPATH=`dirname ${0}`
if [ "${VPATH}" = "." ]; then
WODIS=current
else
if [ "${VPATH}" = "${PWD}" ]; then
VPATH=.
WODIS=current
else
WODIS=crosspath
CURDIR=$PWD
cd $VPATH
VPATH="${PWD}/"
cd $CURDIR
fi
fi
guess_os() {
if [ -e "${VPATH}/config.guess" ]; then
sh ${VPATH}/config.guess
return
fi
CPU="`uname -m|sed -e 's, ,,g'|cut -d - -f 1`"
OS="`uname -s|tr A-Z a-z`"
uname -r | grep -qE "(Microsoft|WSL)" 2>/dev/null && OS="wsl"
GNU="`uname --help 2>&1 | grep gnu`"
[ "${GNU}" ] && OS="${OS}-gnu"
[ "${CPU}" = ppc ] && CPU="powerpc"
echo "${CPU}-unknown-${OS}"
}
SEARCHPATH="/usr /usr/local /usr/pkg /sw"
: ${PREFIX:=/usr/local}
CROSSBUILD=0
BUILD=`guess_os`
HOST="${BUILD}"
TARGET="${HOST}"
ETCDIR="/etc"
SYSCONFDIR=""
DESCRIPTION=""
create_environ() {
: ${EPREFIX:="${PREFIX}"}
: ${SPREFIX:="${PREFIX}"}
: ${BINDIR:="${SPREFIX}/bin"}
: ${SBINDIR:="${PREFIX}/sbin"}
: ${ETCDIR:="${SPREFIX}/etc"}
: ${LIBDIR:="${SPREFIX}/lib"}
: ${PKGCFG_LIBDIR:='${exec_prefix}/lib'}
: ${PKGCFG_INCDIR:='${prefix}/include'}
: ${LIBEXECDIR:="${SPREFIX}/libexec"}
: ${INCLUDEDIR:="${SPREFIX}/include"}
: ${DATADIR:="${SPREFIX}/share"}
: ${INFODIR:="${DATADIR}/info"}
: ${MANDIR:="${DATADIR}/man"}
: ${DOCDIR:="${DATADIR}/doc/radare"}
: ${LOCALSTATEDIR:="${SPREFIX}/var"}
for A in `echo ${PATH} | sed -e 's,:, ,g'` ; do
[ -e "$A"/ginstall ] && : ${INSTALL:="$A"/ginstall} && break
[ -e "$A"/install ] && : ${INSTALL:="$A"/install} && break
done
: ${INSTALL_DIR:=${INSTALL} -d}
: ${INSTALL_DATA:=${INSTALL} -m 644}
: ${INSTALL_SCRIPT:=${INSTALL} -m 755}
: ${INSTALL_PROGRAM:=${INSTALL} -m 755}
: ${INSTALL_PROGRAM_STRIP:=${INSTALL} -m 755 -s}
: ${INSTALL_MAN:=${INSTALL} -m 444}
: ${INSTALL_LIB:=${INSTALL} -m 755 -c}
PKGNAME='radare' ; VERSION='1.5.2' ; VERSION_MAJOR=1; VERSION_MINOR=5; VERSION_PATCH=2; VERSION_NUMBER=10502; CONTACT_MAIL="[email protected]" ; CONTACT_NAME="pancake" ; CONTACT="pancake <[email protected]>" ;
}
show_usage() {
cat <<EOF2
'configure' configures radare-1.5.2 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
-r, --report show what libs/programs require to work
-q, --quiet be quiet, less verbose (see ./configure -qV)
-V, --version display version information and exit
Installation directories:
--exec-prefix=EPREFIX install arch-dependent files in EPREFIX [PREFIX]
--prefix=PREFIX install arch-independent files in PREFIX [/usr/local]
--sandbox=SPREFIX sandbox prefix directory: SPREFIX [PREFIX]
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--docdir=DIR documentation directory [DATADIR/doc/radare]
--includedir=DIR C header files [PREFIX/include]
--infodir=DIR info documentation [DATADIR/info]
--libexecdir=DIR program executables [EPREFIX/libexec]
--libdir=DIR object code libraries [EPREFIX/lib]
--libpath=DIR set rpath/libname-path to linker
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--mandir=DIR man documentation [DATADIR/man]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--etcdir=DIR same as --sysconfdir (/etc)
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
EOF2
printf "
Optional Features:
--with-ruby build with embedded ruby extension
--without-readline disables the readline support
--without-usb-sniffer disables the build of the libusb sniffer
--without-nonfree disables the build of non-free sourcefiles
--without-debugger disables the debugger layer
--with-java builds the java api
--with-wii builds the wii plugin for usbgecko
--enable-w32 enables the build of w32 version using mingw32
--with-sysproxy builds the syscall proxy plugin
--without-vala disables the build of all the vala-dependant parts
--without-ewf disable EWF dependency
--with-perl build with embedded perl extension
--with-python build with embedded python extension
--with-maemo build hildon interface
--without-gui radare without the gtk frontend
"
printf "
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
RUBY Ruby interpreter path or binary name.
LUA path to lua interpreter
"
printf "
Report bugs to: pancake <[email protected]>"
echo ""
exit 0
}
take_environ() {
: ${SH:=/bin/sh}
: ${CPP:=cpp}
: ${CC:=gcc}
: ${CPP:=cpp}
: ${CXX:=c++}
: ${PERL:=perl}
: ${LUA:=lua}
: ${PREFIX:=/usr/local/}
}
ochof() {
[ "$QUIET" = 1 ] && return
printf "$*"
}
ocho() {
[ "$QUIET" = 1 ] && return
echo "$*"
}
show_version() {
if [ "$QUIET" = 1 ]; then
echo "1.5.2"
exit 0
fi
echo "radare-1.5.2 configuration script done with acr v2.1.2.
The 'Free Software Foundation' message is only for autodetection.
Originally written by pancake <nopcode.org>."
exit 0
}
parse_options() {
flag=`echo $1| cut -d = -f 1`
value=`echo $1| $AWK 'BEGIN{FS="=";}{print $2}'`
flag2=`echo $flag|cut -f2- -d -| sed -e 's,-,_,g' -e 's,^_,,g'|tr '[a-z]' '[A-Z]'`
if [ "${TARGET_OS}" = "darwin" ]; then
LIBPATH=-Wl,-install_name,
else
LIBPATH=-Wl,-R
fi
case $flag in
-h|--help|--hel|--h|--he|-help)
show_usage ; ;;
-qV|-quiet-version|--quiet-version)
be_quiet
show_version ; ;;
-q|-quiet|--quiet)
be_quiet ; ;;
-V|-version|--version)
show_version ; ;;
-r|--r|--report)
echo "PKGNAME: radare"
echo "VERSION: 1.5.2"
echo "AUTHOR: pancake"
echo "EMAIL: [email protected]"
echo "LANGS: c c++ ruby perl python lua"
echo "REQUIRED: libdl"
echo "OPTIONAL: libvala-1.0>=0.5.0 libewf libpython2.5 libpython2.6 libpython2.7 liblua liblua5.1"
echo "PKGCONFIG: gtk+-2.0 vte"
echo "FLAGS: --with-ruby --without-readline --without-usb-sniffer --without-nonfree --without-debugger --with-java --with-wii --enable-w32 --with-sysproxy --without-vala --without-ewf --with-perl --with-python --with-maemo --without-gui"
exit 0
;;
--cache-file)
# ignored: acr have no cache
;;
--build)
BUILD="$value"; split_host BUILD ; ;;
--host)
CROSSBUILD=1 # XXX
HOST="$value"; split_host HOST ; ;;
--target)
TARGET="$value"; split_host TARGET ; ;;
--prefix)
PREFIX="$value"; ;;
--exec-prefix)
EPREFIX="$value"; ;;
--sandbox|--sprefix)
SPREFIX="$value"; ;;
--bindir)
BINDIR="$value"; ;;
--sbindir)
SBINDIR="$value"; ;;
--libexecdir)
LIBEXECDIR="$value"; ;;
--docdir)
DOCDIR="$value"; ;;
--datadir)
DATADIR="$value"; ;;
--sysconfdir)
SYSCONFDIR="$value"
ETCDIR="$value"; ;;
--etcdir)
SYSCONFDIR="$value"
ETCDIR="$value"; ;;
--sharedstatedir)
SHAREDSTATEDIR="$value"; ;;
--localstatedir)
LOCALSTATEDIR="$value"; ;;
--libdir)
LIBDIR="$value"
PKGCFG_LIBDIR="$value"; ;;
--libpath)
LDFLAGS="${LDFLAGS} ${LIBPATH}$value"; ;;
--includedir)
PKGCFG_INCDIR="$value"
INCLUDEDIR="$value"; CFLAGS="${CFLAGS} -I$value"; ;;
--infodir)
INFODIR="$value"; ;;
--mandir)
MANDIR="$value"; ;;
"--with-ruby") HAVE_RUBY="1"; ;;
"--without-readline") READLINE="0"; ;;
"--without-usb-sniffer") USBSNF="0"; ;;
"--without-nonfree") NONFREE="0"; ;;
"--without-debugger") DEBUGGER="0"; ;;
"--with-java") JAVA="1"; ;;
"--with-wii") WII="1"; ;;
"--enable-w32") W32="1"; ;;
"--with-sysproxy") SYSPROXY="1"; ;;
"--without-vala") VALA="0"; ;;
"--without-ewf") WANT_EWF="0"; ;;
"--with-perl") HAVE_PERL="1"; ;;
"--with-python") HAVE_PYTHON="1"; ;;
"--with-maemo") MAEMO="1"; ;;
"--without-gui") HAVE_GUI="0"; ;;
*) if [ "$value" ]; then eval "`echo $flag2=$value`" ;
else echo ; echo "WARNING: Unknown flag '$flag'." >&2 ; echo ; fi ;;
esac
}
# MAIN #
take_environ
split_host BUILD HOST TARGET
[ -z "$ACRHOOK" ] && ACRHOOK=./configure.hook
[ -e "$ACRHOOK" ] && . ${ACRHOOK}
while : ; do
[ -z "$1" ] && break
parse_options "$1"
shift
done
ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER PKGCFG_LIBDIR PKGCFG_INCDIR PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C CXX CXXFLAGS HAVE_LANG_CXX RUBY RUBY_VERSION HAVE_LANG_RUBY HAVE_RUBY LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_DL DL_LIBS PKGCONFIG SOLARIS DARWIN SHARED_EXT SHARED_CFLAGS WINDOWS READLINE HAVE_RL_COMPLETION_MATCHES RADARE_LIBS HAVE_LIB_READLINE HAVE_USB_H USBSNF NONFREE DEBUGGER JAVA WII W32 SYSPROXY HAVE_INSTALL VALA HAVE_VALAC VALAC HAVE_VALA_1_0_VERSION_0_5_0 _CFLAGS SIZEOF_OFF_T HAVE_LIB_EWF WANT_EWF PERL HAVE_LANG_PERL HAVE_PM_EXTUTILSEMBED HAVE_PERL PYTHON HAVE_LANG_PYTHON HAVE_PYTHON HAVE_LIB_PYTHON2_5 HAVE_LIB_PYTHON2_6 HAVE_LIB_PYTHON2_7 MAEMO HAVE_GUI GTK_FLAGS GTK_LIBS HAVE_PKGCFG_GTK__2_0 VTE_FLAGS VTE_LIBS HAVE_PKGCFG_VTE HAVE_VALA HAVE_LUA_H LUA HAVE_LANG_LUA LUA_LIBS HAVE_LIB_LUA HAVE_LIB_LUA5_1"
create_environ
ocho "checking build system type... ${BUILD}"
ocho "checking host system type... ${HOST}"
ocho "checking target system type... ${TARGET}"
[ "${CROSSBUILD}" = 1 ] && echo "using crosscompilation mode."
#split_host BUILD HOST TARGET
[ -n "${prefix}" ] && PREFIX="${prefix}"
ocho "checking for working directories... ${WODIS}"
ocho "using prefix '${PREFIX}'"
ACR_RMFILES=" test.c a.out a.exe test.c test.cxx a.out a.exe test.pl"
COMPILER=CC
ochof "checking for c compiler... "
HAVE_LANG_C=1
if [ "${CROSSBUILD}" = 1 ]; then
(command -v ${HOST}-${CC} >/dev/null 2>&1)
if [ $? = 0 ]; then CC="${HOST}-${CC}"; fi
fi
echo "int main(int argc, char **argv){return 0;}" > test.c
(exec ${CC} -o a.out ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} test.c >/dev/null 2>&1)
if [ $? = 0 ]; then echo ${CC}; else
echo no ; HAVE_LANG_C=0
do_remove
echo "ERROR: ${CC} cannot create executables" >&2 ;
exit 1 ; fi
COMPILER=CXX
HAVE_LANG_CXX=1
ochof "checking for c++ compiler... "
if [ "${CROSSBUILD}" = 1 ]; then
(command -v ${HOST}-${CXX} 2>&1 >/dev/null)
if [ "$?" = 0 ]; then CXX="${HOST}-${CXX}"; fi
fi
echo "#include <iostream>" > test.cxx
echo "int main(){ std::cout << 1; return 0;}" >> test.cxx
(exec ${CXX} ${CXXFLAGS} ${LDFLAGS} test.cxx -lstdc++ >/dev/null 2>&1)
if [ $? = 0 ]; then echo ${CXX}; else
HAVE_LANG_CXX=0
echo no
fi
ochof "checking for ruby... "
HAVE_LANG_RUBY=0
for A in `echo ${PATH} | sed -e 's,:, ,g'`; do
RUBY=`ls ${A}/ruby* 2>/dev/null`
if [ "${RUBY}" ]; then
RUBY=`echo ${RUBY} | cut -d\ -f 1`
RUBY_VERSION=`echo ${RUBY} ${A} | awk '{ print substr($1,length($2)+6) }'`
echo ${RUBY} ; HAVE_LANG_RUBY=1 ; break
fi
done
if [ -z "${RUBY}" ]; then
echo no ; fi
printf "checking host endianness... "
LIL_ENDIAN=$(printf I|od|${AWK}'{print substr($2,6,1);exit}')
if [ 0 != 0 -o "${LIL_ENDIAN}" = 1 ]; then
BYTEORDER=1234
BIG_ENDIAN=0
echo little
else
BYTEORDER=4321
BIG_ENDIAN=1
LIL_ENDIAN=0
echo big
fi
ochof "checking for dynamic library... "
HAVE_LIB_DL=0
for OS in gnulinux linux gnu/kfreebsd syllable serenityos vinix sunos darwin beos solaris wsl ; do
if [ "${HOST_OS}" = "${OS}" ]; then
HAVE_LIB_DL=1
break;
fi
done
if [ "${HAVE_LIB_DL}" = 1 ]; then
DL_LIBS="-ldl"
echo "required"
else
DL_LIBS=""
echo "libc"
fi
ochof "checking for pkg-config... "
if [ -n "$PKGCONFIG" ]; then
if [ -x "$PKGCONFIG" ]; then
_HAVE_PKGCONFIG="${PKGCONFIG}"
else
ocho "PKGCONFIG env is not executable"
PKGCONFIG=""
fi
else
IFS=:
for A in ${PATH} ; do
if [ -x "${A}/pkg-config" ]; then
PKGCONFIG="${A}/pkg-config"
elif [ -x "${A}/pkgconf" ]; then
PKGCONFIG="${A}/pkgconf"
else
continue
fi
break
done
unset IFS
fi
if [ -n "${PKGCONFIG}" ]; then
ocho ${PKGCONFIG}
else
ocho no; fi
SOLARIS="0"
DARWIN="0"
if [ "$HOST_OS" = "sunos" ]; then
SOLARIS="1"; fi
if [ "$HOST_OS" = "solaris" ]; then
SOLARIS="1"; fi
if [ "$HOST_OS" = "darwin" ]; then
DARWIN="1"
SHARED_EXT="dylib"
SHARED_CFLAGS="-dynamiclib"
else
SHARED_EXT="so"
SHARED_CFLAGS="-fPIC -shared"; fi
if [ "$HOST_OS" = "mingw" ]; then
WINDOWS="1"; fi
if [ "$WINDOWS" = "1" ]; then
SHARED_EXT="dll"; fi
printf "checking function rl_completion_matches() in readline... "
echo "extern int rl_completion_matches(); int main(int ac, char **av){ rl_completion_matches(0); return 0; }" > test.c
${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -lreadline test.c >/dev/null 2>&1
if [ $? = 0 ]; then
echo yes ; HAVE_RL_COMPLETION_MATCHES=1
else
HAVE_RL_COMPLETION_MATCHES=0 ; echo no ; fi
RADARE_LIBS=""
HAVE_LIB_READLINE="0"
if [ "$HAVE_RL_COMPLETION_MATCHES" = "1" ]; then
HAVE_LIB_READLINE="1"
RADARE_LIBS="-lreadline"; fi
if [ "$READLINE" = "0" ]; then
HAVE_LIB_READLINE="0"; fi
check_include() {
VAR=$1
INC=$2
_REQUIRED=$3
ochof "checking for $2... "
echo > test.c
echo "#include <${INC}>" >>test.c
echo 'int main(int ac, char **av){return 0;}' >>test.c
eval \$${COMPILER} ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} test.c >/dev/null 2>&1
if [ $? = 0 ]; then
eval ${VAR}=1
echo yes
else
eval ${VAR}=0
echo no
if [ 1 = "0" ]; then
echo 'ERROR: required include not found.' >&2
do_remove
exit 1
fi
fi
}
check_include HAVE_USB_H usb.h 0
if [ "$HAVE_USB_H" = "0" ]; then
USBSNF="0"; fi
ochof "checking for install... "
if [ -x "${INSTALL}" ]; then
FIND=${INSTALL}
else
FIND=""
IFS=:
for A in ${PATH} ; do
if [ -x "${A}/install" ]; then
FIND="${A}/install"
break;
fi
done
unset IFS
fi
if [ -n "${FIND}" ]; then
ocho ${FIND};
HAVE_INSTALL=1
INSTALL=${FIND}
else
HAVE_INSTALL=0
INSTALL=install
if [ "" = 1 ]; then
echo "Cannot find install" >&2
else
echo no
fi ; fi
ochof "checking for valac... "
if [ -x "${VALAC}" ]; then
FIND=${VALAC}
else
FIND=""
IFS=:
for A in ${PATH} ; do
if [ -x "${A}/valac" ]; then
FIND="${A}/valac"
break;
fi
done
unset IFS
fi
if [ -n "${FIND}" ]; then
ocho ${FIND};
HAVE_VALAC=1
VALAC=${FIND}
else
HAVE_VALAC=0
VALAC=valac
if [ "" = 1 ]; then
echo "Cannot find valac" >&2
else
echo no
fi ; fi
HAVE_VALA_1_0_VERSION_0_5_0=0
printf "checking version of library vala-1.0 >= 0.5.0... "
${PKGCONFIG} --atleast-version=0.5.0 vala-1.0 >/dev/null 2>&1
if [ $? = 0 ]; then HAVE_VALA_1_0_VERSION_0_5_0=1 ; echo ok; else
echo "no" ; fi
if [ "$HAVE_VALA_1_0_VERSION_0_5_0" = "0" ]; then
echo " Needs vala 0.5.0 at least" >&2
HAVE_VALAC="0 VALAC = ''"; fi
_CFLAGS="$CFLAGS"
CFLAGS="${CFLAGS} -include /usr/include/sys/types.h -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
SIZEOF_OFF_T="1"
printf 'checking size of off_t... '
echo '#include <stdio.h>' > test.c
echo 'int main(int ac, char **av){printf("%d",sizeof(off_t));return 0;}' >>test.c
eval \$${COMPILER} ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} -o a.out test.c >/dev/null 2>&1
if [ 0 = $? ]; then
SIZEOF_OFF_T=$(./a.out)
echo ${SIZEOF_OFF_T}
HAVE_SIZEOF_OFF_T=1
else
SIZEOF_OFF_T=0 ; echo error
HAVE_SIZEOF_OFF_T=0
fi
CFLAGS="$_CFLAGS"
check_library() {
VAR=$1
S="$"
_REQUIRED=$3
_CHKLIB_NAME=$2
_CHKLIB_LIBS=$(echo "-l${_CHKLIB_NAME}" | sed 's,+, -l,g')
ochof "checking for lib${_CHKLIB_NAME} ... "
echo "int main(int ac, char **av){return 0;}" > test.c
eval ${S}${COMPILER} ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} ${LDFLAGS} ${_CHKLIB_LIBS} test.c >/dev/null 2>&1
if [ $? = 0 ]; then
eval ${VAR}=1
echo yes
else
eval ${VAR}=0
echo no
if [ "${_REQUIRED}" = 1 ]; then
echo "this library is required."
do_remove
exit 1
fi
fi
}
check_library HAVE_LIB_EWF ewf 0
if [ "$WANT_EWF" = "0" ]; then
HAVE_LIB_EWF="0"; fi
ochof "checking for perl... "
HAVE_LANG_PERL=0
${PERL} -e '' 2>&1 > /dev/null
if [ $? = 0 ]; then
ocho ok ; HAVE_LANG_PERL=1 ; else
ocho no ; fi
ochof "checking for 'ExtUtils::Embed' perl module ... "
perl -mExtUtils::Embed -e '' 2>/dev/null
if [ $? = 0 ]; then
HAVE_PM_EXTUTILSEMBED=1
ocho ok
else
HAVE_PM_EXTUTILSEMBED=0
ocho no
fi
if [ "$HAVE_PM_EXTUTILSEMBED" = "0" ]; then
HAVE_PERL="0"; fi
ochof "checking for python... "
HAVE_LANG_PYTHON=0
for A in `echo ${PATH} | sed -e 's,:, ,g'` ; do
PYTHON=`ls ${A}/python* 2>/dev/null`
if [ "${PYTHON}" ]; then
PYTHON=`echo ${PYTHON} | awk '{print $1; }'`
echo ${PYTHON} ; HAVE_LANG_PYTHON=1 ; break ; fi
done
if [ -z "${PYTHON}" ]; then
echo no ; fi
check_library HAVE_LIB_PYTHON2_5 python2.5 0
check_library HAVE_LIB_PYTHON2_6 python2.6 0
check_library HAVE_LIB_PYTHON2_7 python2.7 0
if [ -z "${PKGCONFIG}" ]; then pkg-config --version >/dev/null 2>&1 ; if [ 0 = 0 ]; then PKGCONFIG=pkg-config ; else PKGCONFIG=pkgconf ; fi; fi
type ${PKGCONFIG} > /dev/null 2>&1 || echo "ERROR: Cannot find valid PKGCONFIG, pkg-config or pkgconf in PATH"
echo 'Using PKGCONFIG: '${PKGCONFIG}
printf 'checking pkg-config flags for gtk+-2.0... '
tmp=`${PKGCONFIG} --cflags gtk+-2.0 2>/dev/null`
if [ $? != 0 ]; then echo no ; HAVE_PKGCFG_GTK__2_0=0;
GTK_FLAGS='';GTK_LIBS='';
else
GTK_FLAGS=$tmp;
tmp=`${PKGCONFIG} --libs gtk+-2.0 2>/dev/null`
if [ $? = 0 ]; then
echo yes; HAVE_PKGCFG_GTK__2_0=1;
GTK_LIBS=$tmp; fi; fi
if [ "$GTK_FLAGS" = "" ]; then
HAVE_GUI="0"; fi
if [ -z "${PKGCONFIG}" ]; then pkg-config --version >/dev/null 2>&1 ; if [ 0 = 0 ]; then PKGCONFIG=pkg-config ; else PKGCONFIG=pkgconf ; fi; fi
printf 'checking pkg-config flags for vte... '
tmp=`${PKGCONFIG} --cflags vte 2>/dev/null`
if [ $? != 0 ]; then echo no ; HAVE_PKGCFG_VTE=0;
VTE_FLAGS='';VTE_LIBS='';
else
VTE_FLAGS=$tmp;
tmp=`${PKGCONFIG} --libs vte 2>/dev/null`
if [ $? = 0 ]; then
echo yes; HAVE_PKGCFG_VTE=1;
VTE_LIBS=$tmp; fi; fi
if [ "$VTE_FLAGS" = "" ]; then
HAVE_GUI="0"; fi
HAVE_VALAC="1"
HAVE_VALA="1"
VALAC="1"
if [ "$HAVE_GUI" = "0" ]; then
VALAC="0"
HAVE_VALA="0"
echo " Vala build disabled, no gtk-dev or libvte-dev found" >&2 ; fi
check_include HAVE_LUA_H lua.h 0
ochof "checking for lua... "
HAVE_LANG_LUA=0
${LUA} -v > /dev/null 2>&1
if [ $? = 0 ]; then
echo ok ; HAVE_LANG_LUA=1 ;
ocho "checking for lua libs... "
check_library HAVE_LIB_LUA lua 0
check_library HAVE_LIB_LUA5_1 lua5.1 0
if [ "${HAVE_LIB_LUA}" = 1 ]; then
LUA_LIBS=-llua
fi
if [ "${HAVE_LIB_LUA5_1}" = 1 ]; then
LUA_LIBS=-llua5.1
fi
else
echo no ; fi
SEDFLAGS=" -e '"
COUNT=0
for A in ${ENVWORDS} ; do
[ "${A}" = VPATH ] && continue
[ "${A}" = srcdir ] && continue
eval "VAR=\$${A}"
VAR="`echo ${VAR} | sed -e 's/\,/\\\,/g'`"
[ $COUNT = 10 ] && COUNT=0 && SEDFLAGS="${SEDFLAGS}' -e '"
COUNT=$(($COUNT+1))
SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;"
done
SEDFLAGS="${SEDFLAGS}'"
for A in . ./global.h ./config.mk src src/rsc/rsc src/rfile ; do # SUBDIRS
if [ -f "${VPATH}/${A}.acr" ]; then
SD_TARGET=${A}
else
if [ -d "${VPATH}/${A}" ]; then
SD_TARGET=${A}/Makefile
mkdir -p ${A}
else
echo "ERROR: Cannot find ${VPATH}/${A}.acr" >&2
exit 1
fi
fi
ocho "creating ${SD_TARGET}"
[ "${VPATH}" != '.' ] && mkdir -p $(echo ${A} | sed -e "s,/`basename ${A}`$,,g")
cat ${VPATH}/${SD_TARGET}.acr | \
eval sed -e "s,@VPATH@,${VPATH}/${A},g" ${SEDFLAGS} > ${SD_TARGET}.tmp
for A in ${ENVWORDS}; do
VALUE=`eval echo "$"${A}`
if [ "$VALUE" = 0 ]; then ## FALSE
MARK="##${A}##"
if [ -n "`grep \"${MARK}\" ${SD_TARGET}.tmp`" ]; then
mv ${SD_TARGET}.tmp ${SD_TARGET}.tmp2
cat ${SD_TARGET}.tmp2 | MARK=$MARK $AWK 'BEGIN{a=0;}{if($1==ENVIRON["MARK"]){if(a)a=0;else a=1}else{if(!a)print;}}' > ${SD_TARGET}.tmp
fi
fi
done
mv ${SD_TARGET}.tmp ${SD_TARGET} && rm -f ${SD_TARGET}.tmp2
if [ ! $? = 0 ]; then echo Cannot write target file ; control_c ; fi
done
do_remove
if [ "$QUIET" = 0 ]; then
echo
echo "Final report:"
for A in HAVE_GUI WII LUA_LIBS HAVE_LIB_LUA MAEMO VALA JAVA USBSNF SYSPROXY DEBUGGER HAVE_LIB_EWF HAVE_LIB_READLINE ; do
eval VAL="\$${A}"
[ -z "${VAL}" ] && VAL="\"\""
echo " - ${A} = ${VAL}"
done
fi