-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure.sh
executable file
·810 lines (724 loc) · 20.4 KB
/
configure.sh
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
#!/bin/sh
#
# charm-crypto configure script
# (adapted from the qemu source)
#
# set temporary file name
if test ! -z "$TMPDIR" ; then
TMPDIR1="${TMPDIR}"
elif test ! -z "$TEMPDIR" ; then
TMPDIR1="${TEMPDIR}"
else
TMPDIR1="/tmp"
fi
TMPC="${TMPDIR1}/charm-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/charm-conf-${RANDOM}-$$-${RANDOM}.o"
TMPE="${TMPDIR1}/charm-conf-${RANDOM}-$$-${RANDOM}.exe"
# NB: do not call "exit" in the trap handler; this is buggy with some shells;
# see <[email protected]>
trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
rm -f config.log config.ld
compile_object() {
echo $cc $CHARM_CFLAGS -c -o $TMPO $TMPC >> config.log
$cc $CHARM_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
}
compile_prog() {
local_cflags="$1"
local_ldflags="$2"
echo $cc $CHARM_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
$cc $CHARM_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
}
check_library() {
lib_test="$1"
tmp_file="$2"
$cc $LDFLAGS $lib_test 2> $tmp_file
grep "main" $tmp_file > /dev/null
result=$?
# echo "Result => $result"
return $result
}
# symbolically link $1 to $2. Portable version of "ln -sf".
symlink() {
rm -f $2
ln -s $1 $2
}
# check whether a command is available to this shell (may be either an
# executable or a builtin)
has() {
type "$1" >/dev/null 2>&1
}
# search for an executable in PATH
path_of() {
local_command="$1"
local_ifs="$IFS"
local_dir=""
# pathname has a dir component?
if [ "${local_command#*/}" != "$local_command" ]; then
if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
echo "$local_command"
return 0
fi
fi
if [ -z "$local_command" ]; then
return 1
fi
IFS=:
for local_dir in $PATH; do
if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
echo "$local_dir/$local_command"
IFS="${local_ifs:-$(printf ' \t\n')}"
return 0
fi
done
# not found
IFS="${local_ifs:-$(printf ' \t\n')}"
return 1
}
# default parameters
source_path=`dirname "$0"`
cpu=""
static="no"
cross_prefix=""
host_cc="gcc"
helper_cflags=""
cc_i386=i386-pc-linux-gnu-gcc
# Default value for a variable defining feature "foo".
# * foo="no" feature will only be used if --enable-foo arg is given
# * foo="" feature will be searched for, and if found, will be used
# unless --disable-foo is given
# * foo="yes" this value will only be set by --enable-foo flag.
# feature will searched for,
# if not found, configure exits with error
#
# Always add --enable-foo and --disable-foo command line args.
# Distributions want to ensure that several features are compiled in, and it
# is impossible without a --enable-foo that exits if a feature is not found.
docs="no"
sphinx_build="$(which sphinx-build)"
integer_module="yes"
ecc_module="yes"
pairing_module="yes"
pairing_miracl="yes"
pairing_relic="no"
pairing_pbc="no"
disable_benchmark="no"
integer_ssl="no"
integer_gmp="no"
python_version=""
gprof="no"
debug="no"
mingw32="no"
EXESUF=""
prefix="/usr/local"
mandir="\${prefix}/share/man"
datadir="\${prefix}/share/charm"
docdir="\${prefix}/share/doc/charm"
bindir="\${prefix}/bin"
libdir="\${prefix}/lib"
incdir="\${prefix}/include"
sysconfdir="\${prefix}/etc"
confsuffix="/charm"
profiler="no"
wget="$(which wget)"
curve="mnt"
# set -x
# parse CC options first
for opt do
optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
case "$opt" in
--cross-prefix=*) cross_prefix="$optarg"
;;
--cc=*) CC="$optarg"
;;
--source-path=*) source_path="$optarg"
;;
--cpu=*) cpu="$optarg"
;;
--extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
;;
--extra-cppflags=*) CPPFLAGS="$optarg $CPPFLAGS"
;;
esac
done
# OS specific
# Using uname is really, really broken. Once we have the right set of checks
# we can eliminate it's usage altogether
cc="${cross_prefix}${CC-gcc}"
ar="${cross_prefix}${AR-ar}"
objcopy="${cross_prefix}${OBJCOPY-objcopy}"
ld="${cross_prefix}${LD-ld}"
windres="${cross_prefix}${WINDRES-windres}"
pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}"
sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"
# default flags for all hosts
CFLAGS="-g -Wall $CFLAGS"
INCLUDES=""
LIBNAME=""
# make source path absolute
source_path=`cd "$source_path"; pwd`
check_define() {
cat > $TMPC <<EOF
#if !defined($1)
#error Not defined
#endif
int main(void) { return 0; }
EOF
compile_object
}
if test ! -z "$cpu" ; then
# command line argument
:
elif check_define __i386__ ; then
cpu="i386"
elif check_define __x86_64__ ; then
cpu="x86_64"
elif check_define __sparc__ ; then
# We can't check for 64 bit (when gcc is biarch) or V8PLUSA
# They must be specified using --sparc_cpu
if check_define __arch64__ ; then
cpu="sparc64"
else
cpu="sparc"
fi
elif check_define _ARCH_PPC ; then
if check_define _ARCH_PPC64 ; then
cpu="ppc64"
else
cpu="ppc"
fi
elif check_define __mips__ ; then
cpu="mips"
elif check_define __ia64__ ; then
cpu="ia64"
elif check_define __s390__ ; then
if check_define __s390x__ ; then
cpu="s390x"
else
cpu="s390"
fi
else
cpu=`uname -m`
fi
case "$cpu" in
alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32)
cpu="$cpu"
;;
i386|i486|i586|i686|i86pc|BePC)
cpu="i386"
;;
x86_64|amd64)
cpu="x86_64"
;;
*)
echo "Unsupported CPU = $cpu"
exit 1
;;
esac
# OS specific
if check_define __linux__ ; then
targetos="Linux"
elif check_define _WIN32 ; then
targetos='MINGW32'
elif check_define __OpenBSD__ ; then
targetos='OpenBSD'
elif check_define __sun__ ; then
targetos='SunOS'
elif check_define __HAIKU__ ; then
targetos='Haiku'
else
targetos=`uname -s`
fi
if [ $targetos == "Darwin" ]; then
darwin="yes"
fi
: ${make=${MAKE-make}}
: ${install=${INSTALL-install}}
werror=""
for opt do
optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
case "$opt" in
--help|-h) show_help=yes
;;
--version|-V) exec cat "$source_path/VERSION"
;;
--prefix=*) prefix="$optarg"
;;
--source-path=*)
;;
--cross-prefix=*)
;;
--cc=*)
;;
--host-cc=*) host_cc="$optarg"
;;
--make=*) make="$optarg"
;;
--install=*) install="$optarg"
;;
--extra-cflags=*)
;;
--extra-ldflags=*)
;;
--extra-cppflags=*)
;;
--cpu=*)
;;
--static)
static="yes"
LDFLAGS="-static $LDFLAGS"
;;
--mandir=*) mandir="$optarg"
;;
--bindir=*) bindir="$optarg"
;;
--libdir=*) libdir="$optarg"
;;
--datadir=*) datadir="$optarg"
;;
--docdir=*) docdir="$optarg"
;;
--sysconfdir=*) sysconfdir="$optarg"
;;
--disable-integer) integer_module="no"
;;
--disable-ecc) ecc_module="no"
;;
--disable-pairing) pairing_module="no"
;;
--disable-benchmark) disable_benchmark="yes"
;;
--enable-pairing-miracl=*)
echo "Requires installing the MIRACL library."
pairing_arg="$optarg" ;
pairing_pbc="no";
pairing_miracl="yes" ;
pairing_relic="no"
;;
--enable-pairing-pbc)
pairing_pbc="yes" ;
pairing_miracl="no";
pairing_relic="no"
;;
--enable-pairing-relic)
pairing_relic="yes";
pairing_pbc="no" ;
pairing_miracl="no"
;;
--enable-integer-openssl)
echo "integer module using openssl not supported yet."
#integer_ssl="yes" ;
#integer_gmp="no"
;;
--enable-integer-gmp)
integer_gmp="yes" ;
integer_ssl="no"
;;
--enable-integer-relic)
echo "integer module using RELIC not supported yet."
;;
--enable-debug)
# Enable debugging options that aren't excessively noisy
debug="yes"
;;
--enable-profiler) profiler="yes"
;;
--enable-werror) werror="yes"
;;
--disable-werror) werror="no"
;;
--disable-docs) docs="no"
;;
--enable-docs) docs="yes"
;;
--sphinx-build=*) sphinx_build="$optarg"
;;
--*dir)
;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
done
#
# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
# CHARM_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
#
host_guest_base="no"
case "$cpu" in
i386)
CFLAGS="-m32 $CFLAGS"
LDFLAGS="-m32 $LDFLAGS"
cc_i386='$(CC) -m32'
helper_cflags="-fomit-frame-pointer"
host_guest_base="yes"
;;
x86_64)
CFLAGS="-m64 $CFLAGS"
LDFLAGS="-m64 $LDFLAGS"
cc_i386='$(CC) -m64'
host_guest_base="yes"
;;
esac
[ -z "$guest_base" ] && guest_base="$host_guest_base"
if test x"$show_help" = x"yes" ; then
cat << EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]
EOF
echo "Standard options:"
echo " --help print this message"
echo " --prefix=PREFIX install in PREFIX [$prefix]"
echo ""
echo "Advanced options:"
echo " --source-path=PATH path of source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
echo " --cc=CC use C compiler CC [$cc]"
echo " --host-cc=CC use C compiler CC [$host_cc] for code run at build time"
echo " --extra-cflags=CFLAGS append extra C compiler flags CFLAGS"
echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
echo " --extra-cppflags=CPPFLAG append extra c pre-processor flags CPPFLAGS"
echo " --make=MAKE use specified make [$make]"
echo " --install=INSTALL use specified install [$install]"
echo " --static enable static build [$static]"
echo " --mandir=PATH install man pages in PATH"
echo " --datadir=PATH install firmware in PATH"
echo " --bindir=PATH install binaries in PATH"
echo " --sysconfdir=PATH install config in PATH/CHARM"
echo " --enable-debug enable common debug build options"
echo " --disable-integer disable INTEGER base module"
echo " --disable-ecc disable ECC base module"
echo " --disable-pairing disable PAIRING base module"
echo " --enable-pairing-relic enable use of RELIC lib for pairing module."
echo " --enable-pairing-miracl= enable use of MIRACL lib for pairing module. Options: 'mnt', 'bn', 'ss'"
echo " --enable-pairing-pbc enable use of PBC lib for pairing module (DEFAULT)"
echo " --enable-integer-openssl enable use of openssl for integer module"
echo " --enable-integer-gmp enable use of GMP lib for integer module (DEFAULT)"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
fi
# check that the C compiler works.
cat > $TMPC <<EOF
int main(void) {}
EOF
if compile_object ; then
: C compiler works ok
else
echo "ERROR: \"$cc\" either does not exist or does not work"
exit 1
fi
# set flags here
#gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
#gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
#gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
cat > $TMPC << EOF
int main(void) { return 0; }
EOF
for flag in $gcc_flags; do
if compile_prog "-Werror $CFLAGS" "-Werror $flag" ; then
CFLAGS="$CFLAGS $flag"
fi
done
if test -z "$target_list" ; then
target_list="$default_target_list"
else
target_list=`echo "$target_list" | sed -e 's/,/ /g'`
fi
feature_not_found() {
feature=$1
echo "ERROR"
echo "ERROR: User requested feature $feature"
echo "ERROR: configure was not able to find it"
echo "ERROR"
exit 1;
}
if test -z "$cross_prefix" ; then
# ---
# big/little endian test
cat > $TMPC << EOF
#include <inttypes.h>
int main(int argc, char ** argv){
volatile uint32_t i=0x01234567;
return (*((uint8_t*)(&i))) == 0x67;
}
EOF
if compile_prog "" "" ; then
$TMPE && bigendian="yes"
else
echo big/little test failed
fi
else
# if cross compiling, cannot launch a program, so make a static guess
case "$cpu" in
armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
bigendian=yes
;;
esac
fi
# host long bits test, actually a pointer size test
cat > $TMPC << EOF
int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
EOF
if compile_object; then
hostlongbits=64
else
hostlongbits=32
fi
##########################################
# zlib check
#cat > $TMPC << EOF
##include <zlib.h>
#int main(void) { zlibVersion(); return 0; }
#EOF
#if compile_prog "" "-lz" ; then
# :
#else
# echo
# echo "Error: zlib check failed"
# echo "Make sure to have the zlib libs and headers installed."
# echo
# exit 1
#fi
##########################################
# pkg-config probe
#if ! has $pkg_config; then
# echo warning: proceeding without "$pkg_config" >&2
# pkg_config=/bin/false
#fi
##########################################
# check if the compiler defines offsetof
need_offsetof=yes
cat > $TMPC << EOF
#include <stddef.h>
int main(void) { struct s { int f; }; return offsetof(struct s, f); }
EOF
if compile_prog "" "" ; then
need_offsetof=no
fi
##########################################
# check if the compiler understands attribute warn_unused_result
#
# This could be smarter, but gcc -Werror does not error out even when warning
# about attribute warn_unused_result
gcc_attribute_warn_unused_result=no
cat > $TMPC << EOF
#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
#error gcc 3.3 or older
#endif
int main(void) { return 0;}
EOF
if compile_prog "" ""; then
gcc_attribute_warn_unused_result=yes
fi
##########################################
# checks for -lm, -lpbc, -lgmp, -lcrypto libraries
libm_found="no"
if check_library "-lm" $TMPC == 0 ; then
#echo "libm found!"
libm_found="yes"
fi
# check for -lgmp
libgmp_found="no"
if check_library "-lgmp" $TMPC == 0 ; then
#echo "libgmp found!"
libgmp_found="yes"
fi
# check for -lpbc
libpbc_found="no"
if check_library "-lpbc" $TMPC == 0 ; then
#echo "libpbc found!"
libpbc_found="yes"
fi
# check for -lcrypto
libcrypto_found="no"
if check_library "-lcrypto" $TMPC == 0 ; then
#echo "libcrypto found!"
libcrypto_found="yes"
fi
# check for -lrelic
librelic_found="no"
if check_library "-lrelic" $TMPC == 0 ; then
#echo "libcrypto found!"
librelic_found="yes"
fi
##########################################
##########################################
# End of CC checks
# After here, no more $cc or $ld runs
if test "$debug" = "no" ; then
CFLAGS="-O2 $CFLAGS"
fi
# Consult white-list to determine whether to enable werror
# by default. Only enable by default for git builds
z_version=`cut -f3 -d. "$source_path/VERSION"`
if test -z "$werror" ; then
if test "$z_version" = "50" -a \
"$linux" = "yes" ; then
werror="yes"
else
werror="no"
fi
fi
confdir=$sysconfdir$confsuffix
[ ! -z "$uname_release" ] && \
echo "uname -r $uname_release"
config_mk="config.mk"
echo "# Automatically generated by configure - do not modify" > $config_mk
printf "# Configured with:" >> $config_mk
printf " '%s'" "$0" "$@" >> $config_mk
echo >> $config_mk
echo all: >> $config_mk
echo "prefix=$prefix" >> $config_mk
echo "bindir=$bindir" >> $config_mk
echo "libdir=$libdir" >> $config_mk
echo "incdir=$incdir" >> $config_mk
echo "mandir=$mandir" >> $config_mk
echo "datadir=$datadir" >> $config_mk
echo "sysconfdir=$sysconfdir" >> $config_mk
echo "docdir=$docdir" >> $config_mk
echo "confdir=$confdir" >> $config_mk
case "$cpu" in
i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
ARCH=$cpu
;;
armv4b|armv4l)
ARCH=arm
;;
esac
echo "ARCH=$ARCH" >> $config_mk
if test "$debug" = "yes" ; then
echo "CONFIG_DEBUG_EXEC=y" >> $config_mk
fi
#if test "$darwin" = "yes" ; then
# echo "CONFIG_DARWIN=y" >> $config_mk
#fi
if test "$static" = "yes" ; then
echo "CONFIG_STATIC=y" >> $config_mk
fi
CHARM_version=`head "$source_path/VERSION"`
echo "VERSION=$CHARM_version" >>$config_mk
#echo "SRC_PATH=$source_path" >> $config_mk
#echo "PKGVERSION=$pkgversion" >>$config_mk
#echo "TARGET_DIRS=$target_list" >> $config_mk
echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_mk
echo "TOOLS=$tools" >> $config_mk
echo "MAKE=$make" >> $config_mk
echo "INSTALL=$install" >> $config_mk
echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mk
echo "INSTALL_DATA=$install -m0644 -p" >> $config_mk
echo "INSTALL_PROG=$install -m0755 -p" >> $config_mk
# write the CHARM specific options to the config file
echo "INT_MOD=$integer_module" >> $config_mk
echo "ECC_MOD=$ecc_module" >> $config_mk
echo "PAIR_MOD=$pairing_module" >> $config_mk
if test "$pairing_pbc" = "yes" ; then
INCLUDES="-Ipbc/ $INCLUDES"
CFLAGS="-DBUILD_RELIC=0 -DBUILD_MIRACL=0 -DBUILD_PBC=1 $CFLAGS"
LIBNAME="libCharmPBC"
echo "BUILD_MIRACL=no" >> $config_mk
echo "BUILD_RELIC=no" >> $config_mk
echo "BUILD_PBC=yes" >> $config_mk
echo "underlib=pbc" >> $config_mk
echo "CHARM_LIB=$LIBNAME" >> $config_mk
elif test "$pairing_miracl" = "yes" ; then
INCLUDES="-Imiracl/ $INCLUDES"
CFLAGS="-DBUILD_RELIC=0 -DBUILD_MIRACL=1 $CFLAGS"
LIBNAME="libCharmMiracl"
echo "BUILD_MIRACL=yes" >> $config_mk
echo "BUILD_RELIC=no" >> $config_mk
echo "BUILD_PBC=no" >> $config_mk
echo "underlib=miracl" >> $config_mk
elif test "$pairing_relic" = "yes" ; then
INCLUDES="-I$incdir/relic -Irelic/ $INCLUDES"
CFLAGS="-DBUILD_RELIC=1 -DBUILD_MIRACL=0 $CFLAGS"
LIBNAME="libCharmRelic"
echo "BUILD_MIRACL=no" >> $config_mk
echo "BUILD_RELIC=yes" >> $config_mk
echo "BUILD_PBC=no" >> $config_mk
echo "underlib=relic" >> $config_mk
echo "CHARM_LIB=$LIBNAME" >> $config_mk
fi
if test "$pairing_miracl" = "yes" ; then
if test "$pairing_arg" = "mnt" ; then
curve="$pairing_arg"
CFLAGS="-DASYMMETRIC=1 -DBUILD_MNT_CURVE=1 $CFLAGS"
elif test "$pairing_arg" = "bn" ; then
curve="$pairing_arg"
CFLAGS="-DASYMMETRIC=1 -DBUILD_BN_CURVE=1 $CFLAGS"
elif test "$pairing_arg" = "ss" ; then
curve="$pairing_arg"
CFLAGS="-DASYMMETRIC=0 -DBUILD_SS_CURVE=1 $CFLAGS"
fi
echo "CURVE=$curve" >> $config_mk
echo "CHARM_LIB=$LIBNAME$curve" >> $config_mk
fi
if test "$libm_found" = "no" ; then
echo "ERROR: libm not found. Please install first, then re-run configure."
rm $config_mk
exit -1
fi
#echo "HAVE_LIBM=$libm_found" >> $config_mk
#echo "HAVE_LIBGMP=$libgmp_found" >> $config_mk
#echo "HAVE_LIBPBC=$libpbc_found" >> $config_mk
#echo "HAVE_LIBCRYPTO=$libcrypto_found" >> $config_mk
if test "$darwin" = "yes" ; then
mac_ver=`sw_vers | grep "ProductVersion:" | cut -d. -f2`
if test "$mac_ver" = "7"; then
echo "CC=gcc-4.2" >> $config_mk
echo "CPP=gcc-4.2 -E" >> $config_mk
echo "CXX=gcc-4.2" >> $config_mk
echo "HOST_CC=gcc-4.2" >> $config_mk
else
echo "CC=clang" >> $config_mk
echo "CXX=clang++" >> $config_mk
echo "HOST_CC=$host_cc" >> $config_mk
fi
else
echo "CC=gcc" >> $config_mk
echo "CXX=g++" >> $config_mk
echo "HOST_CC=gcc" >> $config_mk
fi
echo "AR=$ar" >> $config_mk
echo "LD=$ld" >> $config_mk
echo "LIBTOOL=$libtool" >> $config_mk
echo "INCLUDES=$INCLUDES" >> $config_mk
echo "CFLAGS=$CFLAGS" >> $config_mk
echo "CXXFLAGS=$CFLAGS" >> $config_mk
echo "HELPER_CFLAGS=$helper_cflags" >> $config_mk
echo "LDFLAGS=$LDFLAGS" >> $config_mk
#echo "CPPFLAGS=$CPPFLAGS" >> $config_mk
echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_mk
echo "ARLIBS_END=$arlibs_end" >> $config_mk
echo "LIBS+=$LIBS" >> $config_mk
echo "LIBS_TOOLS+=$libs_tools" >> $config_mk
echo "OS=$targetos" >> $config_mk
# generate list of library paths for linker script
#cflags=""
#includes=""
#ldflags=""
echo "OS Platform $targetos"
echo "Install prefix $prefix"
echo "data directory `eval echo $datadir`"
echo "binary directory `eval echo $bindir`"
echo "include directory `eval echo $incdir`"
echo "library directory `eval echo $libdir`"
echo "config directory `eval echo $sysconfdir`"
#echo "Source path $source_path"
#echo "C compiler $CC"
#echo "Host C compiler $HOST_CC"
echo "CFLAGS $CFLAGS"
echo "LDFLAGS $LDFLAGS"
echo "make $make"
echo "install $install"
echo "host CPU $cpu"
echo "static build $static"
echo "-Werror enabled $werror"
echo "integer module $integer_module"
echo "ecc module $ecc_module"
echo "pairing module $pairing_module"
echo "disable benchmark $disable_benchmark"
echo "libm found $libm_found"
echo "libgmp found $libgmp_found"
echo "libpbc found $libpbc_found"
echo "libcrypto found $libcrypto_found"
exit 0