forked from BOINC/boinc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boinc_set_compile_flags.m4
151 lines (143 loc) · 4.37 KB
/
boinc_set_compile_flags.m4
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
AC_DEFUN([BOINC_SET_COMPILE_FLAGS],[
dnl This function sets the compiler flags depending upon options
dnl set on the configure command line.
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[enable tracing and debugging flags for all components]),
[enable_debug="$enableval"],
[])
AC_ARG_ENABLE(optimize,
AS_HELP_STRING([--enable-optimize],
[enable optimization flags for all components]),
[enable_optimize="$enableval"],
[])
AC_ARG_ENABLE(generic-processor,
AS_HELP_STRING([--enable-generic-processor],
[build for a generic processor rather than a specific instruction set]),
[enable_generic_processor="$enableval"],
[])
dnl enable compiler warnings
if test x${ac_cv_c_compiler_gnu} = xyes ; then
BOINC_CHECK_CFLAG(-Wall)
BOINC_CHECK_CXXFLAG(-Wall)
BOINC_CHECK_FFLAG(-Wall)
fi
dnl enable debug mode on all components using standard debug flags
if test x${enable_debug} = xyes ; then
BOINC_CHECK_CFLAG(-g)
BOINC_CHECK_CXXFLAG(-g)
BOINC_CHECK_FFLAG(-g)
BOINC_CHECK_LDFLAG(-g)
CXXFLAGS="$CXXFLAGS -DDEBUG -D_DEBUG"
CFLAGS="$CFLAGS -DDEBUG -D_DEBUG"
fi
if test x${enable_optimize} = xyes ; then
if test x${ac_cv_c_compiler_gnu} = xyes ; then
BOINC_CHECK_CFLAG(-ffast-math)
else
BOINC_CHECK_CFLAG(-fast)
fi
BOINC_CHECK_CFLAG(-O3)
if test x${ac_cv_cxx_compiler_gnu} = xyes ; then
BOINC_CHECK_CXXFLAG(-ffast-math)
else
BOINC_CHECK_CXXFLAG(-fast)
fi
BOINC_CHECK_CXXFLAG(-O3)
if test x${ac_cv_f77_compiler_gnu} = xyes ; then
BOINC_CHECK_FFLAG(-ffast-math)
else
BOINC_CHECK_FFLAG(-fast)
fi
BOINC_CHECK_FFLAG(-O3)
fi
if test x${enable_generic_processor} = xyes ; then
case ${target} in
i*86-*-darwin*)
BOINC_CHECK_CFLAG(-march=pentium4)
BOINC_CHECK_CFLAG(-mtune=prescott)
BOINC_CHECK_CXXFLAG(-march=pentium4)
BOINC_CHECK_CXXFLAG(-mtune=prescott)
BOINC_CHECK_FFLAG(-march=pentium4)
BOINC_CHECK_FFLAG(-mtune=prescott)
;;
i*86-*)
dnl gcc
if test x${ac_cv_c_compiler_gnu} = xyes ; then
BOINC_CHECK_CFLAG(-march=i486)
BOINC_CHECK_CFLAG(-mtune=generic)
else
dnl sun studio
BOINC_CHECK_CFLAG(-xarch=386)
dnl dmc
BOINC_CHECK_CFLAG(-3)
fi
if test x${ac_cv_cxx_compiler_gnu} = xyes ; then
BOINC_CHECK_CXXFLAG(-march=i486)
BOINC_CHECK_CXXFLAG(-mtune=generic)
else
BOINC_CHECK_CXXFLAG(-xarch=386)
BOINC_CHECK_CXXFLAG(-3)
fi
if test x${ac_cv_f77_compiler_gnu} = xyes ; then
BOINC_CHECK_FFLAG(-march=i486)
BOINC_CHECK_FFLAG(-mtune=generic)
else
BOINC_CHECK_FFLAG(-xarch=386)
BOINC_CHECK_FFLAG(-3)
fi
;;
x86_64-*|amd64-*)
dnl gcc
if test x${ac_cv_c_compiler_gnu} = xyes ; then
BOINC_CHECK_CFLAG(-msse2)
BOINC_CHECK_CFLAG(-march=opteron)
BOINC_CHECK_CFLAG(-mtune=generic)
else
BOINC_CHECK_CFLAG(-xarch=amd64)
fi
if test x${ac_cv_cxx_compiler_gnu} = xyes ; then
BOINC_CHECK_CXXFLAG(-msse2)
BOINC_CHECK_CXXFLAG(-march=opteron)
BOINC_CHECK_CXXFLAG(-mtune=generic)
else
BOINC_CHECK_CXXFLAG(-xarch=amd64)
fi
if test x${ac_cv_f77_compiler_gnu} = xyes ; then
BOINC_CHECK_FFLAG(-msse2)
BOINC_CHECK_FFLAG(-march=opteron)
BOINC_CHECK_FFLAG(-mtune=generic)
else
BOINC_CHECK_FFLAG(-xarch=amd64)
fi
;;
sparc-*)
dnl gcc
if test x${ac_cv_c_compiler_gnu} = xyes ; then
BOINC_CHECK_CFLAG(-march=v8)
BOINC_CHECK_CFLAG(-mcpu=v8)
BOINC_CHECK_CFLAG(-mtune=ultrasparc)
else
dnl Studio 10
BOINC_CHECK_CFLAG(-xarch=v8)
fi
if test x${ac_cv_cxx_compiler_gnu} = xyes ; then
BOINC_CHECK_CXXFLAG(-march=v8)
BOINC_CHECK_CXXFLAG(-mcpu=v8)
BOINC_CHECK_CXXFLAG(-mtune=ultrasparc)
else
BOINC_CHECK_CXXFLAG(-xarch=v8)
fi
if test x${ac_cv_f77_compiler_gnu} = xyes ; then
BOINC_CHECK_FFLAG(-march=v8)
BOINC_CHECK_FFLAG(-mcpu=v8)
BOINC_CHECK_FFLAG(-mtune=ultrasparc)
else
BOINC_CHECK_FFLAG(-xarch=v8)
fi
;;
*)
;;
esac
fi
])