mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 08:06:35 +08:00
[CMake] config.h, part 2 - full compatibility with autoconf.
This commit makes the file config.h generated by CMake 100% compatible
with the one generated by autoconf/configure.
Fixes in this commit:
- Set FLTK_DATADIR and FLTK_DOCDIR with the same default values.
Note: needs some cleanup, option values are not clear, '/fltk'
is currently appended in export.cmake (needs improvement).
- Simulation of autoconf macro AC_HEADER_DIRENT for correct
definition of only one 'dirent' header file.
- Fix more function checks:
- dlsym
- png_get_valid
- png_set_tRNS_to_alpha
- Improve "Big Endian" check for __APPLE__ (mac_endianness.h).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10985 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+20
-2
@@ -82,10 +82,28 @@ if(UNIX)
|
|||||||
)
|
)
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
|
||||||
|
# prepare some variables for config.h
|
||||||
|
|
||||||
|
if(IS_ABSOLUTE "${FLTK_DATADIR}")
|
||||||
|
set(PREFIX_DATA "${FLTK_DATADIR}/fltk")
|
||||||
|
else(IS_ABSOLUTE "${FLTK_DATADIR}")
|
||||||
|
set(PREFIX_DATA "${CMAKE_INSTALL_PREFIX}/${FLTK_DATADIR}/fltk")
|
||||||
|
endif(IS_ABSOLUTE "${FLTK_DATADIR}")
|
||||||
|
|
||||||
|
if(IS_ABSOLUTE "${FLTK_DOCDIR}")
|
||||||
|
set(PREFIX_DOC "${FLTK_DOCDIR}/fltk")
|
||||||
|
else(IS_ABSOLUTE "${FLTK_DOCDIR}")
|
||||||
|
set(PREFIX_DOC "${CMAKE_INSTALL_PREFIX}/${FLTK_DOCDIR}/fltk")
|
||||||
|
endif(IS_ABSOLUTE "${FLTK_DOCDIR}")
|
||||||
|
|
||||||
|
set(CONFIG_H_IN configh.cmake.in)
|
||||||
|
set(CONFIG_H config.h)
|
||||||
|
|
||||||
# generate config.h
|
# generate config.h
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${FLTK_SOURCE_DIR}/configh.cmake.in"
|
"${FLTK_SOURCE_DIR}/${CONFIG_H_IN}"
|
||||||
"${FLTK_BINARY_DIR}/config.h"
|
"${FLTK_BINARY_DIR}/${CONFIG_H}"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+47
-7
@@ -22,26 +22,41 @@
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
# headers
|
# headers
|
||||||
find_file(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
|
find_file(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
|
||||||
find_file(HAVE_DIRENT_H dirent.h)
|
|
||||||
find_file(HAVE_DLFCN_H dlfcn.h)
|
find_file(HAVE_DLFCN_H dlfcn.h)
|
||||||
find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2 freetype2/freetype)
|
find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2 freetype2/freetype)
|
||||||
find_file(HAVE_GL_GL_H GL/gl.h)
|
find_file(HAVE_GL_GL_H GL/gl.h)
|
||||||
find_file(HAVE_GL_GLU_H GL/glu.h)
|
find_file(HAVE_GL_GLU_H GL/glu.h)
|
||||||
find_file(HAVE_LIBPNG_PNG_H libpng/png.h)
|
find_file(HAVE_LIBPNG_PNG_H libpng/png.h)
|
||||||
find_file(HAVE_LOCALE_H locale.h)
|
find_file(HAVE_LOCALE_H locale.h)
|
||||||
find_file(HAVE_NDIR_H ndir.h)
|
|
||||||
find_file(HAVE_OPENGL_GLU_H OpenGL/glu.h)
|
find_file(HAVE_OPENGL_GLU_H OpenGL/glu.h)
|
||||||
find_file(HAVE_PNG_H png.h)
|
find_file(HAVE_PNG_H png.h)
|
||||||
find_file(HAVE_PTHREAD_H pthread.h)
|
find_file(HAVE_PTHREAD_H pthread.h)
|
||||||
find_file(HAVE_STDIO_H stdio.h)
|
find_file(HAVE_STDIO_H stdio.h)
|
||||||
find_file(HAVE_STRINGS_H strings.h)
|
find_file(HAVE_STRINGS_H strings.h)
|
||||||
find_file(HAVE_SYS_DIR_H sys/dir.h)
|
|
||||||
find_file(HAVE_SYS_NDIR_H sys/ndir.h)
|
|
||||||
find_file(HAVE_SYS_SELECT_H sys/select.h)
|
find_file(HAVE_SYS_SELECT_H sys/select.h)
|
||||||
find_file(HAVE_SYS_STDTYPES_H sys/stdtypes.h)
|
find_file(HAVE_SYS_STDTYPES_H sys/stdtypes.h)
|
||||||
find_file(HAVE_X11_XREGION_H X11/Xregion.h)
|
find_file(HAVE_X11_XREGION_H X11/Xregion.h)
|
||||||
find_path(HAVE_XDBE_H Xdbe.h PATH_SUFFIXES X11/extensions extensions)
|
find_path(HAVE_XDBE_H Xdbe.h PATH_SUFFIXES X11/extensions extensions)
|
||||||
|
|
||||||
|
# Simulate the behavior of autoconf macro AC_HEADER_DIRENT, see:
|
||||||
|
# https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html
|
||||||
|
# "Check for the following header files. For the first one that is found
|
||||||
|
# and defines ‘DIR’, define the listed C preprocessor macro ..."
|
||||||
|
#
|
||||||
|
# Note: we don't check if it really defines 'DIR', but we stop processing
|
||||||
|
# once we found the first suitable header file.
|
||||||
|
|
||||||
|
find_file(HAVE_DIRENT_H dirent.h)
|
||||||
|
if(NOT HAVE_DIRENT_H)
|
||||||
|
find_file(HAVE_SYS_NDIR_H sys/ndir.h)
|
||||||
|
if(NOT HAVE_SYS_NDIR_H)
|
||||||
|
find_file(HAVE_SYS_DIR_H sys/dir.h)
|
||||||
|
if(NOT HAVE_SYS_DIR_H)
|
||||||
|
find_file(HAVE_NDIR_H ndir.h)
|
||||||
|
endif(NOT HAVE_SYS_DIR_H)
|
||||||
|
endif(NOT HAVE_SYS_NDIR_H)
|
||||||
|
endif(NOT HAVE_DIRENT_H)
|
||||||
|
|
||||||
mark_as_advanced(HAVE_ALSA_ASOUNDLIB_H HAVE_DIRENT_H HAVE_DLFCN_H)
|
mark_as_advanced(HAVE_ALSA_ASOUNDLIB_H HAVE_DIRENT_H HAVE_DLFCN_H)
|
||||||
mark_as_advanced(HAVE_FREETYPE_H HAVE_GL_GL_H HAVE_GL_GLU_H)
|
mark_as_advanced(HAVE_FREETYPE_H HAVE_GL_GL_H HAVE_GL_GLU_H)
|
||||||
mark_as_advanced(HAVE_LIBPNG_PNG_H HAVE_LOCALE_H HAVE_NDIR_H)
|
mark_as_advanced(HAVE_LIBPNG_PNG_H HAVE_LOCALE_H HAVE_NDIR_H)
|
||||||
@@ -79,15 +94,32 @@ mark_as_advanced(LIB_jpeg LIB_png LIB_zlib)
|
|||||||
# functions
|
# functions
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
|
||||||
|
# save CMAKE_REQUIRED_LIBRARIES (is this really necessary ?)
|
||||||
|
if(DEFINED CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
set(SAVED_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||||
|
else(DEFINED CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
unset(SAVED_REQUIRED_LIBRARIES)
|
||||||
|
endif(DEFINED CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
|
||||||
if(HAVE_DLFCN_H)
|
if(HAVE_DLFCN_H)
|
||||||
set(HAVE_DLFCN_H 1)
|
set(HAVE_DLFCN_H 1)
|
||||||
endif(HAVE_DLFCN_H)
|
endif(HAVE_DLFCN_H)
|
||||||
CHECK_FUNCTION_EXISTS(dlsym HAVE_DLSYM)
|
|
||||||
|
if(LIB_dl)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${LIB_dl})
|
||||||
|
CHECK_FUNCTION_EXISTS(dlsym HAVE_DLSYM)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
endif(LIB_dl)
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(localeconv HAVE_LOCALECONV)
|
CHECK_FUNCTION_EXISTS(localeconv HAVE_LOCALECONV)
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(png_get_valid HAVE_PNG_GET_VALID)
|
if(LIB_png)
|
||||||
CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha HAVE_PNG_SET_TRNS_TO_ALPHA)
|
set(CMAKE_REQUIRED_LIBRARIES ${LIB_png})
|
||||||
|
CHECK_FUNCTION_EXISTS(png_get_valid HAVE_PNG_GET_VALID)
|
||||||
|
CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha HAVE_PNG_SET_TRNS_TO_ALPHA)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
endif(LIB_png)
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(scandir HAVE_SCANDIR)
|
CHECK_FUNCTION_EXISTS(scandir HAVE_SCANDIR)
|
||||||
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
|
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
|
||||||
@@ -120,6 +152,14 @@ if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
|
|||||||
endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
|
endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
|
||||||
mark_as_advanced(HAVE_SCANDIR_POSIX)
|
mark_as_advanced(HAVE_SCANDIR_POSIX)
|
||||||
|
|
||||||
|
# restore CMAKE_REQUIRED_LIBRARIES (is this really necessary ?)
|
||||||
|
if(DEFINED SAVED_REQUIRED_LIBRARIES)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||||
|
unset(SAVED_REQUIRED_LIBRARIES)
|
||||||
|
else(DEFINED SAVED_REQUIRED_LIBRARIES)
|
||||||
|
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
endif(DEFINED SAVED_REQUIRED_LIBRARIES)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# packages
|
# packages
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ set(FLTK_DATADIR ${CMAKE_INSTALL_DATADIR} CACHE PATH
|
|||||||
"Non-arch data install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
"Non-arch data install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
||||||
set(FLTK_MANDIR ${CMAKE_INSTALL_MANDIR} CACHE PATH
|
set(FLTK_MANDIR ${CMAKE_INSTALL_MANDIR} CACHE PATH
|
||||||
"Manual install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
"Manual install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
||||||
|
set(FLTK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc CACHE PATH
|
||||||
|
"Non-arch doc install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|||||||
+7
-3
@@ -1,8 +1,8 @@
|
|||||||
|
/* @CONFIG_H@. Generated from @CONFIG_H_IN@ by CMake. */
|
||||||
/*
|
/*
|
||||||
* "$Id$"
|
* "$Id$"
|
||||||
*
|
*
|
||||||
* Configuration file for the Fast Light Tool Kit (FLTK).
|
* Configuration file for the Fast Light Tool Kit (FLTK).
|
||||||
* @configure_input@
|
|
||||||
*
|
*
|
||||||
* Copyright 1998-2015 by Bill Spitzak and others.
|
* Copyright 1998-2015 by Bill Spitzak and others.
|
||||||
*
|
*
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
* no meaning on operating systems other than Mac OS X.
|
* no meaning on operating systems other than Mac OS X.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#cmakedefine __APPLE_QUARTZ__ @__APPLE_QUARTZ__@
|
#cmakedefine __APPLE_QUARTZ__ 1
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -185,7 +185,11 @@
|
|||||||
* Byte order of your machine: 1 = big-endian, 0 = little-endian.
|
* Byte order of your machine: 1 = big-endian, 0 = little-endian.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WORDS_BIGENDIAN @WORDS_BIGENDIAN@
|
#ifdef __APPLE__
|
||||||
|
#include <mac_endianness.h>
|
||||||
|
#else
|
||||||
|
#cmakedefine01 WORDS_BIGENDIAN
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* U16, U32, U64:
|
* U16, U32, U64:
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* "$Id$"
|
* "$Id$"
|
||||||
*
|
*
|
||||||
* Configuration file for the Fast Light Tool Kit (FLTK).
|
* Configuration file for the Fast Light Tool Kit (FLTK).
|
||||||
* @configure_input@
|
|
||||||
*
|
*
|
||||||
* Copyright 1998-2015 by Bill Spitzak and others.
|
* Copyright 1998-2015 by Bill Spitzak and others.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user