Debian Codegraph @

ext/zlib-ng/configure

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # configure script for zlib.
3 #
4 # Normally configure builds both a static and a shared library.
5 # If you want to build just a static library, use: ./configure --static
6 #
7 # To impose specific compiler or flags or install directory, use for example:
8 # prefix=$HOME CC=cc CFLAGS="-O4" ./configure
9 # or for csh/tcsh users:
10 # (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
11
12 # Incorrect settings of CC or CFLAGS may prevent creating a shared library.
13 # If you have problems, try without defining CC and CFLAGS before reporting
14 # an error.
15
16 # start off configure.log
17 echoscip-shell system . . echo. -------------------- >> configure.log
18 echoscip-shell system . . echo. $0 $* >> configure.log
19 datescip-shell system . . date. >> configure.log
20
21 SRCDIR=$(cd $(dirnamescip-shell system . . dirname. $0); pwdscip-shell system . . pwd.)
22 BUILDDIR=$(pwdscip-shell system . . pwd.)
23
24 # set command prefix for cross-compilation
25 if [scip-shell system . . `[`. -n "${CHOST}" ]; then
26 # normalize the chost before parsing it
27 NORM_CHOST=$(shscip-shell system . . sh. "$SRCDIR"/tools/config.sub $CHOST)
28 uname="$(echoscip-shell system . . echo. "${NORM_CHOST}" | sedscip-shell system . . sed. -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/')"
29 CROSS_PREFIX="${CHOST}-"
30 ARCH="$(echoscip-shell system . . echo. "${NORM_CHOST}" | sedscip-shell system . . sed. -e 's/-.*//')"
31 else
32 ARCH="$(unamescip-shell system . . uname. -m)"
33 fi
34
35 case "${ARCH}" in
36 x86_64)
37 case "${CFLAGS}" in
38 *-m32*)
39 ARCH=i686
40 ;;
41 esac
42 ;;
43 i386 | i486 | i586 | i686)
44 case "${CFLAGS}" in
45 *-m64*)
46 ARCH=x86_64
47 ;;
48 esac
49 ;;
50 esac
51
52 # destination name for windows import library
53 IMPORTLIB=
54
55 # establish commands for library building
56 if "${CROSS_PREFIX}ar" --version >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`. || testscip-shell system . . test. $? -lt 126; then
57 AR=${AR-"${CROSS_PREFIX}ar"}
58 testscip-shell system . . test. -n "${CROSS_PREFIX}" && echoscip-shell system . . echo. Using ${AR} | teescip-shell system . . tee. -a configure.log
59 else
60 AR=${AR-"ar"}
61 testscip-shell system . . test. -n "${CROSS_PREFIX}" && echoscip-shell system . . echo. Using ${AR} | teescip-shell system . . tee. -a configure.log
62 fi
63 ARFLAGS=${ARFLAGS-"rc"}
64 if "${CROSS_PREFIX}ranlib" --version >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`. || testscip-shell system . . test. $? -lt 126; then
65 RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
66 testscip-shell system . . test. -n "${CROSS_PREFIX}" && echoscip-shell system . . echo. Using ${RANLIB} | teescip-shell system . . tee. -a configure.log
67 else
68 RANLIB=${RANLIB-"ranlib"}
69 fi
70
71 # set defaults before processing command line options
72 LDCONFIG=${LDCONFIG-"ldconfig"}
73 DEFFILE=
74 RC=
75 RCFLAGS=
76 RCOBJS=
77 STRIP=
78 ARCHS=
79 prefix=${prefix-/usr/local}
80 exec_prefix=${exec_prefix-'${prefix}'}
81 bindir=${bindir-'${exec_prefix}/bin'}
82 libdir=${libdir-'${exec_prefix}/lib'}
83 sharedlibdir=${sharedlibdir-'${libdir}'}
84 includedir=${includedir-'${prefix}/include'}
85 mandir=${mandir-'${prefix}/share/man'}
86 shared_ext='.so'
87 shared=1
88 gzfileops=1
89 unalignedok=1
90 compat=0
91 cover=0
92 build32=0
93 build64=0
94 buildvpclmulqdq=1
95 buildacle=1
96 buildaltivec=1
97 buildpower8=1
98 buildpower9=1
99 buildneon=1
100 builddfltccdeflate=0
101 builddfltccinflate=0
102 buildcrc32vx=1
103 floatabi=
104 native=0
105 forcesse2=0
106 forcetzcnt=0
107 # For CPUs that can benefit from AVX512, it seems GCC generates suboptimal
108 # instruction scheduling unless you specify a reasonable -mtune= target
109 avx512flag="-mavx512f -mavx512dq -mavx512bw -mavx512vl -mtune=cascadelake"
110 avx512vnniflag="-mavx512vnni ${avx512flag}"
111 avx2flag="-mavx2"
112 sse2flag="-msse2"
113 ssse3flag="-mssse3"
114 sse41flag="-msse4.1"
115 sse42flag="-msse4.2"
116 pclmulflag="-mpclmul"
117 vpclmulflag="-mvpclmulqdq"
118 acleflag=
119 neonflag=
120 noltoflag="-fno-lto"
121 vgfmaflag="-march=z13"
122 vmxflag="-maltivec"
123 symbol_prefix=""
124 without_optimizations=0
125 without_new_strategies=0
126 reducedmem=0
127 gcc=0
128 warn=0
129 debug=0
130 old_cc="$CC"
131 old_cflags="$CFLAGS"
132 OBJC='$(OBJZ)'
133 PIC_OBJC='$(PIC_OBJZ)'
134 INSTALLTARGETS="install-shared install-static"
135 UNINSTALLTARGETS="uninstall-shared uninstall-static"
136
137 TEST="teststatic"
138
139 # leave this script, optionally in a bad way
140 leavescip-shell shell shell-project 0.0.0 leave().()
141 {
142 if testscip-shell system . . test. "$*" != "0"; then
143 echoscip-shell system . . echo. "** $0 aborting." | teescip-shell system . . tee. -a configure.log
144 fi
145 rmscip-shell system . . rm. -f $test.[co] $test $test$shared_ext $test.gcno ./--version
146 echoscip-shell system . . echo. -------------------- >> configure.log
147 echoscip-shell system . . echo. >> configure.log
148 echoscip-shell system . . echo. >> configure.log
149 exit $1
150 }
151
152 # process command line options
153 while testscip-shell system . . test. $# -ge 1
154 do
155 case "$1" in
156 -h* | --help)
157 echoscip-shell system . . echo. 'usage:' | teescip-shell system . . tee. -a configure.log
158 echoscip-shell system . . echo. ' configure [--prefix=PREFIX] [--eprefix=EXPREFIX]' | teescip-shell system . . tee. -a configure.log
159 echoscip-shell system . . echo. ' [--static] [--32] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | teescip-shell system . . tee. -a configure.log
160 echoscip-shell system . . echo. ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | teescip-shell system . . tee. -a configure.log
161 echoscip-shell system . . echo. ' [--sprefix=SYMBOL_PREFIX] Adds a prefix to all exported symbols' | teescip-shell system . . tee. -a configure.log
162 echoscip-shell system . . echo. ' [--warn] Enables extra compiler warnings' | teescip-shell system . . tee. -a configure.log
163 echoscip-shell system . . echo. ' [--debug] Enables extra debug prints during operation' | teescip-shell system . . tee. -a configure.log
164 echoscip-shell system . . echo. ' [--zlib-compat] Compiles for zlib-compatible API instead of zlib-ng API' | teescip-shell system . . tee. -a configure.log
165 echoscip-shell system . . echo. ' [--without-unaligned] Compiles without fast unaligned access' | teescip-shell system . . tee. -a configure.log
166 echoscip-shell system . . echo. ' [--without-gzfileops] Compiles without the gzfile parts of the API enabled' | teescip-shell system . . tee. -a configure.log
167 echoscip-shell system . . echo. ' [--without-optimizations] Compiles without support for optional instruction sets' | teescip-shell system . . tee. -a configure.log
168 echoscip-shell system . . echo. ' [--without-new-strategies] Compiles without using new additional deflate strategies' | teescip-shell system . . tee. -a configure.log
169 echoscip-shell system . . echo. ' [--without-acle] Compiles without ARM C Language Extensions' | teescip-shell system . . tee. -a configure.log
170 echoscip-shell system . . echo. ' [--without-neon] Compiles without ARM Neon SIMD instruction set' | teescip-shell system . . tee. -a configure.log
171 echoscip-shell system . . echo. ' [--without-altivec] Compiles without PPC AltiVec support' | teescip-shell system . . tee. -a configure.log
172 echoscip-shell system . . echo. ' [--without-power8] Compiles without Power8 instruction set' | teescip-shell system . . tee. -a configure.log
173 echoscip-shell system . . echo. ' [--with-dfltcc-deflate] Use DEFLATE CONVERSION CALL instruction for compression on IBM Z' | teescip-shell system . . tee. -a configure.log
174 echoscip-shell system . . echo. ' [--with-dfltcc-inflate] Use DEFLATE CONVERSION CALL instruction for decompression on IBM Z' | teescip-shell system . . tee. -a configure.log
175 echoscip-shell system . . echo. ' [--without-crc32-vx] Build without vectorized CRC32 on IBM Z' | teescip-shell system . . tee. -a configure.log
176 echoscip-shell system . . echo. ' [--with-reduced-mem] Reduced memory usage for special cases (reduces performance)' | teescip-shell system . . tee. -a configure.log
177 echoscip-shell system . . echo. ' [--force-sse2] Assume SSE2 instructions are always available (disabled by default on x86, enabled on x86_64)' | teescip-shell system . . tee. -a configure.log
178 echoscip-shell system . . echo. ' [--force-tzcnt] Assume TZCNT instructions are always available (disabled by default)' | teescip-shell system . . tee. -a configure.log
179 echoscip-shell system . . echo. ' [--native] Compiles with full instruction set supported on this host' | teescip-shell system . . tee. -a configure.log
180 exit 0 ;;
181 -p*=* | --prefix=*) prefix=$(echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'); shift ;;
182 -e*=* | --eprefix=*) exec_prefix=$(echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'); shift ;;
183 -m*=* | --sprefix=*) symbol_prefix=$(echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'); shift ;;
184 -l*=* | --libdir=*) libdir=$(echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'); shift ;;
185 --sharedlibdir=*) sharedlibdir=$(echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'); shift ;;
186 -i*=* | --includedir=*) includedir=$(echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//');shift ;;
187 -u*=* | --uname=*) uname=$(echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//');shift ;;
188 -p* | --prefix) prefix="$2"; shift; shift ;;
189 -e* | --eprefix) exec_prefix="$2"; shift; shift ;;
190 -m* | --sprefix) symbol_prefix="$2"; shift; shift ;;
191 -l* | --libdir) libdir="$2"; shift; shift ;;
192 -i* | --includedir) includedir="$2"; shift; shift ;;
193 -s* | --shared | --enable-shared) shared=1; shift ;;
194 -t | --static) shared=0; shift ;;
195 --zlib-compat) compat=1; shift ;;
196 --without-unaligned) unalignedok=0; shift ;;
197 --without-gzfileops) gzfileops=0; shift ;;
198 --cover) cover=1; shift ;;
199 -3* | --32) build32=1; shift ;;
200 -6* | --64) build64=1; shift ;;
201 --without-vpclmulqdq) buildvpclmulqdq=0; shift ;;
202 --without-acle) buildacle=0; shift ;;
203 --without-neon) buildneon=0; shift ;;
204 --without-altivec) buildaltivec=0 ; shift ;;
205 --without-power8) buildpower8=0 ; shift ;;
206 --without-power9) buildpower9=0 ; shift ;;
207 --with-dfltcc-deflate) builddfltccdeflate=1; shift ;;
208 --with-dfltcc-inflate) builddfltccinflate=1; shift ;;
209 --without-crc32-vx) buildcrc32vx=0; shift ;;
210 --with-reduced-mem) reducedmem=1; shift ;;
211 --force-sse2) forcesse2=1; shift ;;
212 --force-tzcnt) forcetzcnt=1; shift ;;
213 -n | --native) native=1; shift ;;
214 -a*=* | --archs=*) ARCHS=$(echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'); shift ;;
215 --sysconfdir=*) echoscip-shell system . . echo. "ignored option: --sysconfdir" | teescip-shell system . . tee. -a configure.log; shift ;;
216 --localstatedir=*) echoscip-shell system . . echo. "ignored option: --localstatedir" | teescip-shell system . . tee. -a configure.log; shift ;;
217 -noopt | --without-optimizations) without_optimizations=1; shift;;
218 -oldstrat | --without-new-strategies) without_new_strategies=1; shift;;
219 -w* | --warn) warn=1; shift ;;
220 -d* | --debug) debug=1; shift ;;
221
222 *)
223 echoscip-shell system . . echo. "unknown option: $1" | teescip-shell system . . tee. -a configure.log
224 echoscip-shell system . . echo. "$0 --help for help" | teescip-shell system . . tee. -a configure.log
225 leavescip-shell shell shell-project 0.0.0 leave(). 1;;
226 esac
227 done
228
229 # temporary file name
230 test=ztest$$
231
232 # put arguments in log, also put test file in log if used in arguments
233 showscip-shell shell shell-project 0.0.0 show().()
234 {
235 case "$*" in
236 *$test.c*)
237 echoscip-shell system . . echo. "=== $test.c ===" >> configure.log
238 catscip-shell system . . cat. $test.c >> configure.log
239 echoscip-shell system . . echo. "===" >> configure.log;;
240 esac
241 echoscip-shell system . . echo. $* >> configure.log
242 }
243
244 # check for gcc vs. cc and set compile and link flags based on the system identified by uname
245 catscip-shell system . . cat. > $test.c <<EOF
246 extern int getchar();
247 int main() {return getchar();}
248 EOF
249
250 cc=${CC-${CROSS_PREFIX}gcc}
251 echoscip-shell system . . echo. -n "Checking for compiler... " | teescip-shell system . . tee. -a configure.log
252 case "$cc" in
253 *gcc*) gcc=1 ;;
254 *clang*) gcc=1 ;;
255 esac
256 case $($cc -v 2>&1) in
257 *gcc*) gcc=1 ;;
258 *clang*) gcc=1 ;;
259 esac
260
261 if testscip-shell system . . test. $native -eq 1; then
262 avx512flag=""
263 avx512vnniflag=""
264 avx2flag=""
265 sse2flag=""
266 ssse3flag=""
267 sse4flag=""
268 sse42flag=""
269 pclmulflag=""
270 vpclmulflag=""
271 noltoflag=""
272 fi
273
274 if testscip-shell system . . test. $build32 -eq 1; then
275 CFLAGS="${CFLAGS} -m32"
276 SFLAGS="${SFLAGS} -m32"
277 LDFLAGS="${LDFLAGS} -m32"
278 fi
279 if testscip-shell system . . test. $build64 -eq 1; then
280 CFLAGS="${CFLAGS} -m64"
281 SFLAGS="${SFLAGS} -m64"
282 LDFLAGS="${LDFLAGS} -m64"
283 fi
284
285 # Set library name depending on zlib-compat option
286 if testscip-shell system . . test. $compat -eq 0; then
287 LIBNAME=libz-ng
288 LIBNAME2=zlib-ng
289 SUFFIX=-ng
290 else
291 LIBNAME=libz
292 LIBNAME2=zlib
293 SUFFIX=""
294 fi
295
296 STATICLIB=${LIBNAME}.a
297 MAPNAME=${LIBNAME2}.map
298
299 # extract zlib version numbers from zlib.h
300 if testscip-shell system . . test. $compat -eq 0; then
301 VER=$(sedscip-shell system . . sed. -n -e '/ZLIBNG_VERSION "/s/.*"\(.*\)".*/\1/pscip-shell filesystem . . `/ZLIBNG_VERSION "/s/.*"\(.*\)".*/\1/p`.' < ${SRCDIR}/zlib-ng.h.in)
302 VER3=$(sedscip-shell system . . sed. -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/pscip-shell filesystem . . `/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p`.' < ${SRCDIR}/zlib-ng.h.in)
303 VER2=$(sedscip-shell system . . sed. -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/pscip-shell filesystem . . `/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/p`.' < ${SRCDIR}/zlib-ng.h.in)
304 VER1=$(sedscip-shell system . . sed. -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\)\..*/\1/pscip-shell filesystem . . `/ZLIBNG_VERSION "/s/.*"\([0-9]*\)\..*/\1/p`.' < ${SRCDIR}/zlib-ng.h.in)
305 else
306 VER=$(sedscip-shell system . . sed. -n -e '/ZLIB_VERSION "/s/.*"\(.*\)".*/\1/pscip-shell filesystem . . `/ZLIB_VERSION "/s/.*"\(.*\)".*/\1/p`.' < ${SRCDIR}/zlib.h.in)
307 VER3=$(sedscip-shell system . . sed. -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/pscip-shell filesystem . . `/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p`.' < ${SRCDIR}/zlib.h.in)
308 VER2=$(sedscip-shell system . . sed. -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/pscip-shell filesystem . . `/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/p`.' < ${SRCDIR}/zlib.h.in)
309 VER1=$(sedscip-shell system . . sed. -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\)\..*/\1/pscip-shell filesystem . . `/ZLIB_VERSION "/s/.*"\([0-9]*\)\..*/\1/p`.' < ${SRCDIR}/zlib.h.in)
310 fi
311
312 showscip-shell shell shell-project 0.0.0 show(). $cc -c $test.c
313 if testscip-shell system . . test. "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then
314 echoscip-shell system . . echo. "$cc" | teescip-shell system . . tee. -a configure.log
315 CC="$cc"
316 CFLAGS="${CFLAGS} -std=c11"
317
318 # Re-check ARCH if the compiler is a cross-compiler.
319 if $CC -print-multiarch 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && testscip-shell system . . test. -n "$($CC -print-multiarch)" 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
320 CC_ARCH=$($CC $CFLAGS -print-multiarch | sedscip-shell system . . sed. 's/-.*//g')
321 else
322 CC_ARCH=$($CC $CFLAGS -dumpmachine | sedscip-shell system . . sed. 's/-.*//g')
323 fi
324 case $CC_ARCH in
325 i386 | i486 | i586 | i686)
326 # Honor user choice if gcc is multilib and 64-bit is requested
327 if testscip-shell system . . test. $build64 -eq 1; then
328 ARCH=x86_64
329 else
330 ARCH=$CC_ARCH
331 fi ;;
332 x86_64)
333 # Honor user choice if gcc is multilib and 32-bit is requested
334 if testscip-shell system . . test. $build32 -ne 1; then
335 ARCH=$CC_ARCH
336 fi ;;
337 arm | armeb)
338 if testscip-shell system . . test. $native -eq 0; then
339 ARCH=arm
340 else
341 ARCH=native
342 fi
343 if testscip-shell system . . test. "${uname}" = "eabi"; then
344 # No ACLE support
345 uname=arm
346 if testscip-shell system . . test. $buildacle -eq 1; then
347 echoscip-shell system . . echo. ACLE support not available
348 buildacle=0
349 fi
350 fi
351 if testscip-shell system . . test. $buildacle -eq 1; then
352 if testscip-shell system . . test. $native -eq 0; then
353 ARCH=armv8-a+crc
354 fi
355 fi ;;
356 armv8l)
357 if testscip-shell system . . test. $native -eq 0; then
358 ARCH=armv8-a
359 else
360 ARCH=native
361 fi ;;
362 aarch64 | aarch64_be | arm64)
363 if testscip-shell system . . test. "${uname}" = "elf"; then
364 uname=aarch64
365 fi
366 if testscip-shell system . . test. $native -eq 0; then
367 ARCH=aarch64
368 else
369 ARCH=native
370 fi ;;
371 powerpc | ppc)
372 ARCH=powerpc ;;
373 powerpc64 | ppc64)
374 ARCH=powerpc64 ;;
375 powerpc64le | ppc64le)
376 ARCH=powerpc64le ;;
377 esac
378 CFLAGS="-O2 ${CFLAGS}"
379 if testscip-shell system . . test. -n "${ARCHS}"; then
380 CFLAGS="${CFLAGS} ${ARCHS}"
381 LDFLAGS="${LDFLAGS} ${ARCHS}"
382 fi
383 CFLAGS="${CFLAGS} -Wall"
384 SFLAGS="${CFLAGS} -fPIC"
385 if testscip-shell system . . test. $native -eq 1; then
386 case $ARCH in
387 powerpc*)
388 NATIVE_FLAG="-mcpu=native" ;;
389 *)
390 NATIVE_FLAG="-march=native" ;;
391 esac
392 CFLAGS="${CFLAGS} ${NATIVE_FLAG}"
393 SFLAGS="${SFLAGS} ${NATIVE_FLAG}"
394 fi
395 if testscip-shell system . . test. "$warn" -eq 1; then
396 CFLAGS="${CFLAGS} -Wextra -Wpedantic -Wno-implicit-fallthrough"
397 fi
398 if testscip-shell system . . test. $debug -eq 1; then
399 CFLAGS="${CFLAGS} -DZLIB_DEBUG"
400 SFLAGS="${SFLAGS} -DZLIB_DEBUG"
401 else
402 CFLAGS="${CFLAGS} -DNDEBUG"
403 SFLAGS="${SFLAGS} -DNDEBUG"
404 fi
405 if testscip-shell system . . test. -z "$uname"; then
406 uname=$((uname -s || echo unknown) 2>/dev/null)
407 fi
408 case "$uname" in
409 Linux* | linux* | GNU | GNU/* | solaris*)
410 LDSHARED=${LDSHARED-"$cc"}
411 LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1},--version-script,${SRCDIR}/${MAPNAME}" ;;
412 *BSD | *bsd* | DragonFly)
413 LDSHARED=${LDSHARED-"$cc"}
414 LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1},--version-script,${SRCDIR}/${MAPNAME}"
415 LDCONFIG="ldconfig -m" ;;
416 CYGWIN* | Cygwin* | cygwin*)
417 ARFLAGS="rcs"
418 SFLAGS="${CFLAGS}"
419 shared_ext='.dll'
420 sharedlibdir='${bindir}'
421 if testscip-shell system . . test. $compat -eq 0; then
422 SHAREDLIB=cygz-ng$shared_ext
423 else
424 SHAREDLIB=cygz$shared_ext
425 fi
426 SHAREDLIBM=''
427 SHAREDLIBV=''
428 SHAREDTARGET=$SHAREDLIB
429 IMPORTLIB="${LIBNAME}.dll.a"
430 LDSHARED=${LDSHARED-"$cc"}
431 LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB},--version-script,${SRCDIR}/${MAPNAME}"
432 LDSHAREDLIBC=""
433 DEFFILE='win32/${LIBNAME2}.def'
434 RC="${CROSS_PREFIX}windres"
435 RCOBJS='zlibrc.o'
436 STRIP="${CROSS_PREFIX}strip"
437 EXE='.exe' ;;
438 MSYS* | msys*)
439 ARFLAGS="rcs"
440 SFLAGS="${CFLAGS}"
441 shared_ext='.dll'
442 sharedlibdir='${bindir}'
443 if testscip-shell system . . test. $compat -eq 0; then
444 SHAREDLIB=msys-z-ng$shared_ext
445 else
446 SHAREDLIB=msys-z$shared_ext
447 fi
448 SHAREDLIBM=''
449 SHAREDLIBV=''
450 SHAREDTARGET=$SHAREDLIB
451 IMPORTLIB="${LIBNAME}.dll.a"
452 LDSHARED=${LDSHARED-"$cc"}
453 LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB}"
454 LDSHAREDLIBC=""
455 DEFFILE='win32/${LIBNAME2}.def'
456 RC="${CROSS_PREFIX}windres"
457 RCOBJS='zlibrc.o'
458 STRIP="${CROSS_PREFIX}strip"
459 EXE='.exe' ;;
460 MINGW* | mingw*)
461 ARFLAGS="rcs"
462 CFLAGS="${CFLAGS} -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1"
463 SFLAGS="${CFLAGS}"
464 shared_ext='.dll'
465 sharedlibdir='${bindir}'
466 SHAREDLIB=${LIBNAME}-$VER1$shared_ext
467 SHAREDLIBM=''
468 SHAREDLIBV=''
469 SHAREDTARGET=$SHAREDLIB
470 IMPORTLIB="${LIBNAME}.dll.a"
471 LDSHARED=${LDSHARED-"$cc"}
472 LDSHAREDFLAGS="-shared -Wl,--out-implib=${IMPORTLIB} -Wl,--version-script=${SRCDIR}/${MAPNAME}"
473 LDSHAREDLIBC=""
474 DEFFILE='win32/${LIBNAME2}.def'
475 RC="${CROSS_PREFIX}windres"
476 if [scip-shell system . . `[`. "$CC" == "mingw32-gcc" ]; then
477 case $ARCH in
478 i386 | i486 | i586 | i686) RCFLAGS="${RCFLAGS} -F pe-i386";;
479 esac;
480 fi
481 RCOBJS='zlibrc.o'
482 STRIP="${CROSS_PREFIX}strip"
483 EXE='.exe' ;;
484 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
485 # ([email protected])
486 LDSHARED=${LDSHARED-"$cc"}
487 LDSHAREDFLAGS="-shared -Wl,-h${LIBNAME}.so.${VER1}" ;;
488 HP-UX*)
489 LDSHARED=${LDSHARED-"$cc"}
490 LDSHAREDFLAGS="-shared"
491 case $((uname -m || echo unknown) 2>/dev/null) in
492 ia64)
493 shared_ext='.so'
494 SHAREDLIB='${LIBNAME}.so' ;;
495 *)
496 shared_ext='.sl'
497 SHAREDLIB='${LIBNAME}.sl' ;;
498 esac ;;
499 Darwin* | darwin*)
500 shared_ext='.dylib'
501 SHAREDLIB=${LIBNAME}$shared_ext
502 SHAREDLIBV=${LIBNAME}.$VER$shared_ext
503 SHAREDLIBM=${LIBNAME}.$VER1$shared_ext
504 SHAREDTARGET=$SHAREDLIBV
505 LDSHARED=${LDSHARED-"$cc"}
506 LDSHAREDFLAGS="-dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"
507 if libtool -V 2>&1 | grepscip-shell system . . grep. Apple > /dev/nullscip-shell filesystem . . `/dev/null`.; then
508 AR="libtool"
509 else
510 AR="/usr/bin/libtoolscip-shell filesystem . . `/usr/bin/libtool`."
511 fi
512 ARFLAGS="-o" ;;
513 aarch64)
514 LDSHARED=${LDSHARED-"$cc"}
515 LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1} -Wl,--version-script,${SRCDIR}/${MAPNAME}"
516 LDSHAREDLIBC="-Wl,--start-group -lc -lrdimon -Wl,--end-group" ;;
517 *)
518 LDSHARED=${LDSHARED-"$cc"}
519 LDSHAREDFLAGS="-shared" ;;
520 esac
521 else
522 # find system name and corresponding cc options
523 CC=${CC-cc}
524 gcc=0
525 echoscip-shell system . . echo. "$CC" | teescip-shell system . . tee. -a configure.log
526 if testscip-shell system . . test. -z "$uname"; then
527 uname=$((uname -sr || echo unknown) 2>/dev/null)
528 fi
529 case "$uname" in
530 HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
531 CFLAGS=${CFLAGS-"-O"}
532 LDSHARED=${LDSHARED-"ld"}
533 LDSHAREDFLAGS="-b"
534 case $((uname -m || echo unknown) 2>/dev/null) in
535 ia64)
536 shared_ext='.so'
537 SHAREDLIB='${LIBNAME}.so' ;;
538 *)
539 shared_ext='.sl'
540 SHAREDLIB='${LIBNAME}.sl' ;;
541 esac ;;
542 AIX*) # Courtesy of [email protected]
543 SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
544 CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
545 LDSHARED=${LDSHARED-"xlc"}
546 LDSHAREDFLAGS="-G" ;;
547 # send working options for other systems to [email protected]
548 *) SFLAGS=${CFLAGS-"-O"}
549 CFLAGS=${CFLAGS-"-O"}
550 LDSHARED=${LDSHARED-"cc"}
551 LDSHAREDFLAGS="-shared" ;;
552 esac
553 fi
554
555 # Simplify some later conditionals
556 case "$uname" in
557 Linux* | linux*)
558 LINUX=1 ;;
559 *)
560 LINUX=0 ;;
561 esac
562
563 # destination names for shared library if not defined above
564 SHAREDLIB=${SHAREDLIB-"${LIBNAME}$shared_ext"}
565 SHAREDLIBV=${SHAREDLIBV-"${LIBNAME}$shared_ext.$VER"}
566 SHAREDLIBM=${SHAREDLIBM-"${LIBNAME}$shared_ext.$VER1"}
567 SHAREDTARGET=${SHAREDTARGET-"${LIBNAME}$shared_ext.$VER"}
568
569 echoscip-shell system . . echo. >> configure.log
570
571 # define functions for testing compiler and library characteristics and logging the results
572
573 catscip-shell system . . cat. > $test.c <<EOF
574 #error error
575 EOF
576 if ($CC -c $CFLAGS $test.c) 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then
577 tryscip-shell shell shell-project 0.0.0 try().()
578 {
579 showscip-shell shell shell-project 0.0.0 show(). $*
580 testscip-shell system . . test. "$(\( $* \) 2>&1 | teescip-shell system . . tee. -a configure.log)" = ""
581 }
582 echoscip-shell system . . echo. - using any output from compiler to indicate an error >> configure.log
583 else
584 tryscip-shell shell shell-project 0.0.0 try().()
585 {
586 showscip-shell shell shell-project 0.0.0 show(). $*
587 ( $* ) >> configure.log 2>&1
588 ret=$?
589 if testscip-shell system . . test. $ret -ne 0; then
590 echoscip-shell system . . echo. "(exit code $ret)" >> configure.log
591 fi
592 return $ret
593 }
594 fi
595
596 trybothscip-shell shell shell-project 0.0.0 tryboth().()
597 {
598 showscip-shell shell shell-project 0.0.0 show(). $*
599 got=$(( $* ) 2>&1)
600 ret=$?
601 printfscip-shell system . . printf. %s "$got" >> configure.log
602 if testscip-shell system . . test. $ret -ne 0; then
603 return $ret
604 fi
605 testscip-shell system . . test. "$got" = ""
606 }
607
608 catscip-shell system . . cat. > $test.c << EOF
609 int foo() { return 0; }
610 EOF
611 echoscip-shell system . . echo. "Checking for obsessive-compulsive compiler options..." >> configure.log
612 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
613 :
614 else
615 echoscip-shell system . . echo. "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | teescip-shell system . . tee. -a configure.log
616 leavescip-shell shell shell-project 0.0.0 leave(). 1
617 fi
618
619 echoscip-shell system . . echo. >> configure.log
620
621 # see if shared library build supported
622 catscip-shell system . . cat. > $test.c <<EOF
623 extern int getchar();
624 int hello() {return getchar();}
625 EOF
626 if testscip-shell system . . test. $shared -eq 1; then
627 echoscip-shell system . . echo. -n "Checking for shared library support... " | teescip-shell system . . tee. -a configure.log
628 # we must test in two steps (cc then ld), required at least on SunOS 4.x
629 if tryscip-shell shell shell-project 0.0.0 try(). $CC -w -c $SFLAGS $test.c &&
630 tryscip-shell shell shell-project 0.0.0 try(). $LDSHARED $LDSHAREDFLAGS $LDFLAGS -o $test$shared_ext $test.o $LDSHAREDLIBC; then
631 echoscip-shell system . . echo. "Building shared library $SHAREDTARGET with $CC." | teescip-shell system . . tee. -a configure.log
632 elif testscip-shell system . . test. -z "$old_cc" -a -z "$old_cflags"; then
633 echoscip-shell system . . echo. "No shared library support." | teescip-shell system . . tee. -a configure.log
634 shared=0;
635 else
636 echoscip-shell system . . echo. 'No shared library support; try without defining CC and CFLAGS' | teescip-shell system . . tee. -a configure.log
637 shared=0;
638 fi
639 fi
640 if testscip-shell system . . test. $shared -eq 0; then
641 LDSHARED="$CC"
642 LDSHAREDFLAGS=""
643 ALL="static"
644 SHAREDLIB=""
645 SHAREDLIBV=""
646 SHAREDLIBM=""
647 SHAREDTARGET=""
648 INSTALLTARGETS=install-static
649 UNINSTALLTARGETS=uninstall-static
650 echoscip-shell system . . echo. Building static library $STATICLIB version $VER with $CC. | teescip-shell system . . tee. -a configure.log
651 else
652 ALL="static shared"
653 TEST="${TEST} testshared"
654 fi
655
656 echoscip-shell system . . echo. >> configure.log
657
658 # check for large file support, and if none, check for fseeko()
659 catscip-shell system . . cat. > $test.c <<EOF
660 #include <sys/types.h>
661 off64_t dummy = 0;
662 EOF
663 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
664 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
665 SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
666 echoscip-shell system . . echo. "Checking for off64_t... Yes." | teescip-shell system . . tee. -a configure.log
667 echoscip-shell system . . echo. "Checking for fseeko... Yes." | teescip-shell system . . tee. -a configure.log
668 else
669 echoscip-shell system . . echo. "Checking for off64_t... No." | teescip-shell system . . tee. -a configure.log
670 echoscip-shell system . . echo. >> configure.log
671 catscip-shell system . . cat. > $test.c <<EOF
672 #include <sys/types.h>
673 int main() {
674 _off64_t dummy = 0;
675 return 0;
676 }
677 EOF
678 if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then
679 echoscip-shell system . . echo. "Checking for _off64_t... Yes." | teescip-shell system . . tee. -a configure.log
680 else
681 echoscip-shell system . . echo. "Checking for _off64_t... No." | teescip-shell system . . tee. -a configure.log
682 fi
683 echoscip-shell system . . echo. >> configure.log
684 catscip-shell system . . cat. > $test.c <<EOF
685 #include <stdio.h>
686 int main(void) {
687 fseeko(NULL, 0, 0);
688 return 0;
689 }
690 EOF
691 if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then
692 echoscip-shell system . . echo. "Checking for fseeko... Yes." | teescip-shell system . . tee. -a configure.log
693 else
694 CFLAGS="${CFLAGS} -DNO_FSEEKO"
695 SFLAGS="${SFLAGS} -DNO_FSEEKO"
696 echoscip-shell system . . echo. "Checking for fseeko... No." | teescip-shell system . . tee. -a configure.log
697 fi
698 fi
699 echoscip-shell system . . echo. >> configure.log
700
701 catscip-shell system . . cat. > $test.c <<EOF
702 #define _POSIX_C_SOURCE 200112L
703 #include <stdlib.h>
704 int main(void) {
705 void *ptr = 0;
706 int ret = posix_memalign(&ptr, 64, 10);
707 if (ptr)
708 free(ptr);
709 return ret;
710 }
711 EOF
712 if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then
713 echoscip-shell system . . echo. "Checking for posix_memalign... Yes." | teescip-shell system . . tee. -a configure.log
714 CFLAGS="${CFLAGS} -DHAVE_POSIX_MEMALIGN"
715 SFLAGS="${SFLAGS} -DHAVE_POSIX_MEMALIGN"
716 else
717 echoscip-shell system . . echo. "Checking for posix_memalign... No." | teescip-shell system . . tee. -a configure.log
718 fi
719 echoscip-shell system . . echo. >> configure.log
720
721 # check for strerror() for use by gz* functions
722 catscip-shell system . . cat. > $test.c <<EOF
723 #include <string.h>
724 #include <errno.h>
725 int main() { return strlen(strerror(errno)); }
726 EOF
727 if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then
728 echoscip-shell system . . echo. "Checking for strerror... Yes." | teescip-shell system . . tee. -a configure.log
729 else
730 CFLAGS="${CFLAGS} -DNO_STRERROR"
731 SFLAGS="${SFLAGS} -DNO_STRERROR"
732 echoscip-shell system . . echo. "Checking for strerror... No." | teescip-shell system . . tee. -a configure.log
733 fi
734
735 # check for getauxval() for architecture feature detection at run-time
736 catscip-shell system . . cat. > $test.c <<EOF
737 #include <sys/auxv.h>
738 int main() { return getauxval(0); }
739 EOF
740 if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then
741 echoscip-shell system . . echo. "Checking for getauxval() in sys/auxv.h... Yes." | teescip-shell system . . tee. -a configure.log
742 CFLAGS="${CFLAGS} -DHAVE_SYS_AUXV_H"
743 SFLAGS="${SFLAGS} -DHAVE_SYS_AUXV_H"
744 else
745 echoscip-shell system . . echo. "Checking for getauxval() in sys/auxv.h... No." | teescip-shell system . . tee. -a configure.log
746 fi
747
748 # We need to remove consigured files (zconf.h etc) from source directory if building outside of it
749 if [scip-shell system . . `[`. "$SRCDIR" != "$BUILDDIR" ]; then
750 rmscip-shell system . . rm. -f $SRCDIR/zconf${SUFFIX}.h
751 rmscip-shell system . . rm. -f $SRCDIR/zlib${SUFFIX}.h
752 rmscip-shell system . . rm. -f $SRCDIR/zlib_name_mangling${SUFFIX}.h
753 fi
754
755 # Rename @ZLIB_SYMBOL_PREFIX@ to $symbol_prefix in gzread.c, zlib.h and zlib_name_mangling.h
756 sedscip-shell system . . sed. < $SRCDIR/gzread.c.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > gzread.c
757 sedscip-shell system . . sed. < $SRCDIR/zlib${SUFFIX}.h.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > zlib${SUFFIX}.h
758 if [[ ! -z $symbol_prefix ]]; then
759 sedscip-shell system . . sed. < $SRCDIR/zlib_name_mangling${SUFFIX}.h.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > zlib_name_mangling${SUFFIX}.h
760 else
761 # symbol_prefix is not set, copy the empty mangling header
762 cpscip-shell system . . cp. -p $SRCDIR/zlib_name_mangling.h.empty zlib_name_mangling${SUFFIX}.h
763 fi
764
765 # copy clean zconf.h for subsequent edits
766 cpscip-shell system . . cp. -p $SRCDIR/zconf${SUFFIX}.h.in zconf${SUFFIX}.h
767
768 echoscip-shell system . . echo. >> configure.log
769
770 # check for unistd.h and save result in zconf.h
771 catscip-shell system . . cat. > $test.c <<EOF
772 #include <unistd.h>
773 int main() { return 0; }
774 EOF
775 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
776 sedscip-shell system . . sed. < zconf${SUFFIX}.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf${SUFFIX}.temp.h
777 mvscip-shell system . . mv. zconf${SUFFIX}.temp.h zconf${SUFFIX}.h
778 echoscip-shell system . . echo. "Checking for unistd.h... Yes." | teescip-shell system . . tee. -a configure.log
779 else
780 sedscip-shell system . . sed. < zconf${SUFFIX}.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be set to #if 1/ 0\1 was set to #if 0/" > zconf${SUFFIX}.temp.h
781 mvscip-shell system . . mv. zconf${SUFFIX}.temp.h zconf${SUFFIX}.h
782 echoscip-shell system . . echo. "Checking for unistd.h... No." | teescip-shell system . . tee. -a configure.log
783 fi
784
785 echoscip-shell system . . echo. >> configure.log
786
787 # check for ptrdiff_t and save result in zconf.h
788 echoscip-shell system . . echo. -n "Checking for ptrdiff_t... " | teescip-shell system . . tee. -a configure.log
789 catscip-shell system . . cat. > $test.c <<EOF
790 #include <stddef.h>
791 int fun(ptrdiff_t *a) { (void)a; return 0; }
792 EOF
793 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
794 echoscip-shell system . . echo. "Yes." | teescip-shell system . . tee. -a configure.log
795 else
796 echoscip-shell system . . echo. "No." | teescip-shell system . . tee. -a configure.log
797 sedscip-shell system . . sed. < zconf${SUFFIX}.h "/^#ifdef NEED_PTRDIFF_T.* may be/s/def NEED_PTRDIFF_T\(.*\) may be/ 1\1 was/" > zconf${SUFFIX}.temp.h
798 mvscip-shell system . . mv. zconf${SUFFIX}.temp.h zconf${SUFFIX}.h
799
800 echoscip-shell system . . echo. -n "Checking for sizeof(void *)... " | teescip-shell system . . tee. -a configure.log
801 catscip-shell system . . cat. > $test.c <<EOF
802 #include <stdint.h>
803 #define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; }
804 COMPILE_TIME_ASSERT(sizeof(int32_t) == sizeof(void *));
805 EOF
806 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
807 echoscip-shell system . . echo. "sizeof(int32_t)." | teescip-shell system . . tee. -a configure.log
808 sedscip-shell system . . sed. < zconf${SUFFIX}.h "s/^typedef PTRDIFF_TYPE ptrdiff_t;/typedef int32_t ptrdiff_t;/g" > zconf${SUFFIX}.temp.h
809 mvscip-shell system . . mv. zconf${SUFFIX}.temp.h zconf${SUFFIX}.h
810 else
811 catscip-shell system . . cat. > $test.c <<EOF
812 #include <stdint.h>
813 #define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; }
814 COMPILE_TIME_ASSERT(sizeof(int64_t) == sizeof(void *));
815 EOF
816 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
817 echoscip-shell system . . echo. "sizeof(int64_t)." | teescip-shell system . . tee. -a configure.log
818 sedscip-shell system . . sed. < zconf${SUFFIX}.h "s/^typedef PTRDIFF_TYPE ptrdiff_t;/typedef int64_t ptrdiff_t;/g" > zconf${SUFFIX}.temp.h
819 mvscip-shell system . . mv. zconf${SUFFIX}.temp.h zconf${SUFFIX}.h
820 else
821 echoscip-shell system . . echo. "unknown." | teescip-shell system . . tee. -a configure.log
822 exit 1
823 fi
824 fi
825 fi
826
827 # if --zlib-compat was requested
828 if testscip-shell system . . test. $compat -eq 1; then
829 gzfileops=1
830 CFLAGS="${CFLAGS} -DZLIB_COMPAT"
831 SFLAGS="${SFLAGS} -DZLIB_COMPAT"
832 case "$uname" in
833 CYGWIN* | Cygwin* | cygwin* | MSYS* | msys* | MINGW* | mingw*)
834 DEFFILE="win32/zlibcompat.def" ;;
835 esac
836 fi
837
838 # if --gzfileops was requested
839 if testscip-shell system . . test. $gzfileops -eq 1; then
840 CFLAGS="${CFLAGS} -DWITH_GZFILEOP"
841 SFLAGS="${SFLAGS} -DWITH_GZFILEOP"
842 OBJC="${OBJC} \$(OBJG)"
843 PIC_OBJC="${PIC_OBJC} \$(PIC_OBJG)"
844 else
845 PIC_TESTOBJG="\$(OBJG)"
846 fi
847
848 # set architecture alignment requirements
849 if testscip-shell system . . test. $unalignedok -eq 0; then
850 CFLAGS="${CFLAGS} -DNO_UNALIGNED"
851 SFLAGS="${SFLAGS} -DNO_UNALIGNED"
852 echoscip-shell system . . echo. "Unaligned reads manually disabled." | teescip-shell system . . tee. -a configure.log
853 fi
854
855 # enable reduced memory configuration
856 if testscip-shell system . . test. $reducedmem -eq 1; then
857 echoscip-shell system . . echo. "Configuring for reduced memory environment." | teescip-shell system . . tee. -a configure.log
858 CFLAGS="${CFLAGS} -DHASH_SIZE=32768u -DGZBUFSIZE=8192"
859 fi
860
861 # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
862 if testscip-shell system . . test. $cover -eq 1; then
863 CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
864 LDFLAGS="${LDFLAGS} -fprofile-arcs -ftest-coverage"
865 if testscip-shell system . . test. -n "$GCC_CLASSIC"; then
866 CC=$GCC_CLASSIC
867 fi
868 fi
869
870 echoscip-shell system . . echo. >> configure.log
871
872 # Check for ANSI C compliant compiler
873 catscip-shell system . . cat. > $test.c <<EOF
874 #include <stdint.h>
875 #include <stdio.h>
876 #include <stdarg.h>
877 #include "zconf${SUFFIX}.h"
878 int main() {
879 #ifdef STDC
880 return 0;
881 #endif
882 return 1;
883 }
884 EOF
885 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
886 echoscip-shell system . . echo. "Checking for ANSI C compliant compiler... Yes." | teescip-shell system . . tee. -a configure.log
887 :
888 else
889 echoscip-shell system . . echo. "Checking for ANSI C compliant compiler... No." | teescip-shell system . . tee. -a configure.log
890 echoscip-shell system . . echo. "Error: ANSI C compatible compiler needed, cannot continue." | teescip-shell system . . tee. -a configure.log
891 leavescip-shell shell shell-project 0.0.0 leave(). 1
892 fi
893
894 # Check for -fno-semantic-interposition compiler support
895 echoscip-shell system . . echo. "" > test.c
896 catscip-shell system . . cat. > $test.c <<EOF
897 int main() { return 0; }
898 EOF
899 if testscip-shell system . . test. "$gcc" -eq 1 && ($cc $CFLAGS -fno-semantic-interposition -c $test.c) >> configure.log 2>&1; then
900 echoscip-shell system . . echo. "Checking for -fno-semantic-interposition... Yes." | teescip-shell system . . tee. -a configure.log
901 SFLAGS="$SFLAGS -fno-semantic-interposition"
902 else
903 echoscip-shell system . . echo. "Checking for -fno-semantic-interposition... No." | teescip-shell system . . tee. -a configure.log
904 fi
905
906 # Check for -fno-lto compiler support
907 if testscip-shell system . . test. $gcc -eq 1 -a $without_optimizations -eq 0 -a $native -eq 0; then
908 catscip-shell system . . cat. > $test.c <<EOF
909 int main() { return 0; }
910 EOF
911 if $cc $CFLAGS -fno-lto -c $test.c >> configure.log 2>&1; then
912 echoscip-shell system . . echo. "Checking for -fno-lto... Yes." | teescip-shell system . . tee. -a configure.log
913 else
914 echoscip-shell system . . echo. "Checking for -fno-lto... No." | teescip-shell system . . tee. -a configure.log
915 noltoflag=""
916 fi
917 fi
918
919 # see if we can hide zlib internal symbols that are linked between separate source files using hidden
920 if testscip-shell system . . test. "$gcc" -eq 1; then
921 echoscip-shell system . . echo. >> configure.log
922 catscip-shell system . . cat. > $test.c <<EOF
923 #define Z_INTERNAL __attribute__((visibility ("hidden")))
924 int Z_INTERNAL foo;
925 int main() { return 0; }
926 EOF
927 if trybothscip-shell shell shell-project 0.0.0 tryboth(). $CC -c $CFLAGS $test.c; then
928 CFLAGS="$CFLAGS -DHAVE_VISIBILITY_HIDDEN"
929 SFLAGS="$SFLAGS -DHAVE_VISIBILITY_HIDDEN"
930 echoscip-shell system . . echo. >> configure.log
931 echoscip-shell system . . echo. "Checking for attribute(visibility(hidden)) support... Yes." | teescip-shell system . . tee. -a configure.log
932 else
933 echoscip-shell system . . echo. >> configure.log
934 echoscip-shell system . . echo. "Checking for attribute(visibility(hidden)) support... No." | teescip-shell system . . tee. -a configure.log
935 fi
936 fi
937
938 # see if we can hide zlib internal symbols that are linked between separate source files using internal
939 if testscip-shell system . . test. "$gcc" -eq 1; then
940 echoscip-shell system . . echo. >> configure.log
941 catscip-shell system . . cat. > $test.c <<EOF
942 #define Z_INTERNAL __attribute__((visibility ("internal")))
943 int Z_INTERNAL foo;
944 int main() { return 0; }
945 EOF
946 if trybothscip-shell shell shell-project 0.0.0 tryboth(). $CC -c $CFLAGS $test.c; then
947 CFLAGS="$CFLAGS -DHAVE_VISIBILITY_INTERNAL"
948 SFLAGS="$SFLAGS -DHAVE_VISIBILITY_INTERNAL"
949 echoscip-shell system . . echo. >> configure.log
950 echoscip-shell system . . echo. "Checking for attribute(visibility(internal)) support... Yes." | teescip-shell system . . tee. -a configure.log
951 else
952 echoscip-shell system . . echo. >> configure.log
953 echoscip-shell system . . echo. "Checking for attribute(visibility(internal)) support... No." | teescip-shell system . . tee. -a configure.log
954 fi
955 fi
956
957 # Check for __builtin_ctz() support in compiler
958 catscip-shell system . . cat. > $test.c << EOF
959 int main(void) {
960 unsigned int zero = 0;
961 long test = __builtin_ctz(zero);
962 (void)test;
963 return 0;
964 }
965 EOF
966 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then
967 echoscip-shell system . . echo. "Checking for __builtin_ctz ... Yes." | teescip-shell system . . tee. -a configure.log
968 CFLAGS="$CFLAGS -DHAVE_BUILTIN_CTZ"
969 SFLAGS="$SFLAGS -DHAVE_BUILTIN_CTZ"
970 else
971 echoscip-shell system . . echo. "Checking for __builtin_ctz ... No." | teescip-shell system . . tee. -a configure.log
972 fi
973
974 # Check for __builtin_ctzll() support in compiler
975 catscip-shell system . . cat. > $test.c << EOF
976 int main(void) {
977 unsigned long long zero = 0;
978 long test = __builtin_ctzll(zero);
979 (void)test;
980 return 0;
981 }
982 EOF
983 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then
984 echoscip-shell system . . echo. "Checking for __builtin_ctzll ... Yes." | teescip-shell system . . tee. -a configure.log
985 CFLAGS="$CFLAGS -DHAVE_BUILTIN_CTZLL"
986 SFLAGS="$SFLAGS -DHAVE_BUILTIN_CTZLL"
987 else
988 echoscip-shell system . . echo. "Checking for __builtin_ctzll ... No." | teescip-shell system . . tee. -a configure.log
989 fi
990
991 check_avx2_intrinsicsscip-shell shell shell-project 0.0.0 check_avx2_intrinsics().() {
992 # Check whether compiler supports AVX2 intrinsics
993 catscip-shell system . . cat. > $test.c << EOF
994 #include <immintrin.h>
995 int main(void) {
996 __m256i x = _mm256_set1_epi16(2);
997 const __m256i y = _mm256_set1_epi16(1);
998 x = _mm256_subs_epu16(x, y);
999 (void)x;
1000 return 0;
1001 }
1002 EOF
1003 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${avx2flag} $test.c; then
1004 echoscip-shell system . . echo. "Checking for AVX2 intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1005 HAVE_AVX2_INTRIN=1
1006 else
1007 echoscip-shell system . . echo. "Checking for AVX2 intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1008 HAVE_AVX2_INTRIN=0
1009 fi
1010 }
1011
1012 check_avx512_intrinsicsscip-shell shell shell-project 0.0.0 check_avx512_intrinsics().() {
1013 # Check whether compiler supports AVX512 intrinsics
1014 catscip-shell system . . cat. > $test.c << EOF
1015 #include <immintrin.h>
1016 int main(void) {
1017 __m512i x = _mm512_set1_epi8(2);
1018 const __m512i y = _mm512_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1019 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1020 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
1021 56, 57, 58, 59, 60, 61, 62, 63, 64);
1022 x = _mm512_sub_epi8(x, y);
1023 (void)x;
1024 return 0;
1025 }
1026 EOF
1027 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${avx512flag} $test.c; then
1028 echoscip-shell system . . echo. "Checking for AVX512 intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1029 HAVE_AVX512_INTRIN=1
1030 else
1031 echoscip-shell system . . echo. "Checking for AVX512 intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1032 HAVE_AVX512_INTRIN=0
1033 fi
1034 }
1035
1036 check_avx512vnni_intrinsicsscip-shell shell shell-project 0.0.0 check_avx512vnni_intrinsics().() {
1037 # Check whether compiler supports AVX512-VNNI intrinsics
1038 catscip-shell system . . cat. > $test.c << EOF
1039 #include <immintrin.h>
1040 int main(void) {
1041 __m512i x = _mm512_set1_epi8(2);
1042 const __m512i y = _mm512_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1043 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1044 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
1045 56, 57, 58, 59, 60, 61, 62, 63, 64);
1046 __m512i z = _mm512_setzero_epi32();
1047 z = _mm512_dpbusd_epi32(z, x, y);
1048 (void)z;
1049 return 0;
1050 }
1051 EOF
1052 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${avx512vnniflag} $test.c; then
1053 echoscip-shell system . . echo. "Checking for AVX512VNNI intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1054 HAVE_AVX512VNNI_INTRIN=1
1055 else
1056 echoscip-shell system . . echo. "Checking for AVX512VNNI intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1057 HAVE_AVX512VNNI_INTRIN=0
1058 fi
1059 }
1060
1061 check_mask_intrinsicsscip-shell shell shell-project 0.0.0 check_mask_intrinsics().() {
1062 # Check whether compiler supports AVX512 k-mask intrinsics
1063 catscip-shell system . . cat. > $test.c << EOF
1064 #include <immintrin.h>
1065 int main(void) {
1066 __mmask16 a = 0xFF;
1067 a = _knot_mask16(a);
1068 (void)a;
1069 return 0;
1070 }
1071 EOF
1072 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${avx512flag} $test.c; then
1073 echoscip-shell system . . echo. "Checking for k-mask intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1074 HAVE_MASK_INTRIN=1
1075 else
1076 echoscip-shell system . . echo. "Checking for k-mask intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1077 HAVE_MASK_INTRIN=0
1078 fi
1079 }
1080
1081 check_acle_compiler_flagscip-shell shell shell-project 0.0.0 check_acle_compiler_flag().() {
1082 # Check whether -march=armv8-a+crc works correctly
1083 catscip-shell system . . cat. > $test.c << EOF
1084 int main() { return 0; }
1085 EOF
1086 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS -march=armv8-a+crc $test.c; then
1087 ACLE_AVAILABLE=1
1088 echoscip-shell system . . echo. "Check whether -march=armv8-a+crc works ... Yes." | teescip-shell system . . tee. -a configure.log
1089 else
1090 echoscip-shell system . . echo. "Check whether -march=armv8-a+crc works ... No." | teescip-shell system . . tee. -a configure.log
1091 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS -march=armv8-a+crc+simd $test.c; then
1092 ACLE_AVAILABLE=1
1093 echoscip-shell system . . echo. "Check whether -march=armv8-a+crc+simd works ... Yes." | teescip-shell system . . tee. -a configure.log
1094 if testscip-shell system . . test. "$ARCH" = "armv8-a+crc"; then
1095 ARCH=armv8-a+crc+simd
1096 fi
1097 else
1098 ACLE_AVAILABLE=0
1099 echoscip-shell system . . echo. "Check whether -march=armv8-a+crc+simd works ... No." | teescip-shell system . . tee. -a configure.log
1100 fi
1101 fi
1102 }
1103
1104 check_neon_compiler_flagscip-shell shell shell-project 0.0.0 check_neon_compiler_flag().() {
1105 # Check whether -mfpu=neon is available on ARM processors.
1106 catscip-shell system . . cat. > $test.c << EOF
1107 #ifdef _M_ARM64
1108 # include <arm64_neon.h>
1109 #else
1110 # include <arm_neon.h>
1111 #endif
1112 int main() { return 0; }
1113 EOF
1114 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS -mfpu=neon $test.c; then
1115 MFPU_NEON_AVAILABLE=1
1116 echoscip-shell system . . echo. "Check whether -mfpu=neon is available ... Yes." | teescip-shell system . . tee. -a configure.log
1117 else
1118 MFPU_NEON_AVAILABLE=0
1119 echoscip-shell system . . echo. "Check whether -mfpu=neon is available ... No." | teescip-shell system . . tee. -a configure.log
1120 fi
1121 }
1122
1123 check_neon_ld4_intrinsicsscip-shell shell shell-project 0.0.0 check_neon_ld4_intrinsics().() {
1124 if testscip-shell system . . test. $buildneon -eq 1 && testscip-shell system . . test. $native -eq 0; then
1125 if testscip-shell system . . test. "$CC_ARCH" = "aarch64" || testscip-shell system . . test. "$CC_ARCH" = "aarch64_be" || testscip-shell system . . test. "$CC_ARCH" = "arm64"; then
1126 neonflag="-march=armv8-a+simd"
1127 elif testscip-shell system . . test. $MFPU_NEON_AVAILABLE -eq 1; then
1128 neonflag="-mfpu=neon"
1129 fi
1130 fi
1131 catscip-shell system . . cat. > $test.c << EOF
1132 #ifdef _M_ARM64
1133 # include <arm64_neon.h>
1134 #else
1135 # include <arm_neon.h>
1136 #endif
1137 int main(void) {
1138 int stack_var[16];
1139 int32x4x4_t v = vld1q_s32_x4(stack_var);
1140 (void)v;
1141 return 0;
1142 }
1143 EOF
1144 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $neonflag $test.c; then
1145 NEON_HAS_LD4=1
1146 echoscip-shell system . . echo. "check whether compiler supports 4 wide register loads ... Yes." | teescip-shell system . . tee. -a configure.log
1147 else
1148 NEON_HAS_LD4=0
1149 echoscip-shell system . . echo. "check whether compiler supports 4 wide register loads ... No." | teescip-shell system . . tee. -a configure.log
1150 fi
1151 }
1152
1153 check_pclmulqdq_intrinsicsscip-shell shell shell-project 0.0.0 check_pclmulqdq_intrinsics().() {
1154 # Check whether compiler supports PCLMULQDQ intrinsics
1155 catscip-shell system . . cat. > $test.c << EOF
1156 #include <immintrin.h>
1157 #include <wmmintrin.h>
1158 int main(void) {
1159 __m128i a = _mm_setzero_si128();
1160 __m128i b = _mm_setzero_si128();
1161 __m128i c = _mm_clmulepi64_si128(a, b, 0x10);
1162 (void)c;
1163 return 0;
1164 }
1165 EOF
1166 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${pclmulflag} $test.c; then
1167 echoscip-shell system . . echo. "Checking for PCLMULQDQ intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1168 HAVE_PCLMULQDQ_INTRIN=1
1169 else
1170 echoscip-shell system . . echo. "Checking for PCLMULQDQ intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1171 HAVE_PCLMULQDQ_INTRIN=0
1172 fi
1173 }
1174
1175 check_vpclmulqdq_intrinsicsscip-shell shell shell-project 0.0.0 check_vpclmulqdq_intrinsics().() {
1176 # Check whether compiler supports VPCLMULQDQ intrinsics
1177 catscip-shell system . . cat. > $test.c << EOF
1178 #include <immintrin.h>
1179 #include <wmmintrin.h>
1180 int main(void) {
1181 __m512i a = _mm512_setzero_si512();
1182 __m512i b = _mm512_setzero_si512();
1183 __m512i c = _mm512_clmulepi64_epi128(a, b, 0x10);
1184 (void)c;
1185 return 0;
1186 }
1187 EOF
1188 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${vpclmulflag} $test.c; then
1189 echoscip-shell system . . echo. "Checking for VPCLMULQDQ intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1190 HAVE_VPCLMULQDQ_INTRIN=1
1191 else
1192 echoscip-shell system . . echo. "Checking for VPCLMULQDQ intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1193 HAVE_VPCLMULQDQ_INTRIN=0
1194 fi
1195 }
1196
1197 check_ppc_intrinsicsscip-shell shell shell-project 0.0.0 check_ppc_intrinsics().() {
1198 catscip-shell system . . cat. > $test.c << EOF
1199 #include <altivec.h>
1200 int main(void)
1201 {
1202 vector int a = vec_splats(0);
1203 vector int b = vec_splats(0);
1204 a = vec_add(a, b);
1205 return 0;
1206 }
1207 EOF
1208 if testscip-shell system . . test. $buildaltivec -eq 1 && tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} -maltivec $test.c; then
1209 echoscip-shell system . . echo. "Checking for AltiVec intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1210 HAVE_ALTIVEC_INTRIN=1
1211 else
1212 echoscip-shell system . . echo. "Checking for AltiVec intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1213 HAVE_ALTIVEC_INTRIN=0
1214 fi
1215 if testscip-shell system . . test. $buildaltivec -eq 1 && tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} -maltivec -mno-vsx $test.c; then
1216 echoscip-shell system . . echo. "Checking if -mno-vsx is supported ... Yes." | teescip-shell system . . tee. -a configure.log
1217 vmxflag="$vmxflag -mno-vsx"
1218 else
1219 echoscip-shell system . . echo. "Checking if -mno-vsx is supported ... No." | teescip-shell system . . tee. -a configure.log
1220 fi
1221 catscip-shell system . . cat. > $test.c << EOF
1222 #include <sys/auxv.h>
1223 int main() { return (getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC); }
1224 EOF
1225 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS -maltivec $test.c; then
1226 HAVE_VMX=1
1227 echoscip-shell system . . echo. "Check whether VMX instructions are available ... Yes." | teescip-shell system . . tee. -a configure.log
1228 else
1229 HAVE_VMX=0
1230 echoscip-shell system . . echo. "Check whether VMX instructions are available ... No." | teescip-shell system . . tee. -a configure.log
1231 fi
1232 }
1233
1234 check_power8_intrinsicsscip-shell shell shell-project 0.0.0 check_power8_intrinsics().() {
1235 # Check whether features needed by POWER8 optimisations are available
1236 catscip-shell system . . cat. > $test.c << EOF
1237 #include <sys/auxv.h>
1238 int main() { return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07); }
1239 EOF
1240 if testscip-shell system . . test. $buildpower8 -eq 1 && tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS -mcpu=power8 $test.c; then
1241 HAVE_POWER8_INTRIN=1
1242 echoscip-shell system . . echo. "Check whether POWER8 instructions are available ... Yes." | teescip-shell system . . tee. -a configure.log
1243 else
1244 HAVE_POWER8_INTRIN=0
1245 echoscip-shell system . . echo. "Check whether POWER8 instructions are available ... No." | teescip-shell system . . tee. -a configure.log
1246 fi
1247 }
1248
1249 check_power9_intrinsicsscip-shell shell shell-project 0.0.0 check_power9_intrinsics().() {
1250 # Check whether features needed by POWER9 optimisations are available
1251 catscip-shell system . . cat. > $test.c << EOF
1252 int main() { return 0; }
1253 EOF
1254 if testscip-shell system . . test. $buildpower9 -eq 1 && tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS -mcpu=power9 $test.c; then
1255 HAVE_POWER9_INTRIN=1
1256 echoscip-shell system . . echo. "Check whether POWER9 instructions are available ... Yes." | teescip-shell system . . tee. -a configure.log
1257 else
1258 HAVE_POWER9_INTRIN=0
1259 echoscip-shell system . . echo. "Check whether POWER9 instructions are available ... No." | teescip-shell system . . tee. -a configure.log
1260 fi
1261 }
1262
1263 check_sse2_intrinsicsscip-shell shell shell-project 0.0.0 check_sse2_intrinsics().() {
1264 # Check whether compiler supports SSE2 intrinsics
1265 catscip-shell system . . cat. > $test.c << EOF
1266 #include <immintrin.h>
1267 int main(void) {
1268 __m128i zero = _mm_setzero_si128();
1269 (void)zero;
1270 return 0;
1271 }
1272 EOF
1273 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${sse2flag} $test.c; then
1274 echoscip-shell system . . echo. "Checking for SSE2 intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1275 HAVE_SSE2_INTRIN=1
1276 else
1277 echoscip-shell system . . echo. "Checking for SSE2 intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1278 HAVE_SSE2_INTRIN=0
1279 fi
1280 }
1281
1282 check_sse41_intrinsicsscip-shell shell shell-project 0.0.0 check_sse41_intrinsics().() {
1283 # Check whether compiler supports SSE4.1 intrinsics
1284 catscip-shell system . . cat. > $test.c << EOF
1285 #include <smmintrin.h>
1286 int main(void)
1287 {
1288 __m128i u, v, w;
1289 u = _mm_set1_epi8(1);
1290 v = _mm_set1_epi8(2);
1291 w = _mm_sad_epu8(u, v);
1292 (void)w;
1293 return 0;
1294 }
1295 EOF
1296 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${sse41flag} $test.c; then
1297 echoscip-shell system . . echo. "Checking for SSE4.1 intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1298 HAVE_SSE41_INTRIN=1
1299 else
1300 echoscip-shell system . . echo. "Checking for SSE4.1 intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1301 HAVE_SSE41_INTRIN=0
1302 fi
1303 }
1304
1305 check_sse42_intrinsicsscip-shell shell shell-project 0.0.0 check_sse42_intrinsics().() {
1306 # Check whether compiler supports SSE4 CRC inline asm
1307 catscip-shell system . . cat. > $test.c << EOF
1308 int main(void) {
1309 unsigned val = 0, h = 0;
1310 __asm__ __volatile__ ( "crc32 %1,%0" : "+r" (h) : "r" (val) );
1311 return (int) h;
1312 }
1313 EOF
1314 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${sse42flag} $test.c; then
1315 echoscip-shell system . . echo. "Checking for SSE4.2 CRC inline assembly ... Yes." | teescip-shell system . . tee. -a configure.log
1316 HAVE_SSE42CRC_INLINE_ASM=1
1317 else
1318 echoscip-shell system . . echo. "Checking for SSE4.2 CRC inline assembly ... No." | teescip-shell system . . tee. -a configure.log
1319 HAVE_SSE42CRC_INLINE_ASM=0
1320 fi
1321
1322 # Check whether compiler supports SSE4.2 CRC intrinsics
1323 catscip-shell system . . cat. > $test.c << EOF
1324 int main(void) {
1325 unsigned crc = 0;
1326 char c = 'c';
1327 crc = __builtin_ia32_crc32qi(crc, c);
1328 (void)crc;
1329 return 0;
1330 }
1331 EOF
1332 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${sse42flag} $test.c; then
1333 echoscip-shell system . . echo. "Checking for SSE4.2 CRC intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1334 HAVE_SSE42CRC_INTRIN=1
1335 else
1336 echoscip-shell system . . echo. "Checking for SSE4.2 CRC intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1337 HAVE_SSE42CRC_INTRIN=0
1338 fi
1339
1340 # Check whether compiler supports SSE4.2 compare string intrinsics
1341 catscip-shell system . . cat. > $test.c << EOF
1342 #include <immintrin.h>
1343 int main(void)
1344 {
1345 unsigned char a[64] = { 0 };
1346 unsigned char b[64] = { 0 };
1347 __m128i xmm_src0, xmm_src1;
1348 xmm_src0 = _mm_loadu_si128((__m128i *)(char *)a);
1349 xmm_src1 = _mm_loadu_si128((__m128i *)(char *)b);
1350 return _mm_cmpestri(xmm_src0, 16, xmm_src1, 16, 0);
1351 }
1352 EOF
1353 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${sse42flag} $test.c; then
1354 echoscip-shell system . . echo. "Checking for SSE4.2 compare string intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1355 HAVE_SSE42CMPSTR_INTRIN=1
1356 else
1357 echoscip-shell system . . echo. "Checking for SSE4.2 compare string intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1358 HAVE_SSE42CMPSTR_INTRIN=0
1359 fi
1360 }
1361
1362 check_ssse3_intrinsicsscip-shell shell shell-project 0.0.0 check_ssse3_intrinsics().() {
1363 # Check whether compiler supports SSSE3 intrinsics
1364 catscip-shell system . . cat. > $test.c << EOF
1365 #include <immintrin.h>
1366 int main(void)
1367 {
1368 __m128i u, v, w;
1369 u = _mm_set1_epi32(1);
1370 v = _mm_set1_epi32(2);
1371 w = _mm_hadd_epi32(u, v);
1372 (void)w;
1373 return 0;
1374 }
1375 EOF
1376 if tryscip-shell shell shell-project 0.0.0 try(). ${CC} ${CFLAGS} ${ssse3flag} $test.c; then
1377 echoscip-shell system . . echo. "Checking for SSSE3 intrinsics ... Yes." | teescip-shell system . . tee. -a configure.log
1378 HAVE_SSSE3_INTRIN=1
1379 else
1380 echoscip-shell system . . echo. "Checking for SSSE3 intrinsics ... No." | teescip-shell system . . tee. -a configure.log
1381 HAVE_SSSE3_INTRIN=0
1382 fi
1383 }
1384
1385 check_vgfma_intrinsicsscip-shell shell shell-project 0.0.0 check_vgfma_intrinsics().() {
1386 # Check whether "VECTOR GALOIS FIELD MULTIPLY SUM AND ACCUMULATE" intrinsic is available
1387 echoscip-shell system . . echo. -n "Checking for -mzarch... " | teescip-shell system . . tee. -a configure.log
1388 if tryscip-shell shell shell-project 0.0.0 try(). $CC -x c -c /dev/nullscip-shell filesystem . . `/dev/null`. -o /dev/nullscip-shell filesystem . . `/dev/null`. -mzarch; then
1389 echoscip-shell system . . echo. Yes. | teescip-shell system . . tee. -a configure.log
1390 vgfmaflag="${vgfmaflag} -mzarch"
1391 else
1392 echoscip-shell system . . echo. No. | teescip-shell system . . tee. -a configure.log
1393 fi
1394 echoscip-shell system . . echo. -n "Checking for -fzvector... " | teescip-shell system . . tee. -a configure.log
1395 if tryscip-shell shell shell-project 0.0.0 try(). $CC -x c -c /dev/nullscip-shell filesystem . . `/dev/null`. -o /dev/nullscip-shell filesystem . . `/dev/null`. -fzvector; then
1396 echoscip-shell system . . echo. Yes. | teescip-shell system . . tee. -a configure.log
1397 vgfmaflag="${vgfmaflag} -fzvector"
1398 else
1399 echoscip-shell system . . echo. No. | teescip-shell system . . tee. -a configure.log
1400 fi
1401 catscip-shell system . . cat. > $test.c << EOF
1402 #include <vecintrin.h>
1403 int main(void) {
1404 unsigned long long a __attribute__((vector_size(16))) = { 0 };
1405 unsigned long long b __attribute__((vector_size(16))) = { 0 };
1406 unsigned char c __attribute__((vector_size(16))) = { 0 };
1407 c = vec_gfmsum_accum_128(a, b, c);
1408 return c[0];
1409 }
1410 EOF
1411 echoscip-shell system . . echo. -n "Checking for VGFMA support... " | teescip-shell system . . tee. -a configure.log
1412 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $vgfmaflag $test.c; then
1413 HAVE_VGFMA_INTRIN=1
1414 echoscip-shell system . . echo. "Yes." | teescip-shell system . . tee. -a configure.log
1415 else
1416 HAVE_VGFMA_INTRIN=0
1417 echoscip-shell system . . echo. "No." | teescip-shell system . . tee. -a configure.log
1418 fi
1419 }
1420
1421 case "${ARCH}" in
1422 i386 | i486 | i586 | i686 | x86_64)
1423 # Enable deflate_medium at level 1
1424 if testscip-shell system . . test. $without_new_strategies -eq 1; then
1425 CFLAGS="${CFLAGS} -DNO_QUICK_STRATEGY"
1426 SFLAGS="${SFLAGS} -DNO_QUICK_STRATEGY"
1427 fi
1428 # Enable deflate_medium at level 4-6
1429 if testscip-shell system . . test. $without_new_strategies -eq 1; then
1430 CFLAGS="${CFLAGS} -DNO_MEDIUM_STRATEGY"
1431 SFLAGS="${SFLAGS} -DNO_MEDIUM_STRATEGY"
1432 fi
1433 ;;
1434 esac
1435
1436 ARCHDIR='arch/generic'
1437 ARCH_STATIC_OBJS=''
1438 ARCH_SHARED_OBJS=''
1439
1440 # Set ARCH specific FLAGS
1441 case "${ARCH}" in
1442 # x86/amd64 specific optimizations
1443 i386 | i486 | i586 | i686 |x86_64)
1444 ARCHDIR=arch/x86
1445
1446 # Enable arch-specific optimizations
1447 if testscip-shell system . . test. $without_optimizations -eq 0; then
1448 CFLAGS="${CFLAGS} -DX86_FEATURES"
1449 SFLAGS="${SFLAGS} -DX86_FEATURES"
1450
1451 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} x86_features.o"
1452 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} x86_features.lo"
1453
1454 check_avx2_intrinsicsscip-shell shell shell-project 0.0.0 check_avx2_intrinsics().
1455
1456 if testscip-shell system . . test. ${HAVE_AVX2_INTRIN} -eq 1; then
1457 CFLAGS="${CFLAGS} -DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET"
1458 SFLAGS="${SFLAGS} -DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET"
1459 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} slide_hash_avx2.o chunkset_avx.o compare256_avx2.o adler32_avx2.o"
1460 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} slide_hash_avx2.lo chunkset_avx.lo compare256_avx2.lo adler32_avx2.lo"
1461 fi
1462
1463 check_avx512_intrinsicsscip-shell shell shell-project 0.0.0 check_avx512_intrinsics().
1464
1465 if testscip-shell system . . test. ${HAVE_AVX512_INTRIN} -eq 1; then
1466 CFLAGS="${CFLAGS} -DX86_AVX512 -DX86_AVX512_ADLER32"
1467 SFLAGS="${SFLAGS} -DX86_AVX512 -DX86_AVX512_ADLER32"
1468 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_avx512.o"
1469 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_avx512.lo"
1470
1471 check_mask_intrinsicsscip-shell shell shell-project 0.0.0 check_mask_intrinsics().
1472
1473 if testscip-shell system . . test. ${HAVE_MASK_INTRIN} -eq 1; then
1474 CFLAGS="${CFLAGS} -DX86_MASK_INTRIN"
1475 SFLAGS="${SFLAGS} -DX86_MASK_INTRIN"
1476 fi
1477 fi
1478
1479 check_avx512vnni_intrinsicsscip-shell shell shell-project 0.0.0 check_avx512vnni_intrinsics().
1480
1481 if testscip-shell system . . test. ${HAVE_AVX512VNNI_INTRIN} -eq 1; then
1482 CFLAGS="${CFLAGS} -DX86_AVX512VNNI -DX86_AVX512VNNI_ADLER32"
1483 SFLAGS="${SFLAGS} -DX86_AVX512VNNI -DX86_AVX512VNNI_ADLER32"
1484 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_avx512_vnni.o"
1485 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_avx512_vnni.lo"
1486 fi
1487
1488 check_sse41_intrinsicsscip-shell shell shell-project 0.0.0 check_sse41_intrinsics().
1489
1490 if testscip-shell system . . test. ${HAVE_SSE41_INTRIN} -eq 1; then
1491 CFLAGS="${CFLAGS} -DX86_SSE41"
1492 SFLAGS="${SFLAGS} -DX86_SSE41"
1493
1494 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} chunkset_sse41.o"
1495 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} chunkset_sse41.lo"
1496 fi
1497
1498 check_sse42_intrinsicsscip-shell shell shell-project 0.0.0 check_sse42_intrinsics().
1499
1500 if testscip-shell system . . test. ${HAVE_SSE42CRC_INTRIN} -eq 1 || testscip-shell system . . test. ${HAVE_SSE42CRC_INLINE_ASM} -eq 1; then
1501 CFLAGS="${CFLAGS} -DX86_SSE42_CRC_HASH -DX86_SSE42_ADLER32"
1502 SFLAGS="${SFLAGS} -DX86_SSE42_CRC_HASH -DX86_SSE42_ADLER32"
1503
1504 if testscip-shell system . . test. ${HAVE_SSE42CRC_INTRIN} -eq 1; then
1505 CFLAGS="${CFLAGS} -DX86_SSE42_CRC_INTRIN"
1506 SFLAGS="${SFLAGS} -DX86_SSE42_CRC_INTRIN"
1507 fi
1508
1509 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_sse42.o insert_string_sse42.o"
1510 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_sse42.lo insert_string_sse42.lo"
1511 fi
1512
1513 check_sse2_intrinsicsscip-shell shell shell-project 0.0.0 check_sse2_intrinsics().
1514
1515 if testscip-shell system . . test. ${HAVE_SSE2_INTRIN} -eq 1; then
1516 CFLAGS="${CFLAGS} -DX86_SSE2 -DX86_SSE2_CHUNKSET"
1517 SFLAGS="${SFLAGS} -DX86_SSE2 -DX86_SSE2_CHUNKSET"
1518 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} chunkset_sse2.o compare256_sse2.o slide_hash_sse2.o"
1519 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} chunkset_sse2.lo compare256_sse2.lo slide_hash_sse2.lo"
1520
1521 if testscip-shell system . . test. $forcesse2 -eq 1; then
1522 CFLAGS="${CFLAGS} -DX86_NOCHECK_SSE2"
1523 SFLAGS="${SFLAGS} -DX86_NOCHECK_SSE2"
1524 fi
1525 fi
1526
1527 check_ssse3_intrinsicsscip-shell shell shell-project 0.0.0 check_ssse3_intrinsics().
1528
1529 if testscip-shell system . . test. ${HAVE_SSSE3_INTRIN} -eq 1; then
1530 CFLAGS="${CFLAGS} -DX86_SSSE3 -DX86_SSSE3_ADLER32"
1531 SFLAGS="${SFLAGS} -DX86_SSSE3 -DX86_SSSE3_ADLER32"
1532 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_ssse3.o"
1533 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_ssse3.lo"
1534 fi
1535
1536 check_pclmulqdq_intrinsicsscip-shell shell shell-project 0.0.0 check_pclmulqdq_intrinsics().
1537
1538 if testscip-shell system . . test. ${HAVE_PCLMULQDQ_INTRIN} -eq 1; then
1539 CFLAGS="${CFLAGS} -DX86_PCLMULQDQ_CRC"
1540 SFLAGS="${SFLAGS} -DX86_PCLMULQDQ_CRC"
1541 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_fold_pclmulqdq.o"
1542 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_fold_pclmulqdq.lo"
1543
1544 if testscip-shell system . . test. $buildvpclmulqdq -eq 1; then
1545 check_vpclmulqdq_intrinsicsscip-shell shell shell-project 0.0.0 check_vpclmulqdq_intrinsics().
1546
1547 if testscip-shell system . . test. ${HAVE_VPCLMULQDQ_INTRIN} -eq 1 && testscip-shell system . . test. ${HAVE_AVX512_INTRIN} -eq 1; then
1548 CFLAGS="${CFLAGS} -DX86_VPCLMULQDQ_CRC"
1549 SFLAGS="${SFLAGS} -DX86_VPCLMULQDQ_CRC"
1550 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_fold_vpclmulqdq.o"
1551 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_fold_vpclmulqdq.lo"
1552 fi
1553 fi
1554 fi
1555
1556 if testscip-shell system . . test. $forcetzcnt -eq 1; then
1557 CFLAGS="${CFLAGS} -DX86_NOCHECK_TZCNT"
1558 SFLAGS="${SFLAGS} -DX86_NOCHECK_TZCNT"
1559 fi
1560 fi
1561 ;;
1562
1563 # ARM specific optimizations
1564 arm*)
1565 [scip-shell system . . `[`. ! -z $CROSS_PREFIX ] && QEMU_ARCH=arm
1566 ARCHDIR=arch/arm
1567
1568 if testscip-shell system . . test. $without_optimizations -eq 0; then
1569 CFLAGS="${CFLAGS} -DARM_FEATURES"
1570 SFLAGS="${SFLAGS} -DARM_FEATURES"
1571 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} arm_features.o"
1572 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} arm_features.lo"
1573
1574 if testscip-shell system . . test. $LINUX -eq 1; then
1575 catscip-shell system . . cat. > $test.c <<EOF
1576 #include <sys/auxv.h>
1577 int main() {
1578 return (getauxval(AT_HWCAP2) & HWCAP2_CRC32);
1579 }
1580 EOF
1581 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
1582 CFLAGS="${CFLAGS} -DARM_AUXV_HAS_CRC32"
1583 SFLAGS="${SFLAGS} -DARM_AUXV_HAS_CRC32"
1584 else
1585 catscip-shell system . . cat. > $test.c <<EOF
1586 #include <sys/auxv.h>
1587 #include <asm/hwcap.h>
1588 int main() {
1589 return (getauxval(AT_HWCAP2) & HWCAP2_CRC32);
1590 }
1591 EOF
1592 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
1593 CFLAGS="${CFLAGS} -DARM_AUXV_HAS_CRC32 -DARM_ASM_HWCAP"
1594 SFLAGS="${SFLAGS} -DARM_AUXV_HAS_CRC32 -DARM_ASM_HWCAP"
1595 else
1596 echoscip-shell system . . echo. "HWCAP2_CRC32 not present in sys/auxv.h; cannot detect support at runtime." | teescip-shell system . . tee. -a configure.log
1597 fi
1598 fi
1599
1600 catscip-shell system . . cat. > $test.c <<EOF
1601 #include <sys/auxv.h>
1602 int main() {
1603 return (getauxval(AT_HWCAP) & HWCAP_ARM_NEON);
1604 }
1605 EOF
1606 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
1607 CFLAGS="${CFLAGS} -DARM_AUXV_HAS_NEON"
1608 SFLAGS="${SFLAGS} -DARM_AUXV_HAS_NEON"
1609 else
1610 catscip-shell system . . cat. > $test.c <<EOF
1611 #include <sys/auxv.h>
1612 int main() {
1613 return (getauxval(AT_HWCAP) & HWCAP_NEON);
1614 }
1615 EOF
1616 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
1617 CFLAGS="${CFLAGS} -DARM_AUXV_HAS_NEON"
1618 SFLAGS="${SFLAGS} -DARM_AUXV_HAS_NEON"
1619 else
1620 echoscip-shell system . . echo. "Neither HWCAP_ARM_NEON or HWCAP_NEON present in sys/auxv.h; cannot detect support at runtime." | teescip-shell system . . tee. -a configure.log
1621 fi
1622 fi
1623 fi
1624 fi
1625
1626 catscip-shell system . . cat. > $test.c << EOF
1627 int main() { return 0; }
1628 EOF
1629 if tryscip-shell shell shell-project 0.0.0 try(). $CC -w -c $SFLAGS $test.c -mfloat-abi=softfp &&
1630 tryscip-shell shell shell-project 0.0.0 try(). $LDSHARED $LDSHAREDFLAGS $LDFLAGS -o $test$shared_ext $test.o $LDSHAREDLIBC; then
1631 floatabi="-mfloat-abi=softfp"
1632 else
1633 if tryscip-shell shell shell-project 0.0.0 try(). $CC -w -c $SFLAGS $test.c -mfloat-abi=hard &&
1634 tryscip-shell shell shell-project 0.0.0 try(). $LDSHARED $LDSHAREDFLAGS $LDFLAGS -o $test$shared_ext $test.o $LDSHAREDLIBC; then
1635 floatabi="-mfloat-abi=hard"
1636 fi
1637 fi
1638
1639 if [scip-shell system . . `[`. -z $floatabi ]; then
1640 echoscip-shell system . . echo. "ARM floating point arch not auto-detected" | teescip-shell system . . tee. -a configure.log
1641 else
1642 echoscip-shell system . . echo. "ARM floating point arch: ${floatabi}" | teescip-shell system . . tee. -a configure.log
1643
1644 CFLAGS="${CFLAGS} ${floatabi}"
1645 SFLAGS="${SFLAGS} ${floatabi}"
1646 fi
1647
1648 if testscip-shell system . . test. $without_optimizations -eq 0; then
1649 check_acle_compiler_flagscip-shell shell shell-project 0.0.0 check_acle_compiler_flag().
1650 check_neon_compiler_flagscip-shell shell shell-project 0.0.0 check_neon_compiler_flag().
1651 check_neon_ld4_intrinsicsscip-shell shell shell-project 0.0.0 check_neon_ld4_intrinsics().
1652 fi
1653
1654 case "${ARCH}" in
1655 armv[345]*)
1656 if testscip-shell system . . test. $without_optimizations -eq 0; then
1657 if testscip-shell system . . test. $buildacle -eq 1; then
1658 echoscip-shell system . . echo. ACLE support not available
1659 fi
1660
1661 if testscip-shell system . . test. $buildneon -eq 1; then
1662 echoscip-shell system . . echo. NEON support not available
1663 fi
1664 fi
1665 ;;
1666 armv6l | armv6hl)
1667 if testscip-shell system . . test. $without_optimizations -eq 0; then
1668 if testscip-shell system . . test. $buildacle -eq 1; then
1669 echoscip-shell system . . echo. ACLE support not available
1670 fi
1671
1672 if testscip-shell system . . test. $buildneon -eq 1; then
1673 echoscip-shell system . . echo. NEON support not available
1674 fi
1675 fi
1676 ;;
1677 arm | armv7*)
1678 if testscip-shell system . . test. $without_optimizations -eq 0; then
1679 if testscip-shell system . . test. $buildacle -eq 1; then
1680 echoscip-shell system . . echo. ACLE support not available
1681 fi
1682
1683 if testscip-shell system . . test. $buildneon -eq 1; then
1684 CFLAGS="${CFLAGS} -DARM_NEON"
1685 SFLAGS="${SFLAGS} -DARM_NEON"
1686
1687 if testscip-shell system . . test. $MFPU_NEON_AVAILABLE -eq 1; then
1688 neonflag="-mfpu=neon"
1689 fi
1690
1691 if testscip-shell system . . test. $NEON_HAS_LD4 -eq 1; then
1692 CFLAGS="${CFLAGS} -DARM_NEON_HASLD4"
1693 SFLAGS="${SFLAGS} -DARM_NEON_HASLD4"
1694 fi
1695
1696 CFLAGS="${CFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH"
1697 SFLAGS="${SFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH"
1698
1699 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_neon.o chunkset_neon.o compare256_neon.o slide_hash_neon.o"
1700 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_neon.lo chunkset_neon.lo compare256_neon.lo slide_hash_neon.lo"
1701 fi
1702 fi
1703 ;;
1704 armv8-a | armv8-a+simd)
1705 if testscip-shell system . . test. $without_optimizations -eq 0; then
1706 if testscip-shell system . . test. $buildacle -eq 1; then
1707 echoscip-shell system . . echo. ACLE support not available
1708 fi
1709
1710 if testscip-shell system . . test. $buildneon -eq 1; then
1711 CFLAGS="${CFLAGS} -DARM_NEON"
1712 SFLAGS="${SFLAGS} -DARM_NEON"
1713
1714 if testscip-shell system . . test. $MFPU_NEON_AVAILABLE -eq 1;then
1715 neonflag="-mfpu=neon"
1716 fi
1717
1718 if testscip-shell system . . test. $NEON_HAS_LD4 -eq 1; then
1719 CFLAGS="${CFLAGS} -DARM_NEON_HASLD4"
1720 SFLAGS="${SFLAGS} -DARM_NEON_HASLD4"
1721 fi
1722
1723 CFLAGS="${CFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH"
1724 SFLAGS="${SFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH"
1725
1726 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_neon.o chunkset_neon.o compare256_neon.o slide_hash_neon.o"
1727 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_neon.lo chunkset_neon.lo compare256_neon.lo slide_hash_neon.lo"
1728 fi
1729 fi
1730 ;;
1731 armv8-a+crc | armv8-a+crc+simd | armv8.[1234]-a | armv8.[1234]-a+simd)
1732 acleflag="-march=${ARCH}"
1733
1734 if testscip-shell system . . test. $without_optimizations -eq 0; then
1735 if testscip-shell system . . test. $ACLE_AVAILABLE -eq 1; then
1736 CFLAGS="${CFLAGS} -DARM_ACLE_CRC_HASH"
1737 SFLAGS="${SFLAGS} -DARM_ACLE_CRC_HASH"
1738
1739 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_acle.o insert_string_acle.o"
1740 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_acle.lo insert_string_acle.lo"
1741 fi
1742
1743 if testscip-shell system . . test. $buildneon -eq 1; then
1744 CFLAGS="${CFLAGS} -DARM_NEON"
1745 SFLAGS="${SFLAGS} -DARM_NEON"
1746
1747 if testscip-shell system . . test. $MFPU_NEON_AVAILABLE -eq 1;then
1748 neonflag="-mfpu=neon"
1749 fi
1750
1751 if testscip-shell system . . test. $NEON_HAS_LD4 -eq 1; then
1752 CFLAGS="${CFLAGS} -DARM_NEON_HASLD4"
1753 SFLAGS="${SFLAGS} -DARM_NEON_HASLD4"
1754 fi
1755
1756 CFLAGS="${CFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH"
1757 SFLAGS="${SFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH"
1758
1759 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_neon.o chunkset_neon.o compare256_neon.o slide_hash_neon.o"
1760 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_neon.lo chunkset_neon.lo compare256_neon.lo slide_hash_neon.lo"
1761 fi
1762 fi
1763 ;;
1764 esac
1765
1766 ;;
1767 # 64-bit ARM specific optimizations
1768 aarch64)
1769 [scip-shell system . . `[`. ! -z $CROSS_PREFIX ] && QEMU_ARCH=aarch64
1770 ARCHDIR=arch/arm
1771
1772 if testscip-shell system . . test. $native -eq 0; then
1773 ARCH="armv8-a"
1774 else
1775 ARCH="native"
1776 fi
1777
1778 if testscip-shell system . . test. $without_optimizations -eq 0; then
1779 check_neon_ld4_intrinsicsscip-shell shell shell-project 0.0.0 check_neon_ld4_intrinsics().
1780
1781 CFLAGS="${CFLAGS} -DARM_FEATURES"
1782 SFLAGS="${SFLAGS} -DARM_FEATURES"
1783 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} arm_features.o"
1784 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} arm_features.lo"
1785
1786 if testscip-shell system . . test. $LINUX -eq 1; then
1787 catscip-shell system . . cat. > $test.c <<EOF
1788 #include <sys/auxv.h>
1789 int main() {
1790 return (getauxval(AT_HWCAP) & HWCAP_CRC32);
1791 }
1792 EOF
1793 if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then
1794 CFLAGS="${CFLAGS} -DARM_AUXV_HAS_CRC32"
1795 SFLAGS="${SFLAGS} -DARM_AUXV_HAS_CRC32"
1796 else
1797 echoscip-shell system . . echo. "HWCAP_CRC32 not present in sys/auxv.h; cannot detect support at runtime." | teescip-shell system . . tee. -a configure.log
1798 fi
1799 fi
1800
1801 if testscip-shell system . . test. $NEON_HAS_LD4 -eq 1; then
1802 CFLAGS="${CFLAGS} -DARM_NEON_HASLD4"
1803 SFLAGS="${SFLAGS} -DARM_NEON_HASLD4"
1804 fi
1805
1806 if testscip-shell system . . test. $buildacle -eq 1; then
1807 if testscip-shell system . . test. $native -eq 0; then
1808 ARCH="${ARCH}+crc"
1809 fi
1810 CFLAGS="${CFLAGS} -DARM_ACLE_CRC_HASH"
1811 SFLAGS="${SFLAGS} -DARM_ACLE_CRC_HASH"
1812 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_acle.o insert_string_acle.o"
1813 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_acle.lo insert_string_acle.lo"
1814 fi
1815
1816 if testscip-shell system . . test. $buildneon -eq 1; then
1817 if testscip-shell system . . test. $native -eq 0; then
1818 ARCH="${ARCH}+simd"
1819 fi
1820 CFLAGS="${CFLAGS} -DARM_NEON -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH"
1821 SFLAGS="${SFLAGS} -DARM_NEON -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH"
1822 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_neon.o chunkset_neon.o compare256_neon.o slide_hash_neon.o"
1823 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_neon.lo chunkset_neon.lo compare256_neon.lo slide_hash_neon.lo"
1824 fi
1825 fi
1826
1827 neonflag="-march=${ARCH}"
1828 acleflag="-march=${ARCH}"
1829 ;;
1830 powerpc*)
1831 case "${ARCH}" in
1832 powerpc)
1833 [scip-shell system . . `[`. ! -z $CROSS_PREFIX ] && QEMU_ARCH=ppc
1834 ;;
1835 powerpc64)
1836 [scip-shell system . . `[`. ! -z $CROSS_PREFIX ] && QEMU_ARCH=ppc64
1837 ;;
1838 powerpc64le)
1839 [scip-shell system . . `[`. ! -z $CROSS_PREFIX ] && QEMU_ARCH=ppc64le
1840 ;;
1841 esac
1842
1843 ARCHDIR=arch/power
1844
1845 if testscip-shell system . . test. $without_optimizations -eq 0; then
1846
1847 check_ppc_intrinsicsscip-shell shell shell-project 0.0.0 check_ppc_intrinsics().
1848 check_power8_intrinsicsscip-shell shell shell-project 0.0.0 check_power8_intrinsics().
1849 check_power9_intrinsicsscip-shell shell shell-project 0.0.0 check_power9_intrinsics().
1850
1851 if testscip-shell system . . test. $HAVE_VMX -eq 1; then
1852 CFLAGS="${CFLAGS} -DPPC_FEATURES"
1853 SFLAGS="${SFLAGS} -DPPC_FEATURES"
1854 fi
1855 if testscip-shell system . . test. $HAVE_VMX -eq 1 -o $HAVE_POWER8_INTRIN -eq 1; then
1856 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} power_features.o"
1857 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} power_features.lo"
1858 fi
1859 if testscip-shell system . . test. $HAVE_VMX -eq 1 -a $HAVE_ALTIVEC_INTRIN -eq 1; then
1860 CFLAGS="${CFLAGS} -DPPC_VMX_ADLER32 -DPPC_VMX_SLIDEHASH"
1861 SFLAGS="${SFLAGS} -DPPC_VMX_ADLER32 -DPPC_VMX_SLIDEHASH"
1862
1863 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_vmx.o slide_hash_vmx.o"
1864 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_vmx.lo slide_hash_vmx.lo"
1865 fi
1866 if testscip-shell system . . test. $HAVE_POWER8_INTRIN -eq 1; then
1867 CFLAGS="${CFLAGS} -DPOWER8 -DPOWER_FEATURES -DPOWER8_VSX_ADLER32 -DPOWER8_VSX_CHUNKSET -DPOWER8_VSX_SLIDEHASH"
1868 SFLAGS="${SFLAGS} -DPOWER8 -DPOWER_FEATURES -DPOWER8_VSX_ADLER32 -DPOWER8_VSX_CHUNKSET -DPOWER8_VSX_SLIDEHASH"
1869
1870 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_power8.o chunkset_power8.o slide_hash_power8.o"
1871 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_power8.lo chunkset_power8.lo slide_hash_power8.lo"
1872 case "${ARCH}" in
1873 powerpc64*)
1874 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_power8.o"
1875 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_power8.lo"
1876 CFLAGS="${CFLAGS} -DPOWER8_VSX_CRC32"
1877 SFLAGS="${SFLAGS} -DPOWER8_VSX_CRC32"
1878 ;;
1879 esac
1880 fi
1881 if testscip-shell system . . test. $HAVE_POWER9_INTRIN -eq 1; then
1882 CFLAGS="${CFLAGS} -DPOWER9 -DPOWER_FEATURES"
1883 SFLAGS="${SFLAGS} -DPOWER9 -DPOWER_FEATURES"
1884
1885 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} compare256_power9.o"
1886 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} compare256_power9.lo"
1887 fi
1888 fi
1889 ;;
1890 s390x)
1891 [scip-shell system . . `[`. ! -z $CROSS_PREFIX ] && QEMU_ARCH=s390x
1892 ARCHDIR=arch/s390
1893
1894 if testscip-shell system . . test. $without_optimizations -eq 0; then
1895 if testscip-shell system . . test. $buildcrc32vx -eq 1; then
1896 CFLAGS="${CFLAGS} -DS390_FEATURES"
1897 SFLAGS="${SFLAGS} -DS390_FEATURES"
1898 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} s390_features.o"
1899 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} s390_features.lo"
1900 fi
1901
1902 if testscip-shell system . . test. $builddfltccdeflate -eq 1 -o $builddfltccinflate -eq 1; then
1903 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} dfltcc_common.o"
1904 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} dfltcc_common.lo"
1905 fi
1906
1907 if testscip-shell system . . test. $builddfltccdeflate -eq 1; then
1908 CFLAGS="${CFLAGS} -DS390_DFLTCC_DEFLATE"
1909 SFLAGS="${SFLAGS} -DS390_DFLTCC_DEFLATE"
1910 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} dfltcc_deflate.o"
1911 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} dfltcc_deflate.lo"
1912 ARCH="${ARCH}+dfltcc-deflate"
1913 fi
1914
1915 if testscip-shell system . . test. $builddfltccinflate -eq 1; then
1916 CFLAGS="${CFLAGS} -DS390_DFLTCC_INFLATE"
1917 SFLAGS="${SFLAGS} -DS390_DFLTCC_INFLATE"
1918 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} dfltcc_inflate.o"
1919 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} dfltcc_inflate.lo"
1920 ARCH="${ARCH}+dfltcc-inflate"
1921 fi
1922
1923 if testscip-shell system . . test. $buildcrc32vx -eq 1; then
1924 check_vgfma_intrinsicsscip-shell shell shell-project 0.0.0 check_vgfma_intrinsics().
1925 if testscip-shell system . . test. $HAVE_VGFMA_INTRIN -eq 1; then
1926 CFLAGS="${CFLAGS} -DS390_CRC32_VX"
1927 SFLAGS="${SFLAGS} -DS390_CRC32_VX"
1928 ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32-vx.o"
1929 ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32-vx.lo"
1930 ARCH="${ARCH}+crc32-vx"
1931 fi
1932 fi
1933 fi
1934 ;;
1935 *)
1936 [scip-shell system . . `[`. ! -z $CROSS_PREFIX ] && QEMU_ARCH=$ARCH
1937 ;;
1938 esac
1939
1940 echoscip-shell system . . echo. "ARCH: ${ARCH}"
1941 echoscip-shell system . . echo. "Using arch directory: ${ARCHDIR}"
1942 echoscip-shell system . . echo. "Architecture-specific static object files:${ARCH_STATIC_OBJS}"
1943 echoscip-shell system . . echo. "Architecture-specific shared object files:${ARCH_SHARED_OBJS}"
1944
1945 # show the results in the log
1946 echoscip-shell system . . echo. >> configure.log
1947 echoscip-shell system . . echo. ALL = $ALL >> configure.log
1948 echoscip-shell system . . echo. AR = $AR >> configure.log
1949 echoscip-shell system . . echo. ARFLAGS = $ARFLAGS >> configure.log
1950 echoscip-shell system . . echo. CC = $CC >> configure.log
1951 echoscip-shell system . . echo. CFLAGS = $CFLAGS >> configure.log
1952 echoscip-shell system . . echo. EXE = $EXE >> configure.log
1953 echoscip-shell system . . echo. LDCONFIG = $LDCONFIG >> configure.log
1954 echoscip-shell system . . echo. LDFLAGS = $LDFLAGS >> configure.log
1955 echoscip-shell system . . echo. LDSHARED = $LDSHARED >> configure.log
1956 echoscip-shell system . . echo. LDSHAREDFLAGS = $LDSHAREDFLAGS >> configure.log
1957 echoscip-shell system . . echo. LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
1958 echoscip-shell system . . echo. DEFFILE = $DEFFILE >> configure.log
1959 echoscip-shell system . . echo. RC = $RC >> configure.log
1960 echoscip-shell system . . echo. RCFLAGS = $RCFLAGS >> configure.log
1961 echoscip-shell system . . echo. RCOBJS = $RCOBJS >> configure.log
1962 echoscip-shell system . . echo. STRIP = $STRIP >> configure.log
1963 echoscip-shell system . . echo. OBJC = $OBJC >> configure.log
1964 echoscip-shell system . . echo. PIC_TESTOBJG = $PIC_TESTOBJG >> configure.log
1965 echoscip-shell system . . echo. PIC_OBJC = $PIC_OBJC >> configure.log
1966 echoscip-shell system . . echo. RANLIB = $RANLIB >> configure.log
1967 echoscip-shell system . . echo. SFLAGS = $SFLAGS >> configure.log
1968 echoscip-shell system . . echo. SHAREDLIB = $SHAREDLIB >> configure.log
1969 echoscip-shell system . . echo. SHAREDLIBM = $SHAREDLIBM >> configure.log
1970 echoscip-shell system . . echo. SHAREDLIBV = $SHAREDLIBV >> configure.log
1971 echoscip-shell system . . echo. SHAREDTARGET = $SHAREDTARGET >> configure.log
1972 echoscip-shell system . . echo. IMPORTLIB = $IMPORTLIB >> configure.log
1973 echoscip-shell system . . echo. INSTALLTARGETS = $INSTALLTARGETS >> configure.log
1974 echoscip-shell system . . echo. UNINSTALLTARGETS = $UNINSTALLTARGETS >> configure.log
1975 echoscip-shell system . . echo. SRCDIR = $SRCDIR >> configure.log
1976 echoscip-shell system . . echo. BUILDDIR = $BUILDDIR >> configure.log
1977 echoscip-shell system . . echo. STATICLIB = $STATICLIB >> configure.log
1978 echoscip-shell system . . echo. TEST = $TEST >> configure.log
1979 echoscip-shell system . . echo. VER = $VER >> configure.log
1980 echoscip-shell system . . echo. exec_prefix = $exec_prefix >> configure.log
1981 echoscip-shell system . . echo. includedir = $includedir >> configure.log
1982 echoscip-shell system . . echo. bindir = $bindir >> configure.log
1983 echoscip-shell system . . echo. libdir = $libdir >> configure.log
1984 echoscip-shell system . . echo. mandir = $mandir >> configure.log
1985 echoscip-shell system . . echo. prefix = $prefix >> configure.log
1986 echoscip-shell system . . echo. symbol_prefix = $symbol_prefix >> configure.log
1987 echoscip-shell system . . echo. sharedlibdir = $sharedlibdir >> configure.log
1988 echoscip-shell system . . echo. uname = $uname >> configure.log
1989 echoscip-shell system . . echo. sse2flag = $sse2flag >> configure.log
1990 echoscip-shell system . . echo. ssse3flag = $ssse3flag >> configure.log
1991 echoscip-shell system . . echo. sse41flag = $sse41flag >> configure.log
1992 echoscip-shell system . . echo. sse42flag = $sse42flag >> configure.log
1993 echoscip-shell system . . echo. pclmulflag = $pclmulflag >> configure.log
1994 echoscip-shell system . . echo. vpclmulflag = $vpclmulflag >> configure.log
1995 echoscip-shell system . . echo. acleflag = $acleflag >> configure.log
1996 echoscip-shell system . . echo. neonflag = $neonflag >> configure.log
1997 echoscip-shell system . . echo. ARCHDIR = ${ARCHDIR} >> configure.log
1998 echoscip-shell system . . echo. ARCH_STATIC_OBJS = ${ARCH_STATIC_OBJS} >> configure.log
1999 echoscip-shell system . . echo. ARCH_SHARED_OBJS = ${ARCH_SHARED_OBJS} >> configure.log
2000
2001 # Handle sed incompatibilities when using -i
2002 replace_in_filescip-shell shell shell-project 0.0.0 replace_in_file().() {
2003 if [scip-shell system . . `[`. "$OS" = 'Darwin' ]; then
2004 sedscip-shell system . . sed. -i '.tmp' -e "$1" "$2"
2005 else
2006 sedscip-shell system . . sed. -i'.tmp' -e "$1" "$2"
2007 fi
2008 }
2009
2010 # update Makefile with the configure results
2011
2012 INCLUDES="-I$SRCDIR"
2013 if [scip-shell system . . `[`. "$SRCDIR" != "$BUILDDIR" ]; then INCLUDES="-I$BUILDDIR ${INCLUDES}"; fi
2014
2015 sedscip-shell system . . sed. < $SRCDIR/Makefile.in "
2016 /^CC *=/s#=.*#=$CC#
2017 /^CFLAGS *=/s#=.*#=$CFLAGS#
2018 /^SFLAGS *=/s#=.*#=$SFLAGS#
2019 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
2020 /^LDSHARED *=/s#=.*#=$LDSHARED#
2021 /^LDSHAREDFLAGS *=/s#=.*#=$LDSHAREDFLAGS#
2022 /^LIBNAME1 *=/s#=.*#=$LIBNAME#
2023 /^LIBNAME2 *=/s#=.*#=$LIBNAME2#
2024 /^SUFFIX *=/s#=.*#=$SUFFIX#
2025 /^STATICLIB *=/s#=.*#=$STATICLIB#
2026 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
2027 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
2028 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
2029 /^SHAREDTARGET *=/s#=.*#=$SHAREDTARGET#
2030 /^IMPORTLIB *=/s#=.*#=$IMPORTLIB#
2031 /^VER *=/s#=.*#=$VER#
2032 /^VER1 *=/s#=.*#=$VER1#
2033 /^AR *=/s#=.*#=$AR#
2034 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
2035 /^RANLIB *=/s#=.*#=$RANLIB#
2036 /^LDCONFIG *=/s#=.*#=$LDCONFIG#
2037 /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
2038 /^DEFFILE *=/s#=.*#=$DEFFILE#
2039 /^RC *=/s#=.*#=$RC#
2040 /^RCFLAGS *=/s#=.*#=$RCFLAGS#
2041 /^RCOBJS *=/s#=.*#=$RCOBJS#
2042 /^STRIP *=/s#=.*#=$STRIP#
2043 /^EXE *=/s#=.*#=$EXE#
2044 /^prefix *=/s#=.*#= $prefix#
2045 /^exec_prefix *=/s#=.*#= $exec_prefix#
2046 /^bindir *=/s#=.*#= $bindir#
2047 /^symbol_prefix *=/s#=.*#= $symbol_prefix#
2048 /^libdir *=/s#=.*#= $libdir#
2049 /^sharedlibdir *=/s#=.*#= $sharedlibdir#
2050 /^includedir *=/s#=.*#= $includedir#
2051 /^mandir *=/s#=.*#= $mandir#
2052 /^SRCDIR *=/s#=.*#=$SRCDIR#
2053 /^INCLUDES *=/s#=.*#=$INCLUDES#
2054 /^OBJC *=/s#=.*#= $OBJC#
2055 /^PIC_TESTOBJG *=/s#=.*#= $PIC_TESTOBJG#
2056 /^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
2057 /^all: */s#:.*#: $ALL#
2058 /^install-libs: */s#:.*#: $INSTALLTARGETS#
2059 /^uninstall-libs: */s#:.*#: $UNINSTALLTARGETS#
2060 /^ARCHDIR *=/s#=.*#=$ARCHDIR#
2061 /^ARCH_STATIC_OBJS *=/s#=.*#=$ARCH_STATIC_OBJS#
2062 /^ARCH_SHARED_OBJS *=/s#=.*#=$ARCH_SHARED_OBJS#
2063 " > Makefile
2064
2065 # Append header files dependences.
2066 for file in $SRCDIR/*.c $SRCDIR/test/*.c $SRCDIR/test/fuzz/*.c $SRCDIR/$ARCHDIR/*.c $SRCDIR/tools/*.c; do
2067 short_name=$(echoscip-shell system . . echo. $file | sedscip-shell system . . sed. -e "s#$SRCDIR/##g")
2068 incs=$(grepscip-shell system . . grep. -h include $file | sedscip-shell system . . sed. -n 's/# *\include *"\(.*\.h\)".*/\1/p' | sortscip-shell system . . sort. | uniqscip-shell system . . uniq.)
2069 includes=$(for i in $incs; do
2070 # Check that the include file exists in the current dir,
2071 # otherwise it may be one of the system include header.
2072 if testscip-shell system . . test. -e $SRCDIR/$i; then
2073 echoscip-shell system . . echo. -n " \$(SRCDIR)/$i"
2074 fi
2075 # We also need to check whether the include file is in the ARCHDIR.
2076 if testscip-shell system . . test. -e $SRCDIR/$ARCHDIR/$i; then
2077 echoscip-shell system . . echo. -n " \$(SRCDIR)/$ARCHDIR/$i"
2078 fi
2079 done)
2080 obj=$(basenamescip-shell system . . basename. $(echoscip-shell system . . echo. $file | sedscip-shell system . . sed. -e 's/\.c/\.o/g' -e 's#^\./##g'))
2081 lobj=$(basenamescip-shell system . . basename. $(echoscip-shell system . . echo. $file | sedscip-shell system . . sed. -e 's/\.c/\.lo/g' -e 's#^\./##g'))
2082
2083 if grepscip-shell system . . grep. -q "^$obj:" Makefile; then
2084 # Replace the existing line with a line with all dependences.
2085 $(replace_in_filescip-shell shell shell-project 0.0.0 replace_in_file(). "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" Makefile)
2086 else
2087 # Append at the end of Makefile a new line with the header dependences.
2088 echoscip-shell system . . echo. "$obj: \$(SRCDIR)/$short_name $includes" >> Makefile
2089
2090 # In case this is one of the ARCHDIR files, append a dependence line
2091 # that will force the `$(MAKE) -C $(ARCHDIR)` generic rule. Without this
2092 # we would only execute the copy rule from ARCHDIR to SRCDIR.
2093 if testscip-shell system . . test. -e $SRCDIR/$ARCHDIR/$(basenamescip-shell system . . basename. $file); then
2094 echoscip-shell system . . echo. "$ARCHDIR/$obj: \$(SRCDIR)/$short_name $includes" >> Makefile
2095 fi
2096 fi
2097
2098 if grepscip-shell system . . grep. -q "^$lobj:" Makefile; then
2099 # Replace the existing line with a line with all dependences.
2100 $(replace_in_filescip-shell shell shell-project 0.0.0 replace_in_file(). "s#$lobj:.*#$lobj: \$(SRCDIR)/$short_name $includes#g" Makefile)
2101 else
2102 # Append at the end of Makefile a new line with the header dependences.
2103 echoscip-shell system . . echo. "$lobj: \$(SRCDIR)/$short_name $includes" >> Makefile
2104 fi
2105 done
2106
2107 # Generate Makefile in arch dir
2108 mkdirscip-shell system . . mkdir. -p $ARCHDIR
2109
2110 ARCHINCLUDES="-I$SRCDIR/$ARCHDIR -I$SRCDIR"
2111 if [scip-shell system . . `[`. "$SRCDIR" != "$BUILDDIR" ]; then ARCHINCLUDES="-I$BUILDDIR ${ARCHINCLUDES}"; fi
2112
2113 sedscip-shell system . . sed. < $SRCDIR/$ARCHDIR/Makefile.in "
2114 /^CC *=/s#=.*#=$CC#
2115 /^CFLAGS *=/s#=.*#=$CFLAGS#
2116 /^SFLAGS *=/s#=.*#=$SFLAGS#
2117 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
2118 /^INCLUDES *=/s#=.*#=$ARCHINCLUDES#
2119 /^SUFFIX *=/s#=.*#=$SUFFIX#
2120 /^SRCDIR *=/s#=.*#=$SRCDIR/$ARCHDIR#
2121 /^SRCTOP *=/s#=.*#=$SRCDIR#
2122 /^BUILDDIR *=/s#=.*#=$BUILDDIR#
2123 /^AVX2FLAG *=/s#=.*#=$avx2flag#
2124 /^AVX512FLAG *=/s#=.*#=$avx512flag#
2125 /^AVX512VNNIFLAG *=/s#=.*#=$avx512vnniflag#
2126 /^SSE2FLAG *=/s#=.*#=$sse2flag#
2127 /^SSSE3FLAG *=/s#=.*#=$ssse3flag#
2128 /^SSE41FLAG *=/s#=.*#=$sse41flag#
2129 /^SSE42FLAG *=/s#=.*#=$sse42flag#
2130 /^PCLMULFLAG *=/s#=.*#=$pclmulflag#
2131 /^VPCLMULFLAG *=/s#=.*#=$vpclmulflag#
2132 /^ACLEFLAG *=/s#=.*#=$acleflag#
2133 /^NEONFLAG *=/s#=.*#=$neonflag#
2134 /^NOLTOFLAG *=/s#=.*#=$noltoflag#
2135 /^VGFMAFLAG *=/s#=.*#=$vgfmaflag#
2136 /^PPCFLAGS *=/s#=.*#=$vmxflag#
2137 " > $ARCHDIR/Makefile
2138
2139 # Append header files dependences.
2140 for file in $SRCDIR/$ARCHDIR/*.c; do
2141 incs=$(grepscip-shell system . . grep. -h include $file | sedscip-shell system . . sed. -n 's/# *\include *"\(.*\.h\)".*/\1/p' | sortscip-shell system . . sort. | uniqscip-shell system . . uniq.)
2142 includes=$(for i in $incs; do
2143 # Check that the include file exists in the current dir,
2144 # otherwise it may be one of the system include header.
2145 if testscip-shell system . . test. -e $SRCDIR/$i; then
2146 echoscip-shell system . . echo. -n " \$(SRCTOP)/$i"
2147 fi
2148 # We also need to check whether the include file is in the ARCHDIR.
2149 if testscip-shell system . . test. -e $SRCDIR/$ARCHDIR/$i; then
2150 echoscip-shell system . . echo. -n " \$(SRCDIR)/$i"
2151 fi
2152 done)
2153 obj=$(basenamescip-shell system . . basename. $(echoscip-shell system . . echo. $file | sedscip-shell system . . sed. -e 's/\.c/\.o/g' -e 's#^\./##g'))
2154 lobj=$(basenamescip-shell system . . basename. $(echoscip-shell system . . echo. $file | sedscip-shell system . . sed. -e 's/\.c/\.lo/g' -e 's#^\./##g'))
2155 short_name=$(basenamescip-shell system . . basename. $file)
2156 if grepscip-shell system . . grep. -q "^$obj:" $ARCHDIR/Makefile; then
2157 # Replace the existing line with a line with all dependences.
2158 $(replace_in_filescip-shell shell shell-project 0.0.0 replace_in_file(). "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" $ARCHDIR/Makefile)
2159 else
2160 # Append at the end of Makefile a new line with the header dependences.
2161 echoscip-shell system . . echo. "$obj: \$(SRCDIR)/$short_name $includes" >> $ARCHDIR/Makefile
2162 fi
2163
2164 if grepscip-shell system . . grep. -q "^$lobj:" $ARCHDIR/Makefile; then
2165 # Replace the existing line with a line with all dependences.
2166 $(replace_in_filescip-shell shell shell-project 0.0.0 replace_in_file(). "s#$lobj:.*#$lobj: \$(SRCDIR)/$short_name $includes#g" $ARCHDIR/Makefile)
2167 else
2168 # Append at the end of Makefile a new line with the header dependences.
2169 echoscip-shell system . . echo. "$lobj: \$(SRCDIR)/$short_name $includes" >> $ARCHDIR/Makefile
2170 fi
2171 done
2172
2173 # Generate Makefile in test dir
2174 mkdirscip-shell system . . mkdir. -p test
2175 if testscip-shell system . . test. $QEMU_ARCH; then QEMU_RUN="qemu-$QEMU_ARCH -L /usr/${CHOST}/"; fi
2176 sedscip-shell system . . sed. < $SRCDIR/test/Makefile.in "
2177 /^CC *=/s#=.*#=$CC#
2178 /^CFLAGS *=/s#=.*#=$CFLAGS#
2179 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
2180 /^EXE *=/s#=.*#=$EXE#
2181 /^oldtests: */s#:.*#: $TEST#
2182 /^SRCDIR *=/s#=.*#=$SRCDIR/test#
2183 /^SRCTOP *=/s#=.*#=$SRCDIR#
2184 /^QEMU_RUN *=/s#=.*#=$QEMU_RUN#
2185 /^LIBNAME *=/s#=.*#=$LIBNAME#
2186 " > test/Makefile
2187
2188 # create zlib.pc with the configure results
2189 sedscip-shell system . . sed. < $SRCDIR/zlib.pc.in "
2190 /^CC *=/s#=.*#=$CC#
2191 /^CFLAGS *=/s#=.*#=$CFLAGS#
2192 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
2193 /^LDSHARED *=/s#=.*#=$LDSHARED#
2194 /^LDSHAREDFLAGS *=/s#=.*#=$LDSHAREDFLAGS#
2195 /^STATICLIB *=/s#=.*#=$STATICLIB#
2196 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
2197 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
2198 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
2199 /^IMPORTLIB *=/s#=.*#=$IMPORTLIB#
2200 /^AR *=/s#=.*#=$AR#
2201 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
2202 /^RANLIB *=/s#=.*#=$RANLIB#
2203 /^EXE *=/s#=.*#=$EXE#
2204 /^prefix *=/s#=.*#=$prefix#
2205 /^exec_prefix *=/s#=.*#=$exec_prefix#
2206 /^bindir *=/s#=.*#=$bindir#
2207 /^symbol_prefix *=/s#=.*#=$symbol_prefix#
2208 /^libdir *=/s#=.*#=$libdir#
2209 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
2210 /^includedir *=/s#=.*#=$includedir#
2211 /^mandir *=/s#=.*#=$mandir#
2212 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
2213 " | sedscip-shell system . . sed. -e "
2214 s/\@VERSION\@/$VER/g;
2215 s/\@SUFFIX\@/$SUFFIX/g;
2216 " > ${LIBNAME2}.pc
2217
2218 # done
2219 leavescip-shell shell shell-project 0.0.0 leave(). 0