summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2006-07-07 17:34:40 +0000
committerYang Tse <yangsita@gmail.com>2006-07-07 17:34:40 +0000
commit04369e1134101bd4ea176cef45e87b2c7640432f (patch)
tree63a7cbc165ae31a904a2823d0784ddda62f49750 /acinclude.m4
parentf3643c497b271c60884088e930b30ddfe604ff33 (diff)
downloadc-ares-04369e1134101bd4ea176cef45e87b2c7640432f.tar.gz
c-ares-04369e1134101bd4ea176cef45e87b2c7640432f.tar.bz2
c-ares-04369e1134101bd4ea176cef45e87b2c7640432f.zip
Finally get rid of CURL_CHECK_HEADERS_ONCE since it adds very little value and has portability issues.
Change some shell if...then...fi tests into case...esac tests which demand less resources.
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m497
1 files changed, 45 insertions, 52 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index e81f6a4..05739f1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,25 +1,5 @@
-dnl CURL_CHECK_HEADERS_ONCE
-dnl -------------------------------------------------
-dnl Check for headers if check not already done.
-
-AC_DEFUN([CURL_CHECK_HEADERS_ONCE], [
- for f_hdr in $1
- do
- u_hdr=`echo "$f_hdr" | sed 's/[-|\.|\/]/_/g'`
- eval prev_check_res=\$ac_cv_header_$u_hdr
- case "$prev_check_res" in
- yes | no)
- ;;
- *)
- AC_CHECK_HEADERS($f_hdr)
- ;;
- esac
- done
-])
-
-
dnl CURL_CHECK_HEADER_WINDOWS
dnl -------------------------------------------------
dnl Check for compilable and valid windows.h header
@@ -46,12 +26,14 @@ AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
ac_cv_header_windows_h="no"
])
])
- if test "x$ac_cv_header_windows_h" = "xyes"; then
- AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
- [Define to 1 if you have the windows.h header file.])
- AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
- [Define to avoid automatic inclusion of winsock.h])
- fi
+ case "$ac_cv_header_windows_h" in
+ yes)
+ AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
+ [Define to 1 if you have the windows.h header file.])
+ AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
+ [Define to avoid automatic inclusion of winsock.h])
+ ;;
+ esac
])
@@ -83,10 +65,12 @@ AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
ac_cv_header_winsock_h="no"
])
])
- if test "x$ac_cv_header_winsock_h" = "xyes"; then
- AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
- [Define to 1 if you have the winsock.h header file.])
- fi
+ case "$ac_cv_header_winsock_h" in
+ yes)
+ AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
+ [Define to 1 if you have the winsock.h header file.])
+ ;;
+ esac
])
@@ -118,10 +102,12 @@ AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
ac_cv_header_winsock2_h="no"
])
])
- if test "x$ac_cv_header_winsock2_h" = "xyes"; then
- AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
- [Define to 1 if you have the winsock2.h header file.])
- fi
+ case "$ac_cv_header_winsock2_h" in
+ yes)
+ AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
+ [Define to 1 if you have the winsock2.h header file.])
+ ;;
+ esac
])
@@ -154,10 +140,12 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
ac_cv_header_ws2tcpip_h="no"
])
])
- if test "x$ac_cv_header_ws2tcpip_h" = "xyes"; then
- AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
- [Define to 1 if you have the ws2tcpip.h header file.])
- fi
+ case "$ac_cv_header_ws2tcpip_h" in
+ yes)
+ AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
+ [Define to 1 if you have the ws2tcpip.h header file.])
+ ;;
+ esac
])
@@ -209,12 +197,15 @@ AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
done
done
])
- if test "$curl_cv_socklen_t_equiv" = "unknown"; then
- AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
- else
- AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
- [type to use in place of socklen_t if not defined])
- fi
+ case "$curl_cv_socklen_t_equiv" in
+ unknown)
+ AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+ ;;
+ *)
+ AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
+ [type to use in place of socklen_t if not defined])
+ ;;
+ esac
],[
#undef inline
#ifdef HAVE_WINDOWS_H
@@ -254,7 +245,7 @@ dnl argument in GETNAMEINFO_QUAL_ARG1.
AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl
- CURL_CHECK_HEADERS_ONCE(sys/types.h sys/socket.h netdb.h)
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
#
AC_MSG_CHECKING([for getnameinfo])
AC_LINK_IFELSE([
@@ -482,7 +473,7 @@ dnl Check for working NI_WITHSCOPEID in getnameinfo()
AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
- CURL_CHECK_HEADERS_ONCE(stdio.h sys/types.h sys/socket.h \
+ AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
netdb.h netinet/in.h arpa/inet.h)
#
AC_CACHE_CHECK([for working NI_WITHSCOPEID],
@@ -563,10 +554,12 @@ AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
]) # AC_COMPILE_IFELSE
]) # AC_RUN_IFELSE
]) # AC_CACHE_CHECK
- if test "x$ac_cv_working_ni_withscopeid" = "xyes"; then
- AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
- [Define to 1 if NI_WITHSCOPEID exists and works.])
- fi
+ case "$ac_cv_working_ni_withscopeid" in
+ yes)
+ AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
+ [Define to 1 if NI_WITHSCOPEID exists and works.])
+ ;;
+ esac
]) # AC_DEFUN
@@ -583,7 +576,7 @@ dnl return value in RECV_TYPE_RETV.
AC_DEFUN([CURL_CHECK_FUNC_RECV], [
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
- CURL_CHECK_HEADERS_ONCE(sys/types.h sys/socket.h)
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h)
#
AC_MSG_CHECKING([for recv])
AC_TRY_LINK([
@@ -712,7 +705,7 @@ dnl type qualifier of second argument in SEND_QUAL_ARG2.
AC_DEFUN([CURL_CHECK_FUNC_SEND], [
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
- CURL_CHECK_HEADERS_ONCE(sys/types.h sys/socket.h)
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h)
#
AC_MSG_CHECKING([for send])
AC_TRY_LINK([