build: Don't link with -lreadline if readline was not found.
authorAndre Noll <maan@systemlinux.org>
Thu, 13 Feb 2014 17:59:00 +0000 (18:59 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 22 Feb 2014 15:52:07 +0000 (16:52 +0100)
Currently, if libreadline is not installed, linking fails with

ld: cannot find -lreadline

This patch makes the build succeed by linking para_client, para_audioc
and para_play without readline support in this case.

configure.ac

index b456b53..75194ff 100644 (file)
@@ -732,15 +732,17 @@ AC_CHECK_HEADERS([readline/readline.h], [
 ])
 
 if test "$have_readline" = "yes"; then
-       readline_ldflags="$readline_libs -lreadline"
-       AC_SEARCH_LIBS([rl_free_keymap], [readline], [], [have_readline="no"])
+       readline_ldflags="$readline_libs"
+       AC_SEARCH_LIBS([rl_free_keymap], [readline], [
+               readline_ldflags="$readline_ldflags -lreadline"
+       ], [have_readline="no"])
        if test "$have_readline" = "no"; then # try with -lcurses
                 # clear cache
                AC_MSG_NOTICE([trying again with -lcurses])
                 unset ac_cv_search_rl_free_keymap 2> /dev/null
                AC_SEARCH_LIBS([rl_free_keymap], [readline], [
                        have_readline=yes
-                       readline_ldflags="$readline_ldflags -lcurses"
+                       readline_ldflags="$readline_ldflags -lreadline -lcurses"
                ], [], [-lcurses])
        fi
        if test "$have_readline" = "no"; then # try with -ltermcap
@@ -749,7 +751,7 @@ if test "$have_readline" = "yes"; then
                 unset ac_cv_search_rl_free_keymap 2> /dev/null
                AC_SEARCH_LIBS([rl_free_keymap], [readline], [
                        have_readline=yes
-                       readline_ldflags="$readline_ldflags -ltermcap"
+                       readline_ldflags="$readline_ldflags -lreadline -ltermcap"
                ], [], [-ltermcap])
        fi
 fi