From d6a3fde6c3d69fbba4a4e54daaf6c049146f9fcd Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Wed, 2 Sep 2009 17:19:12 +0000 Subject: Fix building with old versions of sys-libs/glibc. --- configure.ac | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 77bd840..f25ae5e 100644 --- a/configure.ac +++ b/configure.ac @@ -7,8 +7,26 @@ AC_PROG_CC AC_PATH_PROG(INSTALL, install) MKDIR="${MKDIR:-${INSTALL} -d}" +AC_USE_SYSTEM_EXTENSIONS + # strndup() was introduced in POSIX.1-2008. -AC_CHECK_FUNCS([strndup]) +AC_MSG_CHECKING([for strndup]) +old_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -Wall -Werror -Wextra" +AC_LINK_IFELSE( +[#include +int main() +{ + strndup("", 0); + return 0; +}], [have_strndup="1"], [have_strndup="0"]) +if test "${have_strndup}" = "1"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_STRNDUP], [1], [Define to 1 if you have the 'strndup' function.]) +else + AC_MSG_RESULT([no]) +fi +CFLAGS="${old_CFLAGS}" AC_SUBST([ASFLAGS]) AC_SUBST([MKDIR]) -- cgit v1.2.3-65-gdbad