]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix readline to use TERM_LIB found for conio
authorKern Sibbald <kern@sibbald.com>
Mon, 1 Mar 2010 14:20:51 +0000 (15:20 +0100)
committerKern Sibbald <kern@sibbald.com>
Mon, 1 Mar 2010 16:18:57 +0000 (17:18 +0100)
bacula/autoconf/configure.in

index c34faee8862972a9d0af4ba2a0a17a6d243b86a1..9d804412189fd77856475fd491934f544e8715bc 100644 (file)
@@ -819,45 +819,33 @@ if test x$support_ipv6 = xyes; then
    AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
 fi
 
+TERM_LIB=""
+AC_CHECK_HEADER(termcap.h, 
+  [ AC_CHECK_LIB(termcap, tgetent, 
+    [ TERM_LIB="-ltermcap" ],
+    [ AC_CHECK_LIB(ncurses, tgetent, [ TERM_LIB="-lncurses" ])
+    ])
+  ],
+  [  AC_CHECK_HEADERS(curses.h)
+     AC_CHECK_HEADER(term.h,
+       [ AC_CHECK_LIB(curses, tgetent, 
+        [ TERM_LIB="-lcurses" ] )
+       ])
+  ])
+
+
 got_conio="no"
 if test x$support_conio = xyes; then
-   AC_CHECK_HEADER(termcap.h, 
-     [ AC_CHECK_LIB(termcap, tgetent, 
-       [ CONS_LIBS="-ltermcap"
-    CONS_OBJ="conio.o"
-    CONS_SRC="conio.c"
-    got_conio="yes"
-    support_readline=no
-    AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
-       ],   
-       [ AC_CHECK_LIB(ncurses, tgetent,
-    [ CONS_LIBS="-lncurses"
+   if test x$TERM_LIB != x; then
+      CONS_LIBS=$TERM_LIB
       CONS_OBJ="conio.o"
       CONS_SRC="conio.c"
       got_conio="yes"
       support_readline=no
       AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
-    ])
-       ])
-     ],
-     [
-    AC_CHECK_HEADERS(curses.h)
-    AC_CHECK_HEADER(term.h,
-         [ AC_CHECK_LIB(curses, tgetent, 
-       [ CONS_LIBS="-lcurses"
-        CONS_OBJ="conio.o"
-        CONS_SRC="conio.c"
-        got_conio="yes"
-        support_readline=no
-        AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
-       ])
-         ],
-         [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
-[#if HAVE_CURSES_H
-#include <curses.h>
-#endif
-])
-     ])
+   else
+      echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
+   fi
 fi
 
 
@@ -873,6 +861,9 @@ AC_ARG_ENABLE(readline,
        fi
    ]
 )
+if test x$TERM_LIB = x ; then
+   support_readline=no
+fi
 
 got_readline="no"
 READLINE_SRC=
@@ -899,7 +890,7 @@ if test x$support_readline = xyes; then
             AC_CHECK_HEADER(${with_readline}/readline.h, 
                [
                    AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
-                   CONS_LIBS="-lreadline -lhistory -ltermcap"
+                   CONS_LIBS="-lreadline -lhistory $TERM_LIB"
                    got_readline="yes"   
                ], [
                    echo " "
@@ -916,7 +907,7 @@ if test x$support_readline = xyes; then
                AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
                got_readline="yes"
                CONS_INC="-I/usr/include/readline"
-               CONS_LIBS="-lreadline -ltermcap"
+               CONS_LIBS="-lreadline $TERM_LIB"
            ], [
                dnl Did not find standard library, so try Bacula's default
                AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h, 
@@ -924,7 +915,7 @@ if test x$support_readline = xyes; then
                        AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
                        got_readline="yes"   
                        CONS_INC="-I${TOP_DIR}/depkgs/readline"
-                       CONS_LIBS="-lreadline -lhistory -ltermcap"
+                       CONS_LIBS="-lreadline -lhistory $TERM_LIB"
                        CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
                        PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
                    ], [
@@ -3300,3 +3291,4 @@ then
        echo " upgrade it in order to avoid problems with Batch insert mode"
        echo
 fi
+