diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/curl-functions.m4 | 218 |
1 files changed, 216 insertions, 2 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index abe52a0cd..f59963983 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -25,6 +25,27 @@ # serial 1 +dnl CURL_INCLUDES_SIGNAL +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when signal.h is to be included. + +AC_DEFUN([CURL_INCLUDES_SIGNAL], [ +curl_includes_signal="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SIGNAL_H +# include <signal.h> +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h signal.h, + [], [], [$curl_includes_signal]) +]) + + dnl CURL_INCLUDES_STDLIB dnl ------------------------------------------------- dnl Set up variable with list of headers that must be @@ -46,6 +67,27 @@ curl_includes_stdlib="\ ]) +dnl CURL_INCLUDES_STRING +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when string.h is to be included. + +AC_DEFUN([CURL_INCLUDES_STRING], [ +curl_includes_string="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_STRING_H +# include <string.h> +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h string.h, + [], [], [$curl_includes_string]) +]) + + dnl CURL_INCLUDES_TIME dnl ------------------------------------------------- dnl Set up variable with list of headers that must be @@ -122,7 +164,8 @@ AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [ AC_LANG_PROGRAM([[ $curl_includes_time ]],[[ - gmtime_r(0, 0); + if(0 != gmtime_r(0, 0)) + return 1; ]]) ],[ AC_MSG_RESULT([yes]) @@ -187,6 +230,176 @@ AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [ ]) +dnl CURL_CHECK_FUNC_SIGACTION +dnl ------------------------------------------------- +dnl Verify if sigaction 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_sigaction, then +dnl HAVE_SIGACTION will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [ + AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl + # + tst_links_sigaction="unknown" + tst_proto_sigaction="unknown" + tst_compi_sigaction="unknown" + tst_allow_sigaction="unknown" + # + AC_MSG_CHECKING([if sigaction can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([sigaction]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_sigaction="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_sigaction="no" + ]) + # + if test "$tst_links_sigaction" = "yes"; then + AC_MSG_CHECKING([if sigaction is prototyped]) + AC_EGREP_CPP([sigaction],[ + $curl_includes_signal + ],[ + AC_MSG_RESULT([yes]) + tst_proto_sigaction="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_sigaction="no" + ]) + fi + # + if test "$tst_proto_sigaction" = "yes"; then + AC_MSG_CHECKING([if sigaction is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_signal + ]],[[ + if(0 != sigaction(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_sigaction="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_sigaction="no" + ]) + fi + # + if test "$tst_compi_sigaction" = "yes"; then + AC_MSG_CHECKING([if sigaction usage allowed]) + if test "x$curl_disallow_sigaction" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_sigaction="yes" + else + AC_MSG_RESULT([no]) + tst_allow_sigaction="no" + fi + fi + # + AC_MSG_CHECKING([if sigaction might be used]) + if test "$tst_links_sigaction" = "yes" && + test "$tst_proto_sigaction" = "yes" && + test "$tst_compi_sigaction" = "yes" && + test "$tst_allow_sigaction" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1, + [Define to 1 if you have the sigaction function.]) + ac_cv_func_sigaction="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_sigaction="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRTOK_R +dnl ------------------------------------------------- +dnl Verify if strtok_r 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_strtok_r, then +dnl HAVE_STRTOK_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strtok_r="unknown" + tst_proto_strtok_r="unknown" + tst_compi_strtok_r="unknown" + tst_allow_strtok_r="unknown" + # + AC_MSG_CHECKING([if strtok_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strtok_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strtok_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strtok_r="no" + ]) + # + if test "$tst_links_strtok_r" = "yes"; then + AC_MSG_CHECKING([if strtok_r is prototyped]) + AC_EGREP_CPP([strtok_r],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strtok_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strtok_r="no" + ]) + fi + # + if test "$tst_proto_strtok_r" = "yes"; then + AC_MSG_CHECKING([if strtok_r is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strtok_r(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strtok_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strtok_r="no" + ]) + fi + # + if test "$tst_compi_strtok_r" = "yes"; then + AC_MSG_CHECKING([if strtok_r usage allowed]) + if test "x$curl_disallow_strtok_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strtok_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strtok_r="no" + fi + fi + # + AC_MSG_CHECKING([if strtok_r might be used]) + if test "$tst_links_strtok_r" = "yes" && + test "$tst_proto_strtok_r" = "yes" && + test "$tst_compi_strtok_r" = "yes" && + test "$tst_allow_strtok_r" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1, + [Define to 1 if you have the strtok_r function.]) + ac_cv_func_strtok_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strtok_r="no" + fi +]) + + dnl CURL_CHECK_FUNC_STRTOLL dnl ------------------------------------------------- dnl Verify if strtoll is available, prototyped, and @@ -233,7 +446,8 @@ AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [ AC_LANG_PROGRAM([[ $curl_includes_stdlib ]],[[ - strtoll(0, 0, 0); + if(0 != strtoll(0, 0, 0)) + return 1; ]]) ],[ AC_MSG_RESULT([yes]) |