forked from moinakg/pcompress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig
executable file
·811 lines (745 loc) · 19.3 KB
/
config
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
#!/bin/sh
#
# This file is a part of Pcompress, a chunked parallel multi-
# algorithm lossless compression and decompression program.
#
# Copyright (C) 2012-2013 Moinak Ghosh. All rights reserved.
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# moinakg@belenix.org, http://moinakg.wordpress.com/
#
my_license=LGPLv3
usage() {
prog=$1
cat << _EOF
${prog} [<options>]
<options> can be one of the following:
--prefix=<val> The installation prefix (default: /usr).
--enable-debug Enable debug mode compilation (default: disabled).
--disable-allocator Disable use of internal memory allocator mechanism (default: enabled).
--enable-debug-stats Enable printing of some verbose debug info (default: disabled).
--with-openssl=<path to OpenSSL installation tree> (Default: System)
This defaults to the system's OpenSSL library. You can use this option
if you want to use an alternate OpenSSL installation.
--with-zlib=<path to zlib installation tree> (Default: System)
Enable building against an alternate Zlib installation.
--with-bzlib=<path to Bzip2 library installation tree> (Default: System)
Enable building against an alternate Bzip2 and library installation.
--with-external-libbsc=<path to libbsc source tree>
Enable building with exernal libbsc sources. Can be used to link with
ASLv2 libbsc when using MPLv2 licensed sources.
--wavpack-dir=<path to WavPack source tree>
Points to the directory containing the WavPack sources. This option
must be specified if --disable-wavpack is not provided.
--disable-wavpack Disables the WavPack filter.
--no-sse-detect Do NOT attempt to probe the system's SSE capability for build flags.
Implies '--no-avx-detect' below.
--no-avx-detect Do NOT attempt to probe the system's AVX capability for build flags.
--no-1.3-archive-compat Disable compatibility with compressed archives created with Pcompress
version 1.3 (default: retain compatibility). Hash formats changed from
version 1.3 to 1.4 so this option is required if files created using
1.3 need to be decompressed by version 1.4 onwards.
--limit-key128 Limit key length to 128-bit encryption keys. Otherwise the default is to
use 256-bit keys changeable at runtime via the '-k <keylen>' option.
--help Display this help message.
_EOF
exit 0
}
arg1=$1
debug=0
allocator=1
debug_stats=0
prefix=/usr
if [ "$my_license" = "LGPLv3" ]
then
libbsc_dir=./bsc
libbsc_lib=${libbsc_dir}/libbsc.a
libbsclflags='\$\(LIBBSCLFLAGS\)'
libbscwrapobj='\$\(LIBBSCWRAPOBJ\)'
libbscgenopt='\$\(LIBBSCGEN_OPT\)'
libbsccppflags='\$\(LIBBSCCPPFLAGS\)'
fi
openssl_prefix=
openssl_libdir=
openssl_incdir=
libbz2_libdir=
libz_libdir=
sha256asmobjs=
sha256objs=
keylen=
yasm=yasm
yasm_params_linux="-f x64 -f elf64 -X gnu -g dwarf2 -D LINUX"
yasm_params_osx="-f macho64 --prefix=_"
yasm_params_gas_osx="-f macho64 -X gnu -p gas --prefix=_"
yasm_params_gas=
keccak_srcs=
keccak_hdrs=
keccak_srcs_asm=
extra_opt_flags=
zlib_prefix=
bzlib_prefix=
sse_detect=1
avx_detect=1
sse_opt_flags="-msse2"
crypto_compat_objs='\$\(CRYPTO_COMPAT_OBJS\)'
crypto_compat_flags="-D__HASH_COMPATIBILITY_"
salsa20_stream_c=
salsa20_stream_asm='\$\(XSALSA20_STREAM_ASM\)'
salsa20_debug=
so_suffix=so
crypto_asm_compile='\$\(CRYPTO_ASM_COMPILE1\)'
use_clang_as=
soname_opt="soname,"
rpath="-R"
dtag_val=',--enable-new-dtags'
lrt="-lrt"
default_opt="O3"
max_opt="O3"
libarchive_dir="archive/libarchive"
enable_wavpack="-D_ENABLE_WAVPACK_"
wavpack_libspec=""
if [ -x /bin/echo ]
then
ECHO=/bin/echo
elif [ -x /usr/bin/echo ]
then
ECHO=/usr/bin/echo
fi
if [ "x$GCC" = "x" ]
then
GCC=gcc
fi
if [ "x$GPP" = "x" ]
then
GPP=g++
fi
if [ "x$GXX" != "x" ]
then
GPP="${GXX}"
fi
rm -rf ./buildtmp
mkdir ./buildtmp
echo "Checking for GCC ..."
# Try a simple compilation
cat << _EOF > tst.c
#include <stdio.h>
int
main(void)
{
long l;
printf("%lu\n", sizeof (l));
return (0);
}
_EOF
${GCC} tst.c -o tst
if [ $? -ne 0 ]
then
echo "ERROR:"
echo "Cannot compile a simple program. GCC 4.4 and above is required"
echo "to build this program. Please include installation bindir of GCC in the PATH."
echo ""
rm -f tst.c
exit 1
fi
# Check bitness of system/toolchain
echo "Checking for 32-bit/64-bit platform ..."
bitness=`./tst`
if [ $bitness -lt 8 ]
then
# Hmmm maybe default compilation is 32-bit. Re-try with m64 flag.
${GCC} -m64 tst.c -o tst
if [ $? -ne 0 ]
then
rm -f tst tst.c
echo "ERROR:"
echo "Only 64-bit platforms are supported."
echo ""
exit 1
fi
# If m64 compilation succeeds we assume platform to be 64-bit capable but
# explicit flag is reqd.
extra_opt_flags="-m64"
fi
rm -f tst tst.c
while [ "${arg1}" != "" ]
do
case "$arg1" in
--enable-debug) debug=1;;
--disable-allocator) allocator=0;;
--enable-debug-stats) debug_stats=1;;
--prefix=*)
pval=`echo ${arg1} | cut -f2 -d"="`
prefix=$pval
;;
--with-openssl=*)
openssl_prefix=`echo ${arg1} | cut -f2 -d"="`
;;
--with-zlib=*)
zlib_prefix=`echo ${arg1} | cut -f2 -d"="`
;;
--with-bzlib=*)
bzlib_prefix=`echo ${arg1} | cut -f2 -d"="`
;;
--with-external-libbsc=*)
libbsc_dir=`echo ${arg1} | cut -f2 -d"="`
libbsc_lib=${libbsc_dir}/libbsc.a
libbsclflags='\$\(LIBBSCLFLAGS\)'
libbscwrapobj='\$\(LIBBSCWRAPOBJ\)'
libbscgenopt='\$\(LIBBSCGEN_OPT\)'
libbsccppflags='\$\(LIBBSCCPPFLAGS\)'
;;
--wavpack-dir=*)
wavpack_dir=`echo ${arg1} | cut -f2 -d"="`
wavpack_libspec="-L${wavpack_dir}/src/.libs -lwavpack"
;;
--disable-wavpack)
enable_wavpack=""
wavpack_libspec=""
;;
--use-key256)
keylen='-DDEFAULT_KEYLEN=16'
;;
--no-sse-detect)
sse_detect=0
avx_detect=0
;;
--no-avx-detect)
avx_detect=0
;;
--no-1.3-archive-compat)
crypto_compat_objs=""
crypto_compat_flags=""
;;
--help) usage $0;;
*)
echo "Unrecognized option: ${arg1}"
exit 1
;;
esac
shift
arg1=$1
done
if [ "x${enable_wavpack}" != "x" -a "x${wavpack_dir}" = "x" ]
then
echo "--wavpack-dir not specified. Please specify path of wavpack source tree,"
echo "or use --disable-wavpack to disable the wavpack filter."
exit 1
fi
if [ $debug -eq 1 ]
then
typ="DEBUG"
salsa20_stream_c='\$\(XSALSA20_STREAM_C\)'
salsa20_stream_asm=
salsa20_debug='\$\(XSALSA20_DEBUG\)'
extra_opt_flags="${extra_opt_flags} -fno-inline"
else
typ="RELEASE"
fi
echo "Checking OS ..."
OS=$(uname)
skeinblock='\$\(SKEIN_BLOCK_C\)'
if [ "$OS" = "Linux" ]
then
plat=$(uname -m)
elif [ "$OS" = "Darwin" ]
then
plat=$(uname -m)
so_suffix=dylib
elif [ "$OS" = "SunOS" ]
then
plat=$(isainfo -v)
else
echo "Unsupported OS: $OS"
exit 1
fi
# Check GCC version
echo "Checking GCC version ..."
vers=`${GCC} -dumpversion`
OIFS="$IFS"
IFS=.
set -- ${vers}
IFS="$OIFS"
if [ $1 -lt 4 ] || [ $1 -eq 4 -a $2 -lt 4 ]
then
echo "ERROR:"
echo "GCC version 4.4 or above is required."
echo ""
exit 1
fi
if [ $sse_detect -eq 1 ]
then
${GCC} -o sse_level ./utils/sse_level.c ./utils/cpuid.c -I./utils
if [ $? -ne 0 ]
then
echo "ERROR:"
echo "Failed to build SSE detection utility."
echo ""
exit 1
fi
fi
if [ $sse_detect -eq 1 ]
then
# SSE Detection
${ECHO} -n "Checking for CPU SSE version ... "
sse_ver=`./sse_level`
if [ $? -ne 0 ]
then
rm -f sse_level
echo "ERROR:"
echo "SSE version detection utility. Try configuring with --no-sse-check option."
echo ""
exit 1
fi
echo $sse_ver
sse_opt_flags="-m${sse_ver}"
fi
if [ $avx_detect -eq 1 -a $sse_detect -eq 1 ]
then
${ECHO} -n "Checking for CPU AVX version ... "
avx_ver=`./sse_level --avx`
if [ $? -ne 0 ]
then
rm -f sse_level
echo "ERROR:"
echo "SSE/AVX version detection utility. Try configuring with --no-sse-check option."
echo ""
exit 1
fi
if [ "x$avx_ver" = "x" ]
then
echo None
else
echo $avx_ver
sse_opt_flags="${sse_opt_flags} -m${avx_ver}"
fi
fi
rm -f sse_level
echo $plat | egrep 'x86_64|amd64' > /dev/null
if [ $? -eq 0 ]
then
if [ "$OS" != "Darwin" ]
then
skeinblock='\$\(SKEIN_BLOCK_ASM\)'
fi
yasm=
#
# Detect Yasm
#
echo "Checking for Yasm ..."
for bindir in /bin /usr/bin /usr/local/bin
do
if [ -x ${bindir}/yasm ]
then
# Get yasm version
yver=`${bindir}/yasm --version | head -1 | awk '{print $2}'`
_OIFS=$IFS; IFS="."; set -- ${yver}; IFS="$_OIFS"
major=$1
minor=$2
# Minimum yasm version 1.1
[ $major -lt 1 -o $minor -lt 1 ] && continue
yasm=${bindir}/yasm
sha256asmobjs='\$\(SHA2ASM_OBJS\)'
sha256objs='\$\(SHA2_OBJS\)'
fi
done
if [ "x${yasm}" = "x" ]
then
echo "Yasm version 1.1 or later is required to build on x64 platforms"
exit 1
fi
if [ "$OS" = "Linux" ]
then
yasm="${yasm} ${yasm_params_linux}"
elif [ "$OS" = "Darwin" ]
then
yasm="${yasm} ${yasm_params_osx}"
yasm_params_gas="${yasm} ${yasm_params_gas_osx}"
elif [ "$OS" = "SunOS" ]
then
yasm="${yasm} ${yasm_params_linux}"
fi
if [ $debug -eq 1 ]
then
keccak_srcs='\$\(KECCAK_SRC_OPT64\)'
keccak_hdrs='\$\(KECCAK_HDRS_OPT64\)'
else
keccak_srcs='\$\(KECCAK_SRC_OPT64_ASM1\)'
if [ "$OS" != "Darwin" ]
then
keccak_srcs_asm='\$\(KECCAK_SRC_OPT64_ASM2\)'
else
keccak_srcs_asm='\$\(KECCAK_SRC_OPT64_ASM3\)'
fi
keccak_hdrs='\$\(KECCAK_HDRS_OPT64_ASM\)'
fi
else
keccak_srcs='\$\(KECCAK_SRC_OPT64\)'
fi
if [ "$OS" = "Darwin" ]
then
crypto_asm_compile='\$\(CRYPTO_ASM_COMPILE2\)'
use_clang_as="-Wa,-q"
soname_opt="install_name,"
rpath="-rpath,"
dtag_val=""
lrt="-liconv"
max_opt="O2"
fi
# Detect OpenSSL library
echo "Checking for OpenSSL ..."
for lib in "${openssl_prefix}/lib64" "${openssl_prefix}/usr/lib64" \
"${openssl_prefix}/lib" "${openssl_prefix}/usr/lib" \
"${openssl_prefix}/ssl/lib64" "${openssl_prefix}/ssl/lib" \
"${openssl_prefix}/lib/x86_64-linux-gnu" \
"${openssl_prefix}/usr/lib/x86_64-linux-gnu"
do
if [ -d ${lib} ]
then
if [ -f "${lib}/libcrypto.${so_suffix}" -o -h "${lib}/libcrypto.${so_suffix}" ]
then
openssl_libdir="${lib}"
(cd ./buildtmp; ln -s ${openssl_libdir}/libcrypto.${so_suffix})
break
else
if [ -f "${lib}/libcrypto.a" ]
then
openssl_libdir="${lib}"
(cd ./buildtmp; ln -s ${openssl_libdir}/libcrypto.a)
break
fi
fi
fi
done
if [ "x${openssl_libdir}" = "x" ]
then
echo "ERROR: OpenSSL libraries not detected."
exit 1
fi
# Detect OpenSSL headers
for inc in "${openssl_prefix}/include" \
"${openssl_prefix}/usr/include" \
"${openssl_prefix}/ssl/include"
do
if [ -d ${inc} ]
then
if [ -f "${inc}/openssl/sha.h" ]
then
openssl_incdir=${inc}
break
fi
fi
done
if [ "x${openssl_incdir}" = "x" ]
then
echo "ERROR: OpenSSL header files not detected."
if [ "x${openssl_prefix}" = "x" ]
then
echo "Depending on your system you may need to install the openssl-devel or openssl-dev package."
fi
exit 1
fi
# Check for OpenSSL version
echo "Checking OpenSSL version ..."
cat << __EOF > tst.c
#include <stdlib.h>
#include <openssl/opensslv.h>
int
main(void)
{
if (OPENSSL_VERSION_NUMBER < 0x0090805fL)
exit (1);
return (0);
}
__EOF
${GCC} ${extra_opt_flags} -I${openssl_incdir} -L${openssl_libdir} tst.c -o tst
if [ $? -ne 0 ]
then
echo "Unable to compile OpenSSL test program please check OpenSSL installation."
exit 1
fi
./tst
if [ $? -ne 0 ]
then
echo "OpenSSL version too old. At least version 0.9.8e is required."
echo
exit 1
fi
# Check for HMAC_CTX_copy function
${ECHO} -n "Checking if the OpenSSL library provides HMAC_CTX_copy function ... "
cat << __EOF > tst.c
#include <stdlib.h>
#include <openssl/sha.h>
#include <openssl/rand.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
int
main(void)
{
unsigned char key[16];
HMAC_CTX *ctx = (HMAC_CTX *)malloc(sizeof (HMAC_CTX));
HMAC_CTX *ctx1 = (HMAC_CTX *)malloc(sizeof (HMAC_CTX));
HMAC_CTX_init(ctx);
HMAC_Init_ex(ctx, key, 16, EVP_sha256(), NULL);
HMAC_CTX_copy(ctx1, ctx);
return (0);
}
__EOF
${GCC} ${extra_opt_flags} -I${openssl_incdir} -L${openssl_libdir} -O0 -g tst.c -o tst -lcrypto >/dev/null 2>&1
if [ $? -ne 0 ]
then
openssl_incdir="${openssl_incdir} -D__OSSL_OLD__"
echo "No. Using internal variant."
else
echo "Yes."
fi
rm -rf tst*
openssl_libdir="${openssl_libdir}${dtag_val}"
# Detect other library packages
for libspec in "libbz2:${bzlib_prefix}" "libz:${zlib_prefix}"
do
_OIFS="$IFS"
IFS=":"
set -- ${libspec}
libname=$1
pref=$2
IFS="$_OIFS"
echo "Checking for $libname ..."
use_prefix="${pref}"
if [ "x${pref}" = "x" ]
then
use_prefix="$prefix"
fi
for lib in "${pref}/lib64" "${pref}/usr/lib64" "${pref}/lib" "${pref}/usr/lib" \
"${pref}/lib/x86_64-linux-gnu" "${pref}/usr/lib/x86_64-linux-gnu" \
"${pref}/local/lib64" "${pref}/usr/local/lib64" "${pref}/local/lib" "${pref}/usr/local/lib" \
"${pref}/local/lib/x86_64-linux-gnu" "${pref}/usr/local/lib/x86_64-linux-gnu" \
"${use_prefix}/lib64" "${use_prefix}/lib" "${use_prefix}/lib/x86_64-linux-gnu" \
"${use_prefix}/usr/lib/x86_64-linux-gnu" "${use_prefix}/.libs" "${use_prefix}"
do
if [ -d ${lib} ]
then
if [ -f "${lib}/${libname}.${so_suffix}" -o -h "${lib}/${libname}.${so_suffix}" ]
then
eval "${libname}_libdir=${lib}${dtag_val}"
(cd ./buildtmp; ln -s ${lib}/${libname}.${so_suffix})
break
else
if [ -f "${lib}/${libname}.a" ]
then
eval "${libname}_libdir=${lib}${dtag_val}"
(cd ./buildtmp; ln -s ${lib}/${libname}.a)
break
fi
fi
fi
done
done
if [ "x${libbz2_libdir}" = "x" ]
then
if [ "x$bzlib_prefix" = "x" ]
then
echo "ERROR: Libbz2 not detected."
echo " You may have to install libbz2-devel or libbz2-dev"
else
echo "ERROR: Bzip2 library not detected in given prefix."
fi
exit 1
fi
if [ "x${libz_libdir}" = "x" ]
then
if [ "x$zlib_prefix" = "x" ]
then
echo "ERROR: Zlib not detected."
echo " You may have to install libz-devel or libz-dev"
else
echo "ERROR: Zlib not detected in given prefix."
fi
exit 1
fi
libbz2_inc=
libz_inc=
# Detect other library headers
for hdr in "libbz2_inc:bzlib.h:${bzlib_prefix}" "libz_inc:zlib.h:${zlib_prefix}"
do
_OIFS="$IFS"
IFS=":"
set -- ${hdr}
var=$1
hdrf=$2
pref=$3
IFS="$_OIFS"
echo "Checking for $hdrf ..."
use_prefix="${pref}"
if [ "x${pref}" = "x" ]
then
use_prefix="$prefix"
fi
found=0
for inc in "${pref}/include" "${pref}/usr/include" \
"${pref}/local/include" "${pref}/usr/local/include" \
"${use_prefix}/include" "${use_prefix}/usr/include" \
"${use_prefix}"
do
if [ -d ${inc} ]
then
if [ -f "${inc}/${hdrf}" ]
then
eval "${var}=\"-I${inc}\""
found=1
break
fi
fi
done
if [ $found -ne 1 ]
then
echo "Cannot find header $hdrf"
exit 1
fi
done
echo "Generating Makefile ..."
linkvar="LINK"
compilevar="COMPILE"
compilecppvar="COMPILE_cpp"
vecflagsvar="VEC_FLAGS"
loopoptflagsvar="LOOP_OPTFLAGS"
cppflagsvar="CPPFLAGS"
genoptvar="GEN_OPT"
noslabcppflagsvar="NO_SLAB_CPPFLAGS"
debugstatscppflagsvar="DEBUG_STATS_CPPFLAGS"
prefixvar="PREFIX"
skeinblockvar="SKEIN_BLOCK"
keylenvar="KEYLEN"
libbscdirvar="LIBBSCDIR"
libbsclibvar="LIBBSCLIB"
libbsclflagsvar="LIBBSCLFLAGS"
libbscwrapobjvar="LIBBSCWRAPOBJ"
libbscgenoptvar="LIBBSCGEN_OPT"
libbsccppflagsvar="LIBBSCCPPFLAGS"
sha256asmobjsvar="SHA2ASM_OBJS"
sha256objsvar="SHA2_OBJS"
yasmvar="YASM"
fptr_flag_var="FPTR_FLAG"
extra_opt_flags_var="EXTRA_OPT_FLAGS"
sse_opt_flags_var="SSE_OPT_FLAGS"
openssllibdirvar="OPENSSL_LIBDIR"
opensslincdirvar="OPENSSL_INCDIR"
libbz2libdirvar="LIBBZ2_DIR"
libzlibdirvar="LIBZ_DIR"
libbz2incvar="LIBBZ2_INC"
libzincvar="LIBZ_INC"
keccak_srcs_var="KECCAK_SRCS"
keccak_hdrs_var="KECCAK_HDRS"
keccak_srcs_asm_var="KECCAK_SRCS_ASM"
crypto_compat_objs_var="CRYPTO_COMPAT_OBJS"
crypto_compat_flags_var="COMPAT_CPPFLAGS"
salsa20_stream_c_var="XSALSA20_STREAM_C"
salsa20_stream_asm_var="XSALSA20_STREAM_ASM"
salsa20_debug_var="XSALSA20_DEBUG"
noslabcppflagsval=
debugstatscppflagsval=
[ $allocator -eq 0 ] && noslabcppflagsval='\$\(NO_SLAB_CPPFLAGS\)'
[ $debug_stats -eq 1 ] && debugstatscppflagsval='\$\(DEBUG_STATS_CPPFLAGS\)'
echo "*************** Running configure in libarchive ****************"
(cd $libarchive_dir
CC=${GCC} ./configure --disable-bsdtar --disable-bsdcpio --without-zlib --without-bz2lib --without-lzmadec --without-lzma --without-lzo2 --without-nettle --without-openssl --without-xml2 --without-expat --disable-silent-rules --enable-shared=no --enable-static=yes --enable-xattr --with-pic
[ $? -ne 0 ] && exit $?
cat Makefile | sed '
s@$(BUILT_SOURCES)@@
s@$(libarchive_test_SOURCES)@@
s@$(libarchive_man_MANS)@@
' > Makefile.new
mv Makefile.new Makefile
)
if [ $? -ne 0 ]
then
echo "********* Configure in internal libarchive failed!"
exit 1
fi
echo "*************** Finished configure in libarchive ****************"
if [ "x${wavpack_dir}" != "x" ]
then
echo "*************** Running configure in WavPack ****************"
(cd $wavpack_dir
CC=${GCC} ./configure --enable-static=yes --enable-shared=no --with-pic
if [ $? -ne 0 ]
then
exit 1
fi
)
if [ $? -ne 0 ]
then
echo "********* Configure in WavPack dir failed!"
exit 1
fi
echo "*************** Finished configure in WacPack ****************"
fi
cat Makefile.in | sed "
s#@GCC@#${GCC}#g
s#@GPP@#${GPP}#g
s#@CRYPTO_ASM_COMPILE@#${crypto_asm_compile}#g
s#@USE_CLANG_AS@#${use_clang_as}#g
s#@SO_SUFFIX@#${so_suffix}#g
s#@YASM_GAS@#${yasm_params_gas}#g
s#@RPATH@#${rpath}#g
s#@LRT@#${lrt}#g
s#@LIBARCHIVE_DIR@#${libarchive_dir}#g
s#soname#${soname_opt}#g
s#${default_opt}#${max_opt}#g
s#@DTAGS@#${dtag_val}#g
s#@${linkvar}@#\\\$\\(${typ}_${linkvar}\\)#g
s#@${compilevar}@#\\\$\\(${typ}_${compilevar}\\)#g
s#@${compilecppvar}@#\\\$\\(${typ}_${compilecppvar}\\)#g
s#@${vecflagsvar}@#\\\$\\(${typ}_${vecflagsvar}\\)#g
s#@${loopoptflagsvar}@#\\\$\\(${typ}_${loopoptflagsvar}\\)#g
s#@${cppflagsvar}@#\\\$\\(${typ}_${cppflagsvar}\\)#g
s#@${genoptvar}@#\\\$\\(${typ}_${genoptvar}\\)#g
s#@${fptr_flag_var}@#\\\$\\(${typ}_${fptr_flag_var}\\)#g
s#@${noslabcppflagsvar}@#${noslabcppflagsval}#g
s#@${debugstatscppflagsvar}@#${debugstatscppflagsval}#g
s#@${prefixvar}@#${prefix}#g
s#@${libbscdirvar}@#${libbsc_dir}#g
s#@${libbsclibvar}@#${libbsc_lib}#g
s#@${libbsclflagsvar}@#${libbsclflags}#g
s#@${libbscwrapobjvar}@#${libbscwrapobj}#g
s#@${libbscgenoptvar}@#${libbscgenopt}#g
s#@${libbsccppflagsvar}@#${libbsccppflags}#g
s#@${skeinblockvar}@#${skeinblock}#g
s#@${openssllibdirvar}@#${openssl_libdir}#g
s#@${opensslincdirvar}@#${openssl_incdir}#g
s#@${sha256asmobjsvar}@#${sha256asmobjs}#g
s#@${sha256objsvar}@#${sha256objs}#g
s#@${yasmvar}@#${yasm}#g
s#@${keylenvar}@#${keylen}#g
s#@${libbz2libdirvar}@#${libbz2_libdir}#g
s#@${libzlibdirvar}@#${libz_libdir}#g
s#@${libbz2incvar}@#${libbz2_inc}#g
s#@${libzincvar}@#${libz_inc}#g
s#@${keccak_srcs_var}@#${keccak_srcs}#g
s#@${keccak_hdrs_var}@#${keccak_hdrs}#g
s#@${keccak_srcs_var}@#${keccak_srcs}#g
s#@${keccak_srcs_asm_var}@#${keccak_srcs_asm}#g
s#@${extra_opt_flags_var}@#${extra_opt_flags}#g
s#@${sse_opt_flags_var}@#${sse_opt_flags}#g
s#@${crypto_compat_objs_var}@#${crypto_compat_objs}#g
s#@${crypto_compat_flags_var}@#${crypto_compat_flags}#g
s#@${salsa20_stream_c_var}@#${salsa20_stream_c}#g
s#@${salsa20_stream_asm_var}@#${salsa20_stream_asm}#g
s#@${salsa20_debug_var}@#${salsa20_debug}#g
s#@ENABLE_WAVPACK@#${enable_wavpack}#g
s#@WAVPACK_LIBSPEC@#${wavpack_libspec}#g
s#@WAVPACK_DIR@#${wavpack_dir}#g
" > Makefile
if [ "x${enable_wavpack}" = "x" ]
then
sed -i -e '/^WAVPKSRCS/ D' -e '/^WAVPKOBJS/ D' Makefile
fi