changeset 933:6820177eb6da

Properly check for things like off_t and size_t and few libc functions, just to be safe.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 01:47:29 +0200
parents 7c62e686b6a4
children 1b346fa44c05
files acinclude.m4 configure.ac src/config.h.in
diffstat 3 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/acinclude.m4	Sun Nov 18 18:09:19 2012 +0200
+++ b/acinclude.m4	Mon Nov 19 01:47:29 2012 +0200
@@ -4,6 +4,13 @@
 dnl *** Updated for new autotools, plus namespace, added portability
 dnl *** fixes and other minor changes by Matti 'ccr' Hamalainen
 dnl *** (C) Copyright 2003-2008 Tecnic Software productions (TNSP)
+AC_DEFUN([XS_CHECK_FEATURE],
+[
+	if test "x[]$$1" != "xyes"; then
+		AC_MSG_ERROR([Required feature $2 not detected. See config.log for more information.])
+	fi
+])
+
 
 AC_DEFUN([XS_FIND_FILE],
 [
--- a/configure.ac	Sun Nov 18 18:09:19 2012 +0200
+++ b/configure.ac	Mon Nov 19 01:47:29 2012 +0200
@@ -59,12 +59,18 @@
 dnl *** Checks for header files, types and functions
 dnl ***
 AC_HEADER_STDC
+AC_C_INLINE
+AC_C_CONST
 AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
 
+AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
-AC_C_CONST
-AC_C_INLINE
-AC_CHECK_FUNCS([memset],[],[[*** memset function not found. Your libc has failed you.]])
+AC_FUNC_FSEEKO
+dnl XS_CHECK_FEATURE([ac_cv_sys_largefile_source], [fseeko/ftello])
+AC_CHECK_FUNCS([memset])
+XS_CHECK_FEATURE([ac_cv_func_memset], [memset])
+AC_CHECK_FUNCS([bsearch])
+XS_CHECK_FEATURE([ac_cv_func_bsearch], [bsearch])
 
 
 dnl ***
--- a/src/config.h.in	Sun Nov 18 18:09:19 2012 +0200
+++ b/src/config.h.in	Mon Nov 19 01:47:29 2012 +0200
@@ -22,6 +22,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#undef HAVE_FSEEKO
+
 /* Define if the GNU gettext() function is already present or preinstalled. */
 #undef HAVE_GETTEXT
 
@@ -37,9 +40,6 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
-
 /* Define if you have reSID for libSIDPlay 2 */
 #undef HAVE_RESID_BUILDER
 
@@ -125,6 +125,9 @@
 /* Number of bits in a file offset, on hosts where this is settable. */
 #undef _FILE_OFFSET_BITS
 
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#undef _LARGEFILE_SOURCE
+
 /* Define for large files, on AIX-style hosts. */
 #undef _LARGE_FILES
 
@@ -137,5 +140,8 @@
 #undef inline
 #endif
 
+/* Define to `long int' if <sys/types.h> does not define. */
+#undef off_t
+
 /* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t