From 81edd3b3a78265b87c2ec6100dce852db5f40d2b Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Wed, 17 May 2017 16:05:07 +0200 Subject: [PATCH 1/5] Fix build on systems with dirty headers --- configure.ac | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 2569a766..b352e039 100644 --- a/configure.ac +++ b/configure.ac @@ -303,7 +303,11 @@ case $sysdesc in AC_CHECK_HEADER([linux/rtnetlink.h], [], [AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])], - [] dnl Force new AC_CHECK_HEADER semantics + [ + dnl Some older versions of Linux kernel headers require these includes + #include + #include + ] ) ;; esac @@ -337,7 +341,7 @@ if test "$enable_client" = yes ; then AC_CHECK_HEADERS([curses.h], [], [AC_MSG_ERROR([The client requires ncurses library. Either install the library or use --disable-client to compile without the client.])], - [] dnl Force new AC_CHECK_HEADER semantics + [AC_INCLUDES_DEFAULT] ) AC_SEARCH_LIBS([tgetent], [tinfo tinfow ncurses curses termcap], @@ -348,7 +352,7 @@ if test "$enable_client" = yes ; then AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [AC_MSG_ERROR([The client requires GNU Readline library. Either install the library or use --disable-client to compile without the client.])], - [] dnl Force new AC_CHECK_HEADER semantics + [AC_INCLUDES_DEFAULT] ) AC_SEARCH_LIBS([add_history], [history], From dab6706abad3be5b8efd44fe860689df44d20e83 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Wed, 17 May 2017 17:03:36 +0200 Subject: [PATCH 2/5] History lib may be integrated to Readline lib --- configure.ac | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index b352e039..5d36d8e2 100644 --- a/configure.ac +++ b/configure.ac @@ -355,17 +355,18 @@ if test "$enable_client" = yes ; then [AC_INCLUDES_DEFAULT] ) - AC_SEARCH_LIBS([add_history], [history], - [HISTORY_LIBS="$LIBS"; LIBS=""], - [AC_MSG_ERROR([The client requires GNU Readline library. Either install the library or use --disable-client to compile without the client.])], - ) - AC_SEARCH_LIBS([rl_callback_read_char], [readline], [READLINE_LIBS="$LIBS"; LIBS=""], [AC_MSG_ERROR([The client requires GNU Readline library. Either install the library or use --disable-client to compile without the client.])], [$TINFO_LIBS] ) + AC_SEARCH_LIBS([add_history], [history], + [HISTORY_LIBS="$LIBS"; LIBS=""], + [AC_MSG_ERROR([The client requires GNU Readline library. Either install the library or use --disable-client to compile without the client.])], + [$READLINE_LIBS $TINFO_LIBS] + ) + AC_CHECK_LIB([readline], [rl_crlf], [AC_DEFINE([HAVE_RL_CRLF], [1], [Define to 1 if you have rl_crlf()])], [], @@ -379,7 +380,7 @@ if test "$enable_client" = yes ; then ) LIBS="$BASE_LIBS" - CLIENT_LIBS="$READLINE_LIBS $HISTORY_LIBS $TINFO_LIBS" + CLIENT_LIBS="$HISTORY_LIBS $READLINE_LIBS $TINFO_LIBS" fi AC_SUBST([CLIENT]) AC_SUBST([CLIENT_LIBS]) From d6e01ff90024fcee259eb145f38a0f5b000e4798 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Wed, 17 May 2017 17:30:23 +0200 Subject: [PATCH 3/5] Fix of the previous commit --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5d36d8e2..91f89edf 100644 --- a/configure.ac +++ b/configure.ac @@ -361,10 +361,10 @@ if test "$enable_client" = yes ; then [$TINFO_LIBS] ) - AC_SEARCH_LIBS([add_history], [history], + AC_SEARCH_LIBS([add_history], [history readline], [HISTORY_LIBS="$LIBS"; LIBS=""], [AC_MSG_ERROR([The client requires GNU Readline library. Either install the library or use --disable-client to compile without the client.])], - [$READLINE_LIBS $TINFO_LIBS] + [$TINFO_LIBS] ) AC_CHECK_LIB([readline], [rl_crlf], From 271fa063a3e2078d7a046146ac2da3718b080cfa Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Thu, 18 May 2017 12:05:09 +0200 Subject: [PATCH 4/5] Fix minor bug in configure script Space in action branch breaks build on some platforms. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 9ae119b4..66e100df 100644 --- a/configure.ac +++ b/configure.ac @@ -222,8 +222,8 @@ DAEMON_LIBS= AC_SUBST(DAEMON_LIBS) if test "$enable_libssh" != no ; then - AC_CHECK_HEADER([libssh/libssh.h], [ ], [fail=yes], [ ]) - AC_CHECK_LIB([ssh], [ssh_connect], [ ], [fail=yes]) + AC_CHECK_HEADER([libssh/libssh.h], [], [fail=yes], [ ]) + AC_CHECK_LIB([ssh], [ssh_connect], [], [fail=yes]) if test "$fail" != yes ; then AC_DEFINE([HAVE_LIBSSH], [1], [Define to 1 if you have the `ssh' library (-lssh).]) From 7d5e61a66a3d4ecd004f3aa44a3d1bd3682ccf07 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Thu, 18 May 2017 13:29:38 +0200 Subject: [PATCH 5/5] Fix of the previous fix Avoid empty macro argument to avoid default behavior. --- Makefile.in | 5 ++++- configure.ac | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index 25af140c..e1f8d9c2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -130,9 +130,12 @@ $(objdir)/sysdep/paths.h: Makefile tests_targets_ok = $(addsuffix .ok,$(tests_targets)) $(tests_targets): %: %.o $(tests_objs) - $(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS) + $(E)echo LD $(LDFLAGS) -o $@ $< "..." $(LIBS) $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) +# Hack to avoid problems with tests linking everything +$(tests_targets): LIBS += $(DAEMON_LIBS) + $(tests_targets_ok): %.ok: % $(Q)$* 2>/dev/null && touch $*.ok diff --git a/configure.ac b/configure.ac index 66e100df..9e375762 100644 --- a/configure.ac +++ b/configure.ac @@ -222,8 +222,8 @@ DAEMON_LIBS= AC_SUBST(DAEMON_LIBS) if test "$enable_libssh" != no ; then - AC_CHECK_HEADER([libssh/libssh.h], [], [fail=yes], [ ]) - AC_CHECK_LIB([ssh], [ssh_connect], [], [fail=yes]) + AC_CHECK_HEADER([libssh/libssh.h], [true], [fail=yes], [ ]) + AC_CHECK_LIB([ssh], [ssh_connect], [true], [fail=yes]) if test "$fail" != yes ; then AC_DEFINE([HAVE_LIBSSH], [1], [Define to 1 if you have the `ssh' library (-lssh).])