1
#***************************************************************************
3
# Project ___| | | | _ \| |
5
# | (__| |_| | _ <| |___
6
# \___|\___/|_| \_\_____|
8
# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
10
# This software is licensed as described in the file COPYING, which
11
# you should have received as part of this distribution. The terms
12
# are also available at http://curl.haxx.se/docs/copyright.html.
14
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
# copies of the Software, and permit persons to whom the Software is
16
# furnished to do so, under the terms of the COPYING file.
18
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
# KIND, either express or implied.
21
# $Id: curl-confopts.m4,v 1.4 2008-11-13 18:56:56 yangtse Exp $
22
#***************************************************************************
24
# File version for 'aclocal' use. Keep it a single number.
28
dnl CURL_CHECK_OPTION_DEBUG
29
dnl -------------------------------------------------
30
dnl Verify if configure has been invoked with option
31
dnl --enable-debug or --disable-debug, and set shell
32
dnl variable want_debug value as appropriate.
34
AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
35
AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl
36
AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl
37
AC_MSG_CHECKING([whether to enable debug build options])
38
OPT_DEBUG_BUILD="default"
40
AC_HELP_STRING([--enable-debug],[Enable debug build options])
41
AC_HELP_STRING([--disable-debug],[Disable debug build options]),
42
OPT_DEBUG_BUILD=$enableval)
43
case "$OPT_DEBUG_BUILD" in
45
dnl --disable-debug option used
49
dnl configure option not specified
53
dnl --enable-debug option used
57
AC_MSG_RESULT([$want_debug])
61
dnl CURL_CHECK_OPTION_NONBLOCKING
62
dnl -------------------------------------------------
63
dnl Verify if configure has been invoked with option
64
dnl --enable-nonblocking or --disable-nonblocking, and
65
dnl set shell variable want_nonblocking as appropriate.
67
AC_DEFUN([CURL_CHECK_OPTION_NONBLOCKING], [
68
AC_BEFORE([$0],[CURL_CHECK_NONBLOCKING_SOCKET])dnl
69
AC_MSG_CHECKING([whether to enable non-blocking communications])
70
OPT_NONBLOCKING="default"
71
AC_ARG_ENABLE(nonblocking,
72
AC_HELP_STRING([--enable-nonblocking],[Enable non-blocking communications])
73
AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking communications]),
74
OPT_NONBLOCKING=$enableval)
75
case "$OPT_NONBLOCKING" in
77
dnl --disable-nonblocking option used
81
dnl configure option not specified
82
want_nonblocking="yes"
85
dnl --enable-nonblocking option used
86
want_nonblocking="yes"
89
AC_MSG_RESULT([$want_nonblocking])
93
dnl CURL_CHECK_OPTION_OPTIMIZE
94
dnl -------------------------------------------------
95
dnl Verify if configure has been invoked with option
96
dnl --enable-optimize or --disable-optimize, and set
97
dnl shell variable want_optimize value as appropriate.
99
AC_DEFUN([CURL_CHECK_OPTION_OPTIMIZE], [
100
AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
101
AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl
102
AC_MSG_CHECKING([whether to enable compiler optimizer])
103
OPT_COMPILER_OPTIMIZE="default"
104
AC_ARG_ENABLE(optimize,
105
AC_HELP_STRING([--enable-optimize],[Enable compiler optimizations])
106
AC_HELP_STRING([--disable-optimize],[Disable compiler optimizations]),
107
OPT_COMPILER_OPTIMIZE=$enableval)
108
case "$OPT_COMPILER_OPTIMIZE" in
110
dnl --disable-optimize option used. We will handle this as
111
dnl a request to disable compiler optimizations if possible.
112
dnl If the compiler is known CFLAGS and CPPFLAGS will be
113
dnl overridden, otherwise this can not be honored.
118
dnl configure's optimize option not specified. Initially we will
119
dnl handle this as a a request contrary to configure's setting
120
dnl for --enable-debug. IOW, initially, for debug-enabled builds
121
dnl this will be handled as a request to disable optimizations if
122
dnl possible, and for debug-disabled builds this will be handled
123
dnl initially as a request to enable optimizations if possible.
124
dnl Finally, if the compiler is known and CFLAGS and CPPFLAGS do
125
dnl not have any optimizer flag the request will be honored, in
126
dnl any other case the request can not be honored.
127
dnl IOW, existing optimizer flags defined in CFLAGS or CPPFLAGS
128
dnl will always take precedence over any initial assumption.
129
if test "$want_debug" = "yes"; then
130
want_optimize="assume_no"
131
AC_MSG_RESULT([not specified (assuming no)])
133
want_optimize="assume_yes"
134
AC_MSG_RESULT([not specified (assuming yes)])
138
dnl --enable-optimize option used. We will handle this as
139
dnl a request to enable compiler optimizations if possible.
140
dnl If the compiler is known CFLAGS and CPPFLAGS will be
141
dnl overridden, otherwise this can not be honored.
149
dnl CURL_CHECK_OPTION_WARNINGS
150
dnl -------------------------------------------------
151
dnl Verify if configure has been invoked with option
152
dnl --enable-warnings or --disable-warnings, and set
153
dnl shell variable want_warnings as appropriate.
155
AC_DEFUN([CURL_CHECK_OPTION_WARNINGS], [
156
AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
157
AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl
158
AC_MSG_CHECKING([whether to enable strict compiler warnings])
159
OPT_COMPILER_WARNINGS="default"
160
AC_ARG_ENABLE(warnings,
161
AC_HELP_STRING([--enable-warnings],[Enable strict compiler warnings])
162
AC_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
163
OPT_COMPILER_WARNINGS=$enableval)
164
case "$OPT_COMPILER_WARNINGS" in
166
dnl --disable-warnings option used
170
dnl configure option not specified, so
171
dnl use same setting as --enable-debug
172
want_warnings="$want_debug"
175
dnl --enable-warnings option used
179
AC_MSG_RESULT([$want_warnings])
183
dnl CURL_CHECK_NONBLOCKING_SOCKET
184
dnl -------------------------------------------------
185
dnl Check for how to set a socket into non-blocking state.
187
AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
188
AC_REQUIRE([CURL_CHECK_OPTION_NONBLOCKING])dnl
189
AC_REQUIRE([CURL_CHECK_FUNC_FCNTL])dnl
190
AC_REQUIRE([CURL_CHECK_FUNC_IOCTL])dnl
191
AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET])dnl
192
AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL])dnl
193
AC_REQUIRE([CURL_CHECK_FUNC_SETSOCKOPT])dnl
196
if test "$want_nonblocking" = "yes"; then
197
AC_MSG_CHECKING([how to set a socket into non-blocking mode])
198
if test "x$ac_cv_func_fcntl_o_nonblock" = "xyes"; then
199
tst_method="fcntl O_NONBLOCK"
200
elif test "x$ac_cv_func_ioctl_fionbio" = "xyes"; then
201
tst_method="ioctl FIONBIO"
202
elif test "x$ac_cv_func_ioctlsocket_fionbio" = "xyes"; then
203
tst_method="ioctlsocket FIONBIO"
204
elif test "x$ac_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then
205
tst_method="IoctlSocket FIONBIO"
206
elif test "x$ac_cv_func_setsockopt_so_nonblock" = "xyes"; then
207
tst_method="setsockopt SO_NONBLOCK"
209
AC_MSG_RESULT([$tst_method])
210
if test "$tst_method" = "unknown"; then
211
AC_MSG_WARN([cannot determine non-blocking socket method.])
214
if test "$tst_method" = "unknown"; then
215
AC_DEFINE_UNQUOTED(USE_BLOCKING_SOCKETS, 1,
216
[Define to disable non-blocking sockets.])
217
AC_MSG_WARN([non-blocking sockets disabled.])