configure/cmake: unify header checks and config.h generation

Rather than hand maintain config.h.cmake (which is already out of date),
re-use the autogenerated config.h from autoheader.
master
Mike Frysinger 2016-05-17 23:06:14 -04:00
parent 32c5072fd6
commit 1239832a09
7 changed files with 57 additions and 33 deletions

View File

@ -963,7 +963,6 @@ $IF HAVE_LIBPNG.EQ.1
$ THEN
$ APP SYS$INPUT [.SRC]CONFIG.H
#define HAVE_LIBPNG 1
#define HAVE_PNG_H 1
$ENDIF
$IF HAVE_FREETYPE.EQ.1
$ THEN

View File

@ -23,4 +23,8 @@ if ! autoreconf -f -i ; then
exit 1
fi
exit 0
sed \
-e '1d' \
-e '2i/* Generated from config.hin via autoheader for cmake; see bootstraps.h. */' \
-e 's:#undef:#cmakedefine:' \
src/config.hin > src/config.h.cmake

View File

@ -1,6 +1,9 @@
# Keep in sync with AC_CHECK_HEADERS in configure.ac.
check_include_files(dirent.h HAVE_DIRENT_H)
check_include_files(errno.h HAVE_ERRNO_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(limits.h HAVE_LIMITS_H)
check_include_files(stddef.h HAVE_STDDEF_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdlib.h HAVE_STDLIB_H)

View File

@ -73,8 +73,22 @@ if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
LDFLAGS="$LDFLAGS -L$x_libraries"
fi
dnl Keep in sync with cmake/modules/AC_HEADER_STDC.cmake.
AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h limits.h stddef.h stdlib.h string.h unistd.h])
AC_CHECK_HEADERS_ONCE(m4_flatten([
dirent.h
errno.h
inttypes.h
limits.h
stddef.h
stdint.h
stdlib.h
string.h
strings.h
unistd.h
sys/stat.h
sys/types.h
]))
dnl if we're configuring on a system w/out gettext, don't fall over
m4_ifndef([AM_ICONV],[m4_define([AM_ICONV],[:])])

View File

@ -1,4 +1,10 @@
/* config.hin. Generated from config.h.cmake by cmake */
/* Generated from config.hin via autoheader for cmake; see bootstraps.h. */
/* Define is you are building for Win32 API */
#cmakedefine BGDWIN32
/* Define to 1 if you have the <dirent.h> header file. */
#cmakedefine HAVE_DIRENT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H
@ -6,10 +12,10 @@
/* Define to 1 if you have the <errno.h> header file. */
#cmakedefine HAVE_ERRNO_H
/* Define to 1 if you have the <ft2build.h> header file. */
/* Define if you have the ft2build.h header. */
#cmakedefine HAVE_FT2BUILD_H
/* Define if you have the iconv() function. */
/* Define if you have the iconv() function and it works. */
#cmakedefine HAVE_ICONV
/* Define to 1 if you have the <iconv.h> header file. */
@ -21,34 +27,31 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H
/* Define if you have the fontconfig library. */
/* Define if you have fontconfig */
#cmakedefine HAVE_LIBFONTCONFIG
/* Define if you have the freetype library. */
/* Define if you have freetype */
#cmakedefine HAVE_LIBFREETYPE
/* Define if you have the jpeg library. */
/* Define if you have jpeg */
#cmakedefine HAVE_LIBJPEG
/* Define if you have the jpeg library. */
#cmakedefine HAVE_LIBTIFF
/* Define to 1 if you have the `m' library (-lm). */
#cmakedefine HAVE_LIBM
/* Define if you have the png library. */
/* Define if you have png */
#cmakedefine HAVE_LIBPNG
/* Define if you have the WEBP library. */
/* Define if you have tiff */
#cmakedefine HAVE_LIBTIFF
/* Define if you have webp */
#cmakedefine HAVE_LIBWEBP
/* Define to 1 if you have the <libimagequant.h> header file. */
#cmakedefine HAVE_LIBIMAGEQUANT_H
/* Define if you have the Xpm library. */
/* Define if you have xpm */
#cmakedefine HAVE_LIBXPM
/* Define if you have zlib. */
/* Define if you have zlib */
#cmakedefine HAVE_LIBZ
/* Define to 1 if you have the <limits.h> header file. */
@ -57,12 +60,12 @@
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H
/* Define to 1 if you have the <png.h> header file. */
#cmakedefine HAVE_PNG_H
/* Define if you have POSIX threads libraries and header files. */
#cmakedefine HAVE_PTHREAD
/* Have PTHREAD_PRIO_INHERIT. */
#cmakedefine HAVE_PTHREAD_PRIO_INHERIT
/* Define to 1 if you have the <stddef.h> header file. */
#cmakedefine HAVE_STDDEF_H
@ -85,13 +88,18 @@
#cmakedefine HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#ifndef HAVE_UNISTD_H
#cmakedefine HAVE_UNISTD_H
#endif
/* Define to 1 or 0, depending whether the compiler supports simple visibility
declarations. */
#cmakedefine HAVE_VISIBILITY
/* Define as const if the declaration of iconv() needs const. */
#cmakedefine ICONV_CONST
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#cmakedefine LT_OBJDIR
/* Name of package */
#cmakedefine PACKAGE
@ -107,6 +115,9 @@
/* Define to the one symbol short name of this package. */
#cmakedefine PACKAGE_TARNAME
/* Define to the home page for this package. */
#cmakedefine PACKAGE_URL
/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION
@ -117,11 +128,5 @@
/* Define to 1 if you have the ANSI C header files. */
#cmakedefine STDC_HEADERS
/* Define to 1 if you have the stdint.h header file. */
#cmakedefine HAVE_STDINT_H
/* Define to 1 if you have the inttypes.h header file. */
#cmakedefine HAVE_INTTYPES_H
/* Version number of package */
#cmakedefine VERSION

View File

@ -1,7 +1,7 @@
#ifndef GD_INTERN_H
#define GD_INTERN_H
#if HAVE_LIMITS_H
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif

View File

@ -45,7 +45,6 @@ CFLAGS=/nologo /O2 /Qvec-report:1 /MD /TC\
/DBGDWIN32=1\
/DHAVE_FT2BUILD_H=1\
/DHAVE_GD_H=1\
/DHAVE_PNG_H=1\
/DHAVE_ICONV_H=1\
/DHAVE_GD_BUNDLED=1\
/DHAVE_LIBFREETYPE=1\