mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Check for basename() is now done the same as other function checks
This commit is contained in:
parent
86cec97b22
commit
6d4e6cc813
19
configure.ac
19
configure.ac
@ -2034,6 +2034,7 @@ CURL_CHECK_FUNC_SEND
|
|||||||
CURL_CHECK_MSG_NOSIGNAL
|
CURL_CHECK_MSG_NOSIGNAL
|
||||||
|
|
||||||
CURL_CHECK_FUNC_ALARM
|
CURL_CHECK_FUNC_ALARM
|
||||||
|
CURL_CHECK_FUNC_BASENAME
|
||||||
CURL_CHECK_FUNC_CLOSESOCKET
|
CURL_CHECK_FUNC_CLOSESOCKET
|
||||||
CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
|
CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
|
||||||
CURL_CHECK_FUNC_CONNECT
|
CURL_CHECK_FUNC_CONNECT
|
||||||
@ -2093,8 +2094,7 @@ case $host in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_CHECK_FUNCS([basename \
|
AC_CHECK_FUNCS([fork \
|
||||||
fork \
|
|
||||||
geteuid \
|
geteuid \
|
||||||
getpass_r \
|
getpass_r \
|
||||||
getppid \
|
getppid \
|
||||||
@ -2132,21 +2132,6 @@ AC_CHECK_FUNCS([basename \
|
|||||||
fi
|
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 Check if the getnameinfo function is available
|
||||||
dnl and get the types of five of its arguments.
|
dnl and get the types of five of its arguments.
|
||||||
CURL_CHECK_FUNC_GETNAMEINFO
|
CURL_CHECK_FUNC_GETNAMEINFO
|
||||||
|
@ -634,9 +634,6 @@
|
|||||||
/* Define to 1 if you are building a native Windows target. */
|
/* Define to 1 if you are building a native Windows target. */
|
||||||
/* #undef NATIVE_WINDOWS */
|
/* #undef NATIVE_WINDOWS */
|
||||||
|
|
||||||
/* If you lack a fine basename() prototype */
|
|
||||||
/* #undef NEED_BASENAME_PROTO */
|
|
||||||
|
|
||||||
/* Define to 1 if you need the lber.h header file even with ldap.h */
|
/* Define to 1 if you need the lber.h header file even with ldap.h */
|
||||||
/* #undef NEED_LBER_H */
|
/* #undef NEED_LBER_H */
|
||||||
|
|
||||||
|
@ -559,9 +559,6 @@
|
|||||||
/* if you have the zlib.h header file */
|
/* if you have the zlib.h header file */
|
||||||
/* #undef HAVE_ZLIB_H */
|
/* #undef HAVE_ZLIB_H */
|
||||||
|
|
||||||
/* If you lack a fine basename() prototype */
|
|
||||||
/* #undef NEED_BASENAME_PROTO */
|
|
||||||
|
|
||||||
/* need REENTRANT defined */
|
/* need REENTRANT defined */
|
||||||
/* #undef NEED_REENTRANT */
|
/* #undef NEED_REENTRANT */
|
||||||
|
|
||||||
|
@ -733,9 +733,6 @@
|
|||||||
/* Define to 1 if you are building a native Windows target. */
|
/* Define to 1 if you are building a native Windows target. */
|
||||||
/* #undef NATIVE_WINDOWS */
|
/* #undef NATIVE_WINDOWS */
|
||||||
|
|
||||||
/* If you lack a fine basename() prototype */
|
|
||||||
/* #undef NEED_BASENAME_PROTO */
|
|
||||||
|
|
||||||
/* Define to 1 if you need the lber.h header file even with ldap.h */
|
/* Define to 1 if you need the lber.h header file even with ldap.h */
|
||||||
/* #undef NEED_LBER_H */
|
/* #undef NEED_LBER_H */
|
||||||
|
|
||||||
|
@ -135,9 +135,9 @@ Content-Disposition: form-data; name="FILECONTENT"
|
|||||||
|
|
||||||
#ifndef CURL_DISABLE_HTTP
|
#ifndef CURL_DISABLE_HTTP
|
||||||
|
|
||||||
#if defined(HAVE_BASENAME) && defined(NEED_BASENAME_PROTO)
|
#ifndef HAVE_BASENAME
|
||||||
/* This system has a basename() but no prototype for it! */
|
static char *Curl_basename(char *path);
|
||||||
char *basename(char *path);
|
#define basename(x) Curl_basename((x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static size_t readfromfile(struct Form *form, char *buffer, size_t size);
|
static size_t readfromfile(struct Form *form, char *buffer, size_t size);
|
||||||
@ -1067,7 +1067,7 @@ void curl_formfree(struct curl_httppost *form)
|
|||||||
required to be reentrant is not required to be thread-safe.
|
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
|
/* Ignore all the details above for now and make a quick and simple
|
||||||
implementaion here */
|
implementaion here */
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#***************************************************************************
|
#***************************************************************************
|
||||||
|
|
||||||
# File version for 'aclocal' use. Keep it a single number.
|
# File version for 'aclocal' use. Keep it a single number.
|
||||||
# serial 53
|
# serial 54
|
||||||
|
|
||||||
|
|
||||||
dnl CURL_INCLUDES_ARPA_INET
|
dnl CURL_INCLUDES_ARPA_INET
|
||||||
@ -127,6 +127,27 @@ curl_includes_inttypes="\
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
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 CURL_INCLUDES_NETDB
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Set up variable with list of headers that must be
|
dnl Set up variable with list of headers that must be
|
||||||
@ -598,6 +619,97 @@ AC_DEFUN([CURL_CHECK_FUNC_ALARM], [
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
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 CURL_CHECK_FUNC_CLOSESOCKET
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Verify if closesocket is available, prototyped, and
|
dnl Verify if closesocket is available, prototyped, and
|
||||||
|
@ -31,6 +31,12 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#if defined(MSDOS) || defined(WIN32)
|
||||||
|
# if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME)
|
||||||
|
# include <libgen.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
#include "urlglob.h"
|
#include "urlglob.h"
|
||||||
@ -5437,7 +5443,7 @@ static int create_dir_hierarchy(const char *outfile, FILE *errors)
|
|||||||
/* basename() returns a pointer to the last component of a pathname.
|
/* basename() returns a pointer to the last component of a pathname.
|
||||||
* Ripped from lib/formdata.c.
|
* Ripped from lib/formdata.c.
|
||||||
*/
|
*/
|
||||||
static char *basename(char *path)
|
static char *Curl_basename(char *path)
|
||||||
{
|
{
|
||||||
/* Ignore all the details above for now and make a quick and simple
|
/* Ignore all the details above for now and make a quick and simple
|
||||||
implementaion here */
|
implementaion here */
|
||||||
@ -5457,6 +5463,7 @@ static char *basename(char *path)
|
|||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
#define basename(x) Curl_basename((x))
|
||||||
#endif /* HAVE_BASENAME */
|
#endif /* HAVE_BASENAME */
|
||||||
|
|
||||||
/* The following functions are taken with modification from the DJGPP
|
/* The following functions are taken with modification from the DJGPP
|
||||||
|
Loading…
Reference in New Issue
Block a user