CURL_CHECK_MSG_NOSIGNAL
CURL_CHECK_FUNC_ALARM
+CURL_CHECK_FUNC_BASENAME
CURL_CHECK_FUNC_CLOSESOCKET
CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
CURL_CHECK_FUNC_CONNECT
;;
esac
-AC_CHECK_FUNCS([basename \
- fork \
+AC_CHECK_FUNCS([fork \
geteuid \
getpass_r \
getppid \
fi
])
-
-AC_CHECK_DECL(basename, ,
- AC_DEFINE(NEED_BASENAME_PROTO, 1, [If you lack a fine basename() prototype]),
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-)
-
-
dnl Check if the getnameinfo function is available
dnl and get the types of five of its arguments.
CURL_CHECK_FUNC_GETNAMEINFO
#ifndef CURL_DISABLE_HTTP
-#if defined(HAVE_BASENAME) && defined(NEED_BASENAME_PROTO)
-/* This system has a basename() but no prototype for it! */
-char *basename(char *path);
+#ifndef HAVE_BASENAME
+static char *Curl_basename(char *path);
+#define basename(x) Curl_basename((x))
#endif
static size_t readfromfile(struct Form *form, char *buffer, size_t size);
required to be reentrant is not required to be thread-safe.
*/
-static char *basename(char *path)
+static char *Curl_basename(char *path)
{
/* Ignore all the details above for now and make a quick and simple
implementaion here */
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 53
+# serial 54
dnl CURL_INCLUDES_ARPA_INET
])
+dnl CURL_INCLUDES_LIBGEN
+dnl -------------------------------------------------
+dnl Set up variable with list of headers that must be
+dnl included when libgen.h is to be included.
+
+AC_DEFUN([CURL_INCLUDES_LIBGEN], [
+curl_includes_libgen="\
+/* includes start */
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_LIBGEN_H
+# include <libgen.h>
+#endif
+/* includes end */"
+ AC_CHECK_HEADERS(
+ sys/types.h libgen.h,
+ [], [], [$curl_includes_libgen])
+])
+
+
dnl CURL_INCLUDES_NETDB
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
])
+dnl CURL_CHECK_FUNC_BASENAME
+dnl -------------------------------------------------
+dnl Verify if basename 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_basename, then
+dnl HAVE_BASENAME will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [
+ AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+ AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl
+ AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
+ #
+ tst_links_basename="unknown"
+ tst_proto_basename="unknown"
+ tst_compi_basename="unknown"
+ tst_allow_basename="unknown"
+ #
+ AC_MSG_CHECKING([if basename can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([basename])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_basename="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_basename="no"
+ ])
+ #
+ if test "$tst_links_basename" = "yes"; then
+ AC_MSG_CHECKING([if basename is prototyped])
+ AC_EGREP_CPP([basename],[
+ $curl_includes_string
+ $curl_includes_libgen
+ $curl_includes_unistd
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_basename="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_basename="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_basename" = "yes"; then
+ AC_MSG_CHECKING([if basename is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_string
+ $curl_includes_libgen
+ $curl_includes_unistd
+ ]],[[
+ if(0 != basename(0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_basename="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_basename="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_basename" = "yes"; then
+ AC_MSG_CHECKING([if basename usage allowed])
+ if test "x$curl_disallow_basename" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_basename="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_basename="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if basename might be used])
+ if test "$tst_links_basename" = "yes" &&
+ test "$tst_proto_basename" = "yes" &&
+ test "$tst_compi_basename" = "yes" &&
+ test "$tst_allow_basename" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1,
+ [Define to 1 if you have the basename function.])
+ ac_cv_func_basename="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_basename="no"
+ fi
+])
+
+
dnl CURL_CHECK_FUNC_CLOSESOCKET
dnl -------------------------------------------------
dnl Verify if closesocket is available, prototyped, and