File: ac_cxx_flags_preset.m4

package info (click to toggle)
blitz++ 1:1.0.2+ds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 8,568 kB
  • sloc: cpp: 57,803; python: 1,941; fortran: 1,510; f90: 852; makefile: 833; sh: 321
file content (191 lines) | stat: -rw-r--r-- 5,509 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191

dnl Compiler flags preset
AC_DEFUN([AC_CXX_FLAGS_PRESET],[

dnl Declare variables which we want substituted in the Makefile.in's

dnl AC_SUBST(CXXFLAGS)
AC_SUBST(CXX_OPTIMIZE_FLAGS)
AC_SUBST(CXX_DEBUG_FLAGS)
AC_SUBST(CXX_PROFIL_FLAGS)
AC_SUBST(CXX_LIBS)
AC_SUBST(AR)
AC_SUBST(AR_FLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(RANLIB)

dnl Set default values
AR_FLAGS="-cru"
LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"


AC_MSG_CHECKING([whether using $CXX preset flags])
AC_ARG_ENABLE(cxx-flags-preset,
AS_HELP_STRING([--enable-cxx-flags-preset],
[Enable C++ compiler flags preset @<:@default yes@:>@]),[],[enableval='yes'])

if test "$enableval" = yes ; then

	ac_cxx_flags_preset=yes

	case "$CXX" in
	*xlc++*) dnl IBM C++ compiler for Darwin
		CXX_VENDOR="IBM"
		CXXFLAGS="-qrtti"
		CXX_OPTIMIZE_FLAGS="-O3 -qstrict -qstrict_induction -qinline -qmaxmem=8192 -qansialias -qhot -qunroll=yes"
		CXX_DEBUG_FLAGS="-g -qcheck=all -DBZ_DEBUG"
		CXX_PROFIL_FLAGS="-pg"
	;;      
	*xlC*)  dnl IBM Visual Age C++   http://www.ibm.com/
		CXX_VENDOR="IBM"
		CXXFLAGS="-qrtti=all"
		CXX_OPTIMIZE_FLAGS="-O3 -qstrict -qstrict_induction -qinline -qmaxmem=8192 -qansialias -qhot -qunroll=yes"
		CXX_DEBUG_FLAGS="-g -qcheck=all -DBZ_DEBUG"
		CXX_PROFIL_FLAGS="-pg"
	;;      
	*clang++) dnl frontend for LLVM http://clang.llvm.org/
		CXX_VENDOR="LLVM"
		CXXFLAGS="-ansi"
		CXX_OPTIMIZE_FLAGS="-O3"
		CXX_DEBUG_FLAGS="-g -O0 -DBZ_DEBUG"
		CXX_PROFIL_FLAGS="-pg"
	;;
	*icpc*|*icc*) dnl Intel icc http://www.intel.com/
		CXX_VENDOR="Intel"
		CXXFLAGS="-ansi" dnl -strict_ansi flag causes trouble
		CXX_OPTIMIZE_FLAGS="-O3 -Zp16 -ip -ansi_alias"
		CXX_DEBUG_FLAGS="-g -O0 -C -DBZ_DEBUG"
		CXX_PROFIL_FLAGS="-pg"
	;;
	*cxx*)  dnl Compaq C++  http://www.compaq.com/
		CXX_VENDOR="Compaq"
		CXX_V=`cxx -V`
		cxx_version=`expr "$CXX_V" : '.*\(@<:@0-9@:>@\)\..*'`
		cxx_release=`expr "$CXX_V" : '.*@<:@0-9@:>@\.\(@<:@0-9@:>@\).*'`
		if test $cxx_version -eq "6" -a $cxx_release -lt "3" ; then
			CXXFLAGS="-std ansi -D__USE_STD_IOSTREAM -DBZ_ENABLE_XOPEN_SOURCE -ieee -model ansi -accept restrict_keyword -nousing_std"
		else
			CXXFLAGS="-std ansi -D__USE_STD_IOSTREAM -DBZ_ENABLE_XOPEN_SOURCE -D_OSF_SOURCE -ieee -model ansi -accept restrict_keyword -nousing_std"
		fi
		CXX_OPTIMIZE_FLAGS="-fast -inline speed -nocleanup"
		CXX_DEBUG_FLAGS="-g -msg_display_tag -DBZ_DEBUG"
		CXX_PROFIL_FLAGS="-pg -g1"
		AR="ar"
		AR_FLAGS="-rv"
		RANLIB="ar ts"
	;;
	*g++*|*c++*)  dnl GNU C++  http://gcc.gnu.org/
		CXX_VENDOR="GNU" 
		GCC_V=`$CXX --version`
		gcc_version=`expr "$GCC_V" : '.* \(@<:@0-9@:>@\)\..*'`
		gcc_release=`expr "$GCC_V" : '.* @<:@0-9@:>@\.\(@<:@0-9@:>@\).*'`
		if test $gcc_version -lt "3" ; then
			CXXFLAGS="-ftemplate-depth-40"
			CXX_OPTIMIZE_FLAGS="-O2 -funroll-loops -fstrict-aliasing -fno-gcse"
		else
			CXXFLAGS="$(dpkg-buildflags --get CXXFLAGS)"
			CXX_OPTIMIZE_FLAGS="-O3 -funroll-loops -fstrict-aliasing -fomit-frame-pointer -ffast-math"
		fi
		CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
		CXX_PROFIL_FLAGS="-pg"
	;;
	*KCC*)  dnl KAI C++  http://www.kai.com/
		CXX_VENDOR="KAI"
		CXXFLAGS="--restrict"
		CXX_OPTIMIZE_FLAGS="+K3"
		CXX_DEBUG_FLAGS="+K0 -g -DBZ_DEBUG"
		AR="$CXX"
		AR_FLAGS="-o"
		case "$target" in
		*sgi*) dnl SGI C backend compiler
			CXX_OPTIMIZE_FLAGS="$CXX_OPTIMIZE_FLAGS --backend -Ofast"
		;;
		*ibm*) dnl IBM xlC backend compiler
			CXX_OPTIMIZE_FLAGS="$CXX_OPTIMIZE_FLAGS -O5 --backend -qstrict --backend -qstrict_induction"
		;;
		*) dnl other C backend compiler
			CXX_OPTIMIZE_FLAGS="$CXX_OPTIMIZE_FLAGS -O"
		;;
		esac
	;;
	*aCC*)  dnl HP aCC http://www.hp.com/go/c++
		CXX_VENDOR="HP"
		CXXFLAGS="-AA"
		CXX_OPTIMIZE_FLAGS="+O2"
		CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
		CXX_PROFIL_FLAGS="+pal"
	;;
	*FCC*)  dnl Fujitsu C++
		CXX_VENDOR="Fujitsu"
		CXXFLAGS="-D__FUJITSU"
		CXX_OPTIMIZE_FLAGS="-K fast"
		CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
	;;
	*pgCC*) dnl Portland Group   http://www.pgroup.com
		CXX_VENDOR="PGI"
		CXXFLAGS=""
		CXX_OPTIMIZE_FLAGS="-O4 -Mnoframe -Mnodepchk -Minline=levels:25"
		CXX_DEBUG_FLAGS="-g -O0 -DBZ_DEBUG"
	;;
	*pathCC*) dnl Pathscale pathCC compiler   http://www.pathscale.com
		CXX_VENDOR="pathCC"
		CXXFLAGS="-ansi"
		CXX_OPTIMIZE_FLAGS="-O3 -fstrict-aliasing -finline-functions"
		CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
		CXX_PROFIL_FLAGS="-pg"
		AR="$CXX"
		AR_FLAGS="-ar -o"
	;;
	*CC*) 
		case "$target" in
		*sgi*) dnl SGI C++  http://www.sgi.com
			CXX_VENDOR="SGI"
			CXXFLAGS="-LANG:std -LANG:restrict -no_auto_include"
			CXX_OPTIMIZE_FLAGS="-O3 -IPA -OPT:Olimit=0:alias=typed:swp=ON"
			CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
			AR="$CXX"
			AR_FLAGS="-ar -o"
		;;
		*solaris*) dnl SunPRO C++ http://www.sun.com
			CXX_VENDOR="SUN"
			CXXFLAGS="-features=tmplife -library=stlport4"
			CXX_OPTIMIZE_FLAGS="-O3"
			CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
		;;
		*cray*) dnl Cray C++
			CXX_VENDOR="Cray"
			CXXFLAGS="-h conform"
			CXX_OPTIMIZE_FLAGS="-O3 -h unroll,aggress,scalar2"
			CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
		;;
		*fujitsu*) dnl Fujitsu C++ http://www.fujitsu.com
			CXX_VENDOR="Fujitsu"
			CXXFLAGS="-D__FUJITSU --stdlib"
			CXX_OPTIMIZE_FLAGS="-K3"
			CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
		;;
		esac
	;;
	*) 
		ac_cxx_flags_preset=no
	;;
	esac
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
fi

if test "$ac_cxx_flags_preset" = yes ; then
	if test "$CXX_VENDOR" = GNU ; then
		AC_MSG_NOTICE([Setting compiler flags for $CXX_VENDOR $CXX (wahoo!)])
	else
		AC_MSG_NOTICE([Setting compiler flags for $CXX_VENDOR $CXX])
	fi
else

	AC_MSG_NOTICE([No flags preset found for $CXX])
fi

])