configure.ac/CMake: Check for round() and stdbool.h
Not all the compilers that HarfBuzz is buildable on supports round() and
has the header stdbool.h, so we check for them and define HAVE_ROUND and
HAVE_STDBOOL_H repsectively in our CFLAGS so that we include them only
when they are found, or use fallback implementations when necessary.
Also include FindPythonInterp earlier as we need PYTHON_EXECUTABLE to be
set for running the tests.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index defd5d6..62e7945 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,6 +90,8 @@
add_definitions(-DHAVE_OT)
add_definitions(-DHAVE_FALLBACK)
+# We need PYTHON_EXECUTABLE to be set for running the tests...
+include (FindPythonInterp)
## Functions and headers
include (CheckFunctionExists)
@@ -103,7 +105,10 @@
endif ()
endforeach ()
endmacro ()
-check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l)
+if (UNIX)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES m)
+endif ()
+check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l round)
check_include_file(unistd.h HAVE_UNISTD_H)
if (${HAVE_UNISTD_H})
add_definitions(-DHAVE_UNISTD_H)
@@ -116,6 +121,10 @@
if (${HAVE_XLOCALE_H})
add_definitions(-DHAVE_XLOCALE_H)
endif ()
+check_include_file(stdbool.h HAVE_STDBOOL_H)
+if (${HAVE_STDBOOL_H})
+ add_definitions(-DHAVE_STDBOOL_H)
+endif ()
if (MSVC)
@@ -385,7 +394,6 @@
endif ()
if (HB_HAVE_GOBJECT)
- include (FindPythonInterp)
include (FindPerl)
# Use the hints from glib-2.0.pc to find glib-mkenums
diff --git a/configure.ac b/configure.ac
index 1fb8a10..031be4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,8 +78,15 @@
])
# Functions, and headers
+
AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l setlinebuf)
-AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h)
+
+save_libs="$LIBS"
+LIBS="$LIBS -lm"
+AC_CHECK_FUNCS([round], ,[AC_CHECK_DECLS([round], , ,[#include <math.h>])])
+LIBS="$save_libs"
+
+AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h stdbool.h)
# Compiler flags
AC_CANONICAL_HOST