Debian Codegraph @

config/oneapi-flags

raw
1 # -*- shell-script -*-
2 #
3 # This file is part of the HDF4 build script. It is processed shortly
4 # after configure starts and defines, among other things, flags for
5 # the various compilation modes.
6
7 #
8 # Prepend `$srcdir/config/intel-warnings/` to the filename suffix(es) given as
9 # subroutine argument(s), remove comments starting with # and ending
10 # at EOL, replace spans of whitespace (including newlines) with spaces,
11 # and re-emit the file(s) thus filtered on the standard output stream.
12 #
13 load_intel_arguments()
14 {
15 set -- $(for arg; do
16 sed 's,#.*$,,' $srcdir/config/intel-warnings/${arg}
17 done)
18 IFS=' ' echo "$*"
19 }
20
21 # Get the compiler version in a way that works for icx
22 # icx unless a compiler version is already known
23 # cc_vendor: The compiler name: icx
24 # cc_version: Version number: 2023.2.0
25 #
26 if test X = "X$cc_flags_set"; then
27 cc_version="`$CC $CFLAGS -V 2>&1 |grep 'oneAPI'`"
28 if test X != "X$cc_version"; then
29 cc_vendor=icx
30 cc_version=`echo $cc_version |sed 's/.*Version \([-a-z0-9\.\-]*\).*/\1/'`
31 echo "compiler '$CC' is Intel oneAPI $cc_vendor-$cc_version"
32
33 # Some version numbers
34 # Intel oneAPI version numbers are of the form: "major.minor.patch"
35 cc_vers_major=`echo $cc_version | cut -f1 -d.`
36 cc_vers_minor=`echo $cc_version | cut -f2 -d.`
37 cc_vers_patch=`echo $cc_version | cut -f2 -d.`
38 test -n "$cc_vers_major" || cc_vers_major=0
39 test -n "$cc_vers_minor" || cc_vers_minor=0
40 test -n "$cc_vers_patch" || cc_vers_patch=0
41 cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch`
42 fi
43 fi
44
45 # Common Intel flags for various situations
46 if test "X-icx" = "X-$cc_vendor"; then
47
48 CFLAGS="$CFLAGS -std=c99 -Wall"
49 CFLAGS="$CFLAGS -Wno-error=implicit-function-declaration"
50
51 DEBUG_CFLAGS="-g -O0"
52 DEBUG_CPPFLAGS=
53 PROD_CFLAGS="-O3"
54 PROD_CPPFLAGS=
55 PROFILE_CFLAGS="-pg"
56 PROFILE_CPPFLAGS=
57
58 # Add various general warning flags in intel-warnings.
59 CFLAGS="$CFLAGS $(load_intel_arguments oneapi/general)"
60
61 #################
62 # Flags are set #
63 #################
64 cc_flags_set=yes
65 fi
66
67 # Clear cc info if no flags set
68 if test "X-$cc_flags_set" = "X-"; then
69 cc_vendor=
70 cc_version=
71 fi