]> git.proxmox.com Git - mirror_frr.git/commitdiff
configure: fix static linking with readline
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 2 Sep 2016 03:42:07 +0000 (06:42 +0300)
committerDonald Sharp <sharpd@cumulusnetwroks.com>
Fri, 2 Sep 2016 16:54:13 +0000 (12:54 -0400)
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
http://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking)
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
script.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
configure.ac

index f6d7bd33cf98e7c30112b554636fee6107e745eb..35a40356ddbdaa03fbd71ee1e43b2570357fe196 100755 (executable)
@@ -700,7 +700,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",,
                       "$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.])