aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m420
-rw-r--r--configure.ac8
-rw-r--r--m4/curl-functions.m4284
3 files changed, 289 insertions, 23 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 4d42be49e..c21ca89f3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2601,26 +2601,6 @@ fi
])
-AC_DEFUN([CURL_CHECK_LOCALTIME_R],
-[
- dnl check for localtime_r
- AC_CHECK_FUNCS(localtime_r,[
- AC_MSG_CHECKING(whether localtime_r is declared)
- AC_EGREP_CPP(localtime_r,[
-#undef _REENTRANT
-#include <time.h>],[
- AC_MSG_RESULT(yes)],[
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
- AC_EGREP_CPP(localtime_r,[
-#undef _REENTRANT
-#define _REENTRANT
-#include <time.h>],[
- AC_MSG_RESULT(yes)],
- AC_MSG_RESULT(no))])])
-])
-
-
AC_DEFUN([CURL_CHECK_INET_NTOA_R],
[
dnl determine if function definition for inet_ntoa_r exists.
diff --git a/configure.ac b/configure.ac
index 306751082..af6fae5e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1853,7 +1853,7 @@ else
CURL_CHECK_INET_NTOA_R()
dnl is there a localtime_r()
- CURL_CHECK_LOCALTIME_R()
+ dnl the old localtime_r check was done here
dnl is there a strerror_r()
dnl the old strerror_r check was done here
@@ -1874,7 +1874,7 @@ if test "x$RECENTAIX" = "xyes"; then
AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
dnl is there a localtime_r()
- CURL_CHECK_LOCALTIME_R()
+ dnl the old localtime_r check was done here
dnl is there a strerror_r()
dnl the old strerror_r check was done here
@@ -2038,7 +2038,9 @@ CURL_CHECK_MSG_NOSIGNAL
CURL_CHECK_FUNC_FDOPEN
CURL_CHECK_FUNC_FTRUNCATE
+CURL_CHECK_FUNC_GETHOSTNAME
CURL_CHECK_FUNC_GMTIME_R
+CURL_CHECK_FUNC_LOCALTIME_R
CURL_CHECK_FUNC_SIGACTION
CURL_CHECK_FUNC_STRCASECMP
CURL_CHECK_FUNC_STRCASESTR
@@ -2050,6 +2052,7 @@ CURL_CHECK_FUNC_STRLCAT
CURL_CHECK_FUNC_STRNCASECMP
CURL_CHECK_FUNC_STRNCMPI
CURL_CHECK_FUNC_STRNICMP
+CURL_CHECK_FUNC_STRSTR
CURL_CHECK_FUNC_STRTOK_R
CURL_CHECK_FUNC_STRTOLL
CURL_CHECK_FUNC_WRITEV
@@ -2090,7 +2093,6 @@ AC_CHECK_FUNCS([basename \
signal \
sigsetjmp \
socket \
- strstr \
uname \
utime
],[
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index 3c11c8df9..123bd2704 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -353,6 +353,91 @@ AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [
])
+dnl CURL_CHECK_FUNC_GETHOSTNAME
+dnl -------------------------------------------------
+dnl Verify if gethostname is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_gethostname, then
+dnl HAVE_GETHOSTNAME will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
+ AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
+ #
+ tst_links_gethostname="unknown"
+ tst_proto_gethostname="unknown"
+ tst_compi_gethostname="unknown"
+ tst_allow_gethostname="unknown"
+ #
+ AC_MSG_CHECKING([if gethostname can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([gethostname])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_gethostname="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_gethostname="no"
+ ])
+ #
+ if test "$tst_links_gethostname" = "yes"; then
+ AC_MSG_CHECKING([if gethostname is prototyped])
+ AC_EGREP_CPP([gethostname],[
+ $curl_includes_unistd
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_gethostname="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_gethostname="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_gethostname" = "yes"; then
+ AC_MSG_CHECKING([if gethostname is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_unistd
+ ]],[[
+ if(0 != gethostname(0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_gethostname="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_gethostname="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_gethostname" = "yes"; then
+ AC_MSG_CHECKING([if gethostname usage allowed])
+ if test "x$curl_disallow_gethostname" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_gethostname="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_gethostname="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if gethostname might be used])
+ if test "$tst_links_gethostname" = "yes" &&
+ test "$tst_proto_gethostname" = "yes" &&
+ test "$tst_compi_gethostname" = "yes" &&
+ test "$tst_allow_gethostname" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
+ [Define to 1 if you have the gethostname function.])
+ ac_cv_func_gethostname="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_gethostname="no"
+ fi
+])
+
+
dnl CURL_CHECK_FUNC_GMTIME_R
dnl -------------------------------------------------
dnl Verify if gmtime_r is available, prototyped, can
@@ -467,6 +552,120 @@ AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
])
+dnl CURL_CHECK_FUNC_LOCALTIME_R
+dnl -------------------------------------------------
+dnl Verify if localtime_r is available, prototyped, can
+dnl be compiled and seems to work. If all of these are
+dnl true, and usage has not been previously disallowed
+dnl with shell variable curl_disallow_localtime_r, then
+dnl HAVE_LOCALTIME_R will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_LOCALTIME_R], [
+ AC_REQUIRE([CURL_INCLUDES_TIME])dnl
+ #
+ tst_links_localtime_r="unknown"
+ tst_proto_localtime_r="unknown"
+ tst_compi_localtime_r="unknown"
+ tst_works_localtime_r="unknown"
+ tst_allow_localtime_r="unknown"
+ #
+ AC_MSG_CHECKING([if localtime_r can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([localtime_r])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_localtime_r="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_localtime_r="no"
+ ])
+ #
+ if test "$tst_links_localtime_r" = "yes"; then
+ AC_MSG_CHECKING([if localtime_r is prototyped])
+ AC_EGREP_CPP([localtime_r],[
+ $curl_includes_time
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_localtime_r="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_localtime_r="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_localtime_r" = "yes"; then
+ AC_MSG_CHECKING([if localtime_r is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_time
+ ]],[[
+ if(0 != localtime_r(0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_localtime_r="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_localtime_r="no"
+ ])
+ fi
+ #
+ dnl only do runtime verification when not cross-compiling
+ if test "x$cross_compiling" != "xyes" &&
+ test "$tst_compi_localtime_r" = "yes"; then
+ AC_MSG_CHECKING([if localtime_r seems to work])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_time
+ ]],[[
+ time_t clock = 1170352587;
+ struct tm *tmp = 0;
+ struct tm result;
+ tmp = localtime_r(&clock, &result);
+ if(tmp)
+ exit(0);
+ else
+ exit(1);
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_works_localtime_r="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_works_localtime_r="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_localtime_r" = "yes" &&
+ test "$tst_works_localtime_r" != "no"; then
+ AC_MSG_CHECKING([if localtime_r usage allowed])
+ if test "x$curl_disallow_localtime_r" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_localtime_r="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_localtime_r="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if localtime_r might be used])
+ if test "$tst_links_localtime_r" = "yes" &&
+ test "$tst_proto_localtime_r" = "yes" &&
+ test "$tst_compi_localtime_r" = "yes" &&
+ test "$tst_allow_localtime_r" = "yes" &&
+ test "$tst_works_localtime_r" != "no"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_LOCALTIME_R, 1,
+ [Define to 1 if you have a working localtime_r function.])
+ ac_cv_func_localtime_r="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_localtime_r="no"
+ fi
+])
+
+
dnl CURL_CHECK_FUNC_SIGACTION
dnl -------------------------------------------------
dnl Verify if sigaction is available, prototyped, and
@@ -1573,6 +1772,91 @@ AC_DEFUN([CURL_CHECK_FUNC_STRNICMP], [
])
+dnl CURL_CHECK_FUNC_STRSTR
+dnl -------------------------------------------------
+dnl Verify if strstr is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_strstr, then
+dnl HAVE_STRSTR will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRSTR], [
+ AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+ #
+ tst_links_strstr="unknown"
+ tst_proto_strstr="unknown"
+ tst_compi_strstr="unknown"
+ tst_allow_strstr="unknown"
+ #
+ AC_MSG_CHECKING([if strstr can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([strstr])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_strstr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_strstr="no"
+ ])
+ #
+ if test "$tst_links_strstr" = "yes"; then
+ AC_MSG_CHECKING([if strstr is prototyped])
+ AC_EGREP_CPP([strstr],[
+ $curl_includes_string
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_strstr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_strstr="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_strstr" = "yes"; then
+ AC_MSG_CHECKING([if strstr is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_string
+ ]],[[
+ if(0 != strstr(0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_strstr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_strstr="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_strstr" = "yes"; then
+ AC_MSG_CHECKING([if strstr usage allowed])
+ if test "x$curl_disallow_strstr" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_strstr="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_strstr="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if strstr might be used])
+ if test "$tst_links_strstr" = "yes" &&
+ test "$tst_proto_strstr" = "yes" &&
+ test "$tst_compi_strstr" = "yes" &&
+ test "$tst_allow_strstr" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_STRSTR, 1,
+ [Define to 1 if you have the strstr function.])
+ ac_cv_func_strstr="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_strstr="no"
+ fi
+])
+
+
dnl CURL_CHECK_FUNC_STRTOK_R
dnl -------------------------------------------------
dnl Verify if strtok_r is available, prototyped, and