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
|
dnl We create a function for detecting which compiler we use and then set as
dnl pendantic compiler options as possible for that particular compiler. The
dnl options are only used for debug-builds.
dnl This is a copy of the original found in curl's configure script. Don't
dnl modify this one, edit the one in curl and copy it back here when that one
dnl is changed.
AC_DEFUN([CURL_CC_DEBUG_OPTS],
[
if test "$GCC" = "yes"; then
dnl figure out gcc version!
AC_MSG_CHECKING([gcc version])
gccver=`$CC -dumpversion`
num1=`echo $gccver | cut -d . -f1`
num2=`echo $gccver | cut -d . -f2`
gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
AC_MSG_RESULT($gccver)
AC_MSG_CHECKING([if this is icc in disguise])
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
dnl action if the text is found, this it has not been replaced by the
dnl cpp
ICC="no"
AC_MSG_RESULT([no]),
dnl the text was not found, it was replaced by the cpp
ICC="yes"
AC_MSG_RESULT([yes])
)
if test "$ICC" = "yes"; then
dnl this is icc, not gcc.
dnl ICC warnings we ignore:
dnl * 279 warns on static conditions in while expressions
dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
dnl "invalid format string conversion"
WARN="-wd279,269"
if test "$gccnum" -gt "600"; then
dnl icc 6.0 and older doesn't have the -Wall flag
WARN="-Wall $WARN"
fi
else dnl $ICC = yes
dnl
WARN="-W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wundef -Wpointer-arith -Wnested-externs -Winline -Wmissing-declarations -Wmissing-prototypes -Wsign-compare"
dnl -Wcast-align is a bit too annoying ;-)
if test "$gccnum" -ge "296"; then
dnl gcc 2.96 or later
WARN="$WARN -Wfloat-equal"
if test "$gccnum" -gt "296"; then
dnl this option does not exist in 2.96
WARN="$WARN -Wno-format-nonliteral"
fi
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
dnl on i686-Linux as it gives us heaps with false positives
if test "$gccnum" -ge "303"; then
dnl gcc 3.3 and later
WARN="$WARN -Wendif-labels -Wstrict-prototypes"
fi
fi
for flag in $CPPFLAGS; do
case "$flag" in
-I*)
dnl include path
add=`echo $flag | sed 's/^-I/-isystem /g'`
WARN="$WARN $add"
;;
esac
done
fi dnl $ICC = no
CFLAGS="$CFLAGS $WARN"
fi dnl $GCC = yes
dnl strip off optimizer flags
NEWFLAGS=""
for flag in $CFLAGS; do
case "$flag" in
-O*)
dnl echo "cut off $flag"
;;
*)
NEWFLAGS="$NEWFLAGS $flag"
;;
esac
done
CFLAGS=$NEWFLAGS
]) dnl end of AC_DEFUN()
dnl This macro determines if the specified struct exists in the specified file
dnl Syntax:
dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found])
AC_DEFUN([CARES_CHECK_STRUCT], [
AC_MSG_CHECKING([for struct $2])
AC_TRY_COMPILE([$1],
[
struct $2 struct_instance;
], ac_struct="yes", ac_found="no")
if test "$ac_struct" = "yes" ; then
AC_MSG_RESULT(yes)
$3
else
AC_MSG_RESULT(no)
$4
fi
])
dnl This macro determins if the specified struct contains a specific member.
dnl Syntax:
dnl CARES_CHECK_STRUCT_MEMBER(headers, struct name, member name, if found, [if not found])
AC_DEFUN([CARES_CHECK_STRUCT_MEMBER], [
AC_MSG_CHECKING([if struct $2 has member $3])
AC_TRY_COMPILE([$1],
[
struct $2 struct_instance;
struct_instance.$3 = 0;
], ac_struct="yes", ac_found="no")
if test "$ac_struct" = "yes" ; then
AC_MSG_RESULT(yes)
$4
else
AC_MSG_RESULT(no)
$5
fi
])
dnl This macro determines if the specified constant exists in the specified file
dnl Syntax:
dnl CARES_CHECK_CONSTANT(headers, constant name, if found, [if not found])
AC_DEFUN([CARES_CHECK_CONSTANT], [
AC_MSG_CHECKING([for $2])
AC_EGREP_CPP(VARIABLEWASDEFINED,
[
$1
#ifdef $2
VARIABLEWASDEFINED
#else
NJET
#endif
], ac_constant="yes", ac_constant="no"
)
if test "$ac_constant" = "yes" ; then
AC_MSG_RESULT(yes)
$3
else
AC_MSG_RESULT(no)
$4
fi
])
|