Newer
Older
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
Daniel Stenberg
committed
# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# $Id$
#***************************************************************************
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
dnl CURL_CHECK_COMPILER_HALT_ON_ERROR
dnl -------------------------------------------------
dnl Verifies if the compiler actually halts after the
dnl compilation phase without generating any object
dnl code file, when the source compiles with errors.
AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [
AC_MSG_CHECKING([if compiler halts on compilation errors])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
]],[[
force compilation error
]])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([compiler does not halt on compilation errors.])
],[
AC_MSG_RESULT([yes])
])
])
dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
dnl -------------------------------------------------
dnl Verifies if the compiler actually halts after the
dnl compilation phase without generating any object
dnl code file, when the source code tries to define a
dnl type for a constant array with negative dimension.
AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl
AC_MSG_CHECKING([if compiler halts on negative sized arrays])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
]],[[
bad_t dummy;
]])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([compiler does not halt on negative sized arrays.])
],[
AC_MSG_RESULT([yes])
])
])
dnl -------------------------------------------------
dnl Use the C preprocessor to find out if the given object-style symbol
dnl is defined and get its expansion. This macro will not use default
dnl includes even if no INCLUDES argument is given. This macro will run
dnl silently when invoked with three arguments. If the expansion would
dnl result in a set of double-quoted strings the returned expansion will
dnl actually be a single double-quoted string concatenating all them.
AC_DEFUN([CURL_CHECK_DEF], [
AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
if test -z "$SED"; then
AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
fi
if test -z "$GREP"; then
AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
fi
ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
tmp_exp=""
AC_PREPROC_IFELSE([
AC_LANG_SOURCE(
ifelse($2,,,[$2])[[
#ifdef $1
CURL_DEF_TOKEN $1
#endif
]])
],[
tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
"$GREP" CURL_DEF_TOKEN 2>/dev/null | \
"$SED" 's/.*CURL_DEF_TOKEN[[ ]]//' 2>/dev/null | \
"$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
tmp_exp=""
fi
])
if test -z "$tmp_exp"; then
ifelse($3,,[AC_MSG_RESULT([no])])
else
AS_VAR_SET(ac_HaveDef, yes)
AS_VAR_SET(ac_Def, $tmp_exp)
ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
fi
AS_VAR_POPDEF([ac_Def])dnl
AS_VAR_POPDEF([ac_HaveDef])dnl
])
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
dnl CURL_SETUP_VARS_ALPHA_SETS
dnl -------------------------------------------------
dnl Set up variables with sets of several letters.
AC_DEFUN([CURL_SETUP_VARS_ALPHA_SETS], [
curl_cv_letters='abcdefghijklmnopqrstuvwxyz'
curl_cv_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
curl_cv_Letters=$curl_cv_letters$curl_cv_LETTERS
curl_cv_digits='0123456789'
curl_cv_alnum=$curl_cv_Letters$curl_cv_digits
])
dnl CURL_CHECK_DEF_INTXX_C (INTXX_C, [INCLUDES])
dnl -------------------------------------------------
dnl Use the C preprocessor to find out if the given INTXX_C function-style
dnl macro is defined and get the suffix part of its expansion. This macro
dnl will not use default includes even if no INCLUDES argument is given.
AC_DEFUN([CURL_CHECK_DEF_INTXX_C], [
AC_REQUIRE([CURL_SETUP_VARS_ALPHA_SETS])dnl
AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
if test -z "$SED"; then
AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
fi
if test -z "$GREP"; then
AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
fi
tmp_suf=""
AC_PREPROC_IFELSE([
AC_LANG_SOURCE(
ifelse($2,,,[$2])[[
#ifdef $1
$1(CURL_DEF_TOKEN)
#endif
]])
],[
echo " " >&6
echo "DEBUG: preproc IF-ACTION branch for $1 -----" >&6
echo "DEBUG: ------- preproc source follows: " >&6
sed 's/^/cpp-src> /' conftest.$ac_ext >&6
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.yang2 1>conftest.yang1
echo "DEBUG: ------- preproc STDOUT follows: " >&6
sed 's/^/cpp-out> /' conftest.yang1 >&6
echo "DEBUG: ------- preproc STDERR follows: " >&6
sed 's/^/cpp-err> /' conftest.yang2 >&6
echo "DEBUG: ------- preproc STDERR ends in above line. " >&6
echo "DEBUG: ------- shell tmp_suf follows: " >&6
tmp_suf=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
"$GREP" CURL_DEF_TOKEN 2>/dev/null | \
"$SED" 's/.*CURL_DEF_TOKEN//' 2>/dev/null | \
"$SED" 's/[[^'"$curl_cv_alnum"']]//g' 2>/dev/null`
echo "DEBUG: $tmp_suf" >&6
echo "DEBUG: ------- shell tmp_suf ends in above line. " >&6
if test -z "$tmp_suf"; then
tmp_suf=""
fi
],[
echo " " >&6
echo "DEBUG: preproc ELSE-ACTION branch for $1 -----" >&6
echo "DEBUG: ------- preproc source follows: " >&6
sed 's/^/cpp-src> /' conftest.$ac_ext >&6
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.yang2 1>conftest.yang1
echo "DEBUG: ------- preproc STDOUT follows: " >&6
sed 's/^/cpp-out> /' conftest.yang1 >&6
echo "DEBUG: ------- preproc STDERR follows: " >&6
sed 's/^/cpp-err> /' conftest.yang2 >&6
echo "DEBUG: ------- preproc STDERR ends in above line. " >&6
])
rm -f conftest.yang1
rm -f conftest.yang2
Loading
Loading full blame…