diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 701f9fd..fe2f987 100644 --- a/configure.ac +++ b/configure.ac @@ -50,12 +50,18 @@ XORG_CHECK_SGML_DOCTOOLS(1.7) # Checks for header files. AC_CHECK_HEADERS([endian.h poll.h sys/poll.h]) -# Checks for library functions. -PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [ +# Checks for non-standard functions and fallback to libbsd if we can +AC_LINK_IFELSE([AC_LANG_CALL([], [reallocarray])], + [TRY_LIBBSD="no"], [TRY_LIBBSD="yes"]) +AC_LINK_IFELSE([AC_LANG_CALL([], [strlcat])], + [TRY_LIBBSD="no"], [TRY_LIBBSD="yes"]) +AS_IF([test "x$TRY_LIBBSD" = "xyes"], + [PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [ CFLAGS="$CFLAGS $LIBBSD_CFLAGS" LIBS="$LIBS $LIBBSD_LIBS" -], [:]) +], [:])]) +# Checks for library functions. AC_CHECK_FUNCS([poll readlink strlcat]) AC_CONFIG_LIBOBJ_DIR([src/util]) AC_REPLACE_FUNCS([reallocarray realpath strlcat strlcpy]) |