1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-07-29 15:41:13 +03:00

Don't check for standard C89 headers

Also stop including non-standard headers.
This commit is contained in:
Nick Wellnhofer
2022-03-31 01:04:38 +02:00
parent 25652d85fd
commit dd16508642
17 changed files with 12 additions and 247 deletions

View File

@ -93,26 +93,19 @@ else()
set(CMAKE_REQUIRED_LIBRARIES m)
endif()
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
check_include_files(dlfcn.h HAVE_DLFCN_H)
check_function_exists(fabs HAVE_FABS)
check_include_files(float.h HAVE_FLOAT_H)
check_function_exists(floor HAVE_FLOOR)
check_function_exists(fprintf HAVE_FPRINTF)
check_include_files(fp_class.h HAVE_FP_CLASS_H)
check_function_exists(ftime HAVE_FTIME)
check_library_exists(gcrypt gcry_control "gcrypt.h" HAVE_GCRYPT)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_function_exists(gmtime HAVE_GMTIME)
check_function_exists(gmtime_r HAVE_GMTIME_R)
check_include_files(ieeefp.h HAVE_IEEEFP_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_library_exists(pthread pthread_join "" HAVE_LIBPTHREAD)
check_include_files(locale.h HAVE_LOCALE_H)
check_function_exists(localtime HAVE_LOCALTIME)
check_function_exists(localtime_r HAVE_LOCALTIME_R)
check_include_files(math.h HAVE_MATH_H)
check_include_files(memory.h HAVE_MEMORY_H)
check_include_files(nan.h HAVE_NAN_H)
check_function_exists(pow HAVE_POW)
check_function_exists(printf HAVE_PRINTF)
check_include_files(pthread.h HAVE_PTHREAD_H)
@ -120,11 +113,6 @@ else()
check_function_exists(sprintf HAVE_SPRINTF)
check_function_exists(sscanf HAVE_SSCANF)
check_function_exists(stat HAVE_STAT)
check_include_files(stdarg.h HAVE_STDARG_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(string.h HAVE_STRING_H)
check_function_exists(strxfrm_l HAVE_STRXFRM_L)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
@ -132,7 +120,6 @@ else()
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
check_function_exists(time HAVE_TIME)
check_include_files(time.h HAVE_TIME_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_function_exists(vfprintf HAVE_VFPRINTF)
check_function_exists(vsnprintf HAVE_VSNPRINTF)
@ -147,7 +134,6 @@ else()
set(PACKAGE_TARNAME "libxslt")
set(PACKAGE_URL "https://gitlab.gnome.org/GNOME/libxslt")
set(PACKAGE_VERSION ${LIBXSLT_DOTTED_VERSION})
check_include_files("float.h;stdarg.h;stdlib.h;string.h" STDC_HEADERS)
set(_ALL_SOURCE ON)
set(_GNU_SOURCE ON)
set(_POSIX_PTHREAD_SEMANTICS ON)

View File

@ -4,27 +4,15 @@
/* Define to 1 if you have the `clock_gettime' function. */
#cmakedefine HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1
/* Define to 1 if you have the <errno.h> header file. */
#cmakedefine HAVE_ERRNO_H 1
/* Define if fabs is there */
#cmakedefine HAVE_FABS
/* Define to 1 if you have the <float.h> header file. */
#cmakedefine HAVE_FLOAT_H 1
/* Define if floor is there */
#cmakedefine HAVE_FLOOR
/* Define to 1 if you have the `fprintf' function. */
#cmakedefine HAVE_FPRINTF 1
/* Define to 1 if you have the <fp_class.h> header file. */
#cmakedefine HAVE_FP_CLASS_H 1
/* Define to 1 if you have the `ftime' function. */
#cmakedefine HAVE_FTIME 1
@ -40,9 +28,6 @@
/* Define to 1 if you have the `gmtime_r' function. */
#cmakedefine HAVE_GMTIME_R 1
/* Define to 1 if you have the <ieeefp.h> header file. */
#cmakedefine HAVE_IEEEFP_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
@ -58,15 +43,6 @@
/* Define to 1 if you have the `localtime_r' function. */
#cmakedefine HAVE_LOCALTIME_R 1
/* Define to 1 if you have the <math.h> header file. */
#cmakedefine HAVE_MATH_H 1
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1
/* Define to 1 if you have the <nan.h> header file. */
#cmakedefine HAVE_NAN_H 1
/* Define if pow is there */
#cmakedefine HAVE_POW
@ -88,21 +64,6 @@
/* Define to 1 if you have the `stat' function. */
#cmakedefine HAVE_STAT 1
/* Define to 1 if you have the <stdarg.h> header file. */
#cmakedefine HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1
/* Define to 1 if you have the `strxfrm_l' function. */
#cmakedefine HAVE_STRXFRM_L 1
@ -124,9 +85,6 @@
/* Define to 1 if you have the `time' function. */
#cmakedefine HAVE_TIME 1
/* Define to 1 if you have the <time.h> header file. */
#cmakedefine HAVE_TIME_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
@ -169,9 +127,6 @@
/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
/* Define to 1 if you have the ANSI C header files. */
#cmakedefine STDC_HEADERS 1
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
#cmakedefine _ALL_SOURCE 1

View File

@ -89,7 +89,7 @@ PKG_PROG_PKG_CONFIG
LT_INIT(win32-dll)
AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
AC_CHECK_HEADERS(sys/types.h sys/time.h unistd.h)
dnl
dnl if the system support linker version scripts for symbol versioning
@ -135,9 +135,7 @@ dnl
dnl Math detection
dnl
AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h)
AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h sys/select.h stdarg.h)
AC_CHECK_HEADERS(errno.h)
AC_CHECK_HEADERS(sys/timeb.h sys/stat.h sys/select.h)
AC_CHECK_FUNCS(stat _stat)
AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
[M_LIBS="-lm"; AC_DEFINE([HAVE_POW],[], [Define if pow is there])]))

View File

@ -315,9 +315,6 @@ exsltCryptoCryptoApiRc4Decrypt (xmlXPathParserContextPtr ctxt,
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* needed by gcrypt.h 4 Jul 04 */

View File

@ -40,13 +40,8 @@
#include <string.h>
#include <limits.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
/* needed to get localtime_r on Solaris */
#ifdef __sun
@ -55,9 +50,7 @@
#endif
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
/*
* types of date and/or time (from schema datatypes)
@ -107,8 +100,7 @@ struct _exsltDateDurVal {
* *
****************************************************************/
#if defined(HAVE_TIME_H) \
&& (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R)) \
#if (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R)) \
&& (defined(HAVE_GMTIME) || defined(HAVE_GMTIME_R)) \
&& defined(HAVE_TIME)
#define WITH_TIME
@ -745,16 +737,13 @@ exsltDateCurrent (void)
time_t secs;
int local_s, gm_s;
exsltDateValPtr ret;
#ifdef HAVE_ERRNO_H
char *source_date_epoch;
#endif /* HAVE_ERRNO_H */
int override = 0;
ret = exsltDateCreateDate(XS_DATETIME);
if (ret == NULL)
return NULL;
#ifdef HAVE_ERRNO_H
/*
* Allow the date and time to be set externally by an exported
* environment variable to enable reproducible builds.
@ -776,7 +765,6 @@ exsltDateCurrent (void)
#endif
}
}
#endif /* HAVE_ERRNO_H */
if (override == 0) {
/* get current time */

View File

@ -9,13 +9,8 @@
#include <libxslt/xsltInternals.h>
#include <libxslt/extensions.h>
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "exslt.h"
@ -453,8 +448,6 @@ exsltMathConstantFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathReturnNumber(ctxt, ret);
}
#if defined(HAVE_STDLIB_H) && defined(RAND_MAX)
/**
* exsltMathRandom:
*
@ -494,10 +487,6 @@ exsltMathRandomFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathReturnNumber(ctxt, ret);
}
#endif /* defined(HAVE_STDLIB_H) && defined(RAND_MAX) */
#if HAVE_MATH_H
/**
* exsltMathAbs:
* @num: a double
@ -1029,8 +1018,6 @@ exsltMathExpFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathReturnNumber(ctxt, ret);
}
#endif /* HAVE_MATH_H */
/**
* exsltMathRegister:
*
@ -1051,16 +1038,12 @@ exsltMathRegister (void) {
xsltRegisterExtModuleFunction ((const xmlChar *) "lowest",
EXSLT_MATH_NAMESPACE,
exsltMathLowestFunction);
/* register other math functions */
xsltRegisterExtModuleFunction ((const xmlChar *) "constant",
EXSLT_MATH_NAMESPACE,
exsltMathConstantFunction);
#ifdef HAVE_STDLIB_H
xsltRegisterExtModuleFunction ((const xmlChar *) "random",
EXSLT_MATH_NAMESPACE,
exsltMathRandomFunction);
#endif
#if HAVE_MATH_H
xsltRegisterExtModuleFunction ((const xmlChar *) "abs",
EXSLT_MATH_NAMESPACE,
exsltMathAbsFunction);
@ -1097,7 +1080,6 @@ exsltMathRegister (void) {
xsltRegisterExtModuleFunction ((const xmlChar *) "exp",
EXSLT_MATH_NAMESPACE,
exsltMathExpFunction);
#endif
}
/**
@ -1129,13 +1111,10 @@ exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix)
(const xmlChar *) "lowest",
(const xmlChar *) EXSLT_MATH_NAMESPACE,
exsltMathLowestFunction)
#ifdef HAVE_STDLIB_H
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "random",
(const xmlChar *) EXSLT_MATH_NAMESPACE,
exsltMathRandomFunction)
#endif
#if HAVE_MATH_H
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "abs",
(const xmlChar *) EXSLT_MATH_NAMESPACE,
@ -1184,7 +1163,6 @@ exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix)
(const xmlChar *) "exp",
(const xmlChar *) EXSLT_MATH_NAMESPACE,
exsltMathExpFunction)
#endif
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "constant",
(const xmlChar *) EXSLT_MATH_NAMESPACE,

View File

@ -14,25 +14,6 @@
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#ifdef HAVE_NAN_H
#include <nan.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/hash.h>

View File

@ -14,9 +14,7 @@
#include "libxslt.h"
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>

View File

@ -15,13 +15,6 @@
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/tree.h>

View File

@ -14,25 +14,6 @@
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#ifdef HAVE_NAN_H
#include <nan.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/hash.h>

View File

@ -14,24 +14,6 @@
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#ifdef HAVE_NAN_H
#include <nan.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#ifndef XSLT_NEED_TRIO
#include <stdio.h>
#else

View File

@ -18,22 +18,6 @@
#include <sys/stat.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#ifdef HAVE_NAN_H
#include <nan.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
#ifndef INVALID_FILE_ATTRIBUTES

View File

@ -9,15 +9,9 @@
#ifndef __LIBXSLT_WIN32_CONFIG__
#define __LIBXSLT_WIN32_CONFIG__
#define HAVE_CTYPE_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDARG_H 1
#define HAVE_MALLOC_H 1
#define HAVE_TIME_H 1
#define HAVE_LOCALTIME 1
#define HAVE_GMTIME 1
#define HAVE_TIME 1
#define HAVE_MATH_H 1
#define HAVE_FCNTL_H 1
#include <io.h>
@ -115,7 +109,6 @@ __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
#define HAVE_SYS_STAT_H
#define HAVE__STAT
#define HAVE_STRING_H
#include <libxml/xmlversion.h>

View File

@ -86,7 +86,6 @@ extern "C" {
#define XSLT_NEED_TRIO
#endif
#ifdef __VMS
#define HAVE_MATH_H 1
#define HAVE_SYS_STAT_H 1
#ifndef XSLT_NEED_TRIO
#define XSLT_NEED_TRIO

View File

@ -19,17 +19,16 @@
#endif
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdarg.h>
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>

View File

@ -13,9 +13,6 @@
#define __XML_XSLTUTILS_H__
#include <libxslt/xsltconfig.h>
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#include <libxml/xpath.h>
#include <libxml/dict.h>
#include <libxml/xmlerror.h>

View File

@ -9,28 +9,22 @@
#include "libxslt/libxslt.h"
#include "libxslt/xsltconfig.h"
#include "libexslt/exslt.h"
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <fcntl.h>
#endif
@ -57,12 +51,6 @@
#include <libexslt/exsltconfig.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#elif defined(HAVE_TIME_H)
#include <time.h>
#endif
#ifdef HAVE_SYS_TIMEB_H
#include <sys/timeb.h>
#endif
@ -265,16 +253,13 @@ static void endTimer(const char *format, ...)
msec *= 1000;
msec += (endtime.tv_usec - begin.tv_usec) / 1000;
#ifndef HAVE_STDARG_H
#error "endTimer required stdarg functions"
#endif
va_start(ap, format);
vfprintf(stderr,format,ap);
va_end(ap);
fprintf(stderr, " took %ld ms\n", msec);
}
#elif defined(HAVE_TIME_H)
#else
/*
* No gettimeofday function, so we have to make do with calling clock.
* This is obviously less accurate, but there's little we can do about
@ -297,40 +282,11 @@ static void endTimer(const char *format, ...)
endtime=clock();
msec = ((endtime-begin) * 1000) / CLOCKS_PER_SEC;
#ifndef HAVE_STDARG_H
#error "endTimer required stdarg functions"
#endif
va_start(ap, format);
vfprintf(stderr,format,ap);
va_end(ap);
fprintf(stderr, " took %ld ms\n", msec);
}
#else
/*
* We don't have a gettimeofday or time.h, so we just don't do timing
*/
static void startTimer(void)
{
/*
* Do nothing
*/
}
static void endTimer(const char *format, ...)
{
/*
* We cannot do anything because we don't have a timing function
*/
#ifdef HAVE_STDARG_H
va_start(ap, format);
vfprintf(stderr,format,ap);
va_end(ap);
fprintf(stderr, " was not timed\n");
#else
/* We don't have gettimeofday, time or stdarg.h, what crazy world is
* this ?!
*/
#endif
}
#endif
/*