Browse Source

configure: fix static linking with readline

When static linking is used, the order of the libraries is important,
and the libraries using a symbol from another library should be listed
*before* the library providing that symbol (see
for details.

When vtysh is linked statically, the command line contains "-lcurses
-lreadline", which causes a build failure due to unresolved
symbols. This is because readline is using symbols from the curses
library: the order should be the opposite.

This patch fixes that problem by putting the -lreadline at the
beginning of the LIBREADLINE variable calcualted by the configure

Signed-off-by: Thomas Petazzoni <>
Signed-off-by: Baruch Siach <>
Signed-off-by: Thomas Petazzoni <>
Signed-off-by: Baruch Siach <>
Thomas Petazzoni 3 years ago
1 changed files with 1 additions and 1 deletions
  1. 1 1

+ 1 - 1

@@ -703,7 +703,7 @@ dnl	 [TODO] on Linux, and in [TODO] on Solaris.
-         AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
+         AC_CHECK_LIB(readline, main, LIBREADLINE="-lreadline $LIBREADLINE",,
          if test $ac_cv_lib_readline_main = no; then
            AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])