From 92997b781a035626bef4e84fbcd7f2282f761a3c Mon Sep 17 00:00:00 2001 From: Thomas Adam Date: Thu, 24 Jul 2014 21:31:07 +0100 Subject: [PATCH] Add compat/fparseln() for non-BSD systems Linux and friends don't natively have fparseln() so add it to compat/ and ensure autotools can pick it up. --- Makefile.am | 3 +++ cfg.c | 1 - compat.h | 4 ++++ configure.ac | 7 +++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 5f622acb..9fcb45f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -213,6 +213,9 @@ endif if NO_FGETLN nodist_tmux_SOURCES += compat/fgetln.c endif +if NO_FPARSELN +nodist_tmux_SOURCES += compat/fparseln.c +endif if NO_GETOPT nodist_tmux_SOURCES += compat/getopt.c endif diff --git a/cfg.c b/cfg.c index 5a6d67ef..0e0f55bc 100644 --- a/cfg.c +++ b/cfg.c @@ -23,7 +23,6 @@ #include #include #include -#include #include "tmux.h" diff --git a/compat.h b/compat.h index 65d6ec7a..bf6e5360 100644 --- a/compat.h +++ b/compat.h @@ -239,6 +239,10 @@ int vasprintf(char **, const char *, va_list); char *fgetln(FILE *, size_t *); #endif +#ifndef HAVE_FPARSELN +char *fparseln(FILE *, size_t *, size_t *, const char *, int); +#endif + #ifndef HAVE_SETENV /* setenv.c */ int setenv(const char *, const char *, int); diff --git a/configure.ac b/configure.ac index a81ecc42..82533a35 100644 --- a/configure.ac +++ b/configure.ac @@ -295,6 +295,13 @@ if test "x$found_fgetln" = xyes; then fi AM_CONDITIONAL(NO_FGETLN, [test "x$found_fgetln" = xno]) +# Look for fparseln, compat/fparseln.c used if missing. +AC_CHECK_FUNC(fparseln, found_fparseln=yes, found_fparseln=no) +if test "x$found_fparseln" = xyes; then + AC_DEFINE(HAVE_FPARSELN) +fi +AM_CONDITIONAL(NO_FPARSELN, [test "x$found_fparseln" = xno]) + # Look for strcasestr, compat/strcasestr.c used if missing. AC_CHECK_FUNC(strcasestr, found_strcasestr=yes, found_strcasestr=no) if test "x$found_strcasestr" = xyes; then