ncurses: link with libtinfo(w) only if needed
authorRafaël Carré <funman@videolan.org>
Sat, 22 Mar 2008 01:39:34 +0000 (02:39 +0100)
committerRafaël Carré <funman@videolan.org>
Sat, 22 Mar 2008 02:00:28 +0000 (03:00 +0100)
configure.ac

index 5ae665a..29f24ed 100644 (file)
@@ -5395,13 +5395,26 @@ AC_ARG_ENABLE(ncurses,
         VLC_ADD_LIBS([ncurses],[-lncursesw])
         ALIASES="${ALIASES} nvlc"
         AC_DEFINE([HAVE_NCURSESW], 1, [Define to 1 if you have libncursesw.])
-        AC_CHECK_LIB(tinfo, tgetent, VLC_ADD_LIBS([ncurses],[-ltinfo]))
+        AC_CHECK_LIB(ncursesw, tgetent, [],
+          AC_CHECK_LIB(tinfow, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfow])],
+            [AC_CHECK_LIB(tinfo, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfo])],
+              [AS_IF([test "x${enable_ncurses}" != "x"],
+                [AC_MSG_ERROR([tgetent not found in ncursesw tinfow tinfo]
+               )])])
+            ]
+          )
+        )
         ],
         [AC_CHECK_LIB( ncurses, mvprintw,
           [VLC_ADD_PLUGINS([ncurses])
           ALIASES="${ALIASES} nvlc"
           VLC_ADD_LIBS([ncurses],[-lncurses])
-          AC_CHECK_LIB(tinfo, tgetent, VLC_ADD_LIBS([ncurses],[-ltinfo]))],
+          AC_CHECK_LIB(ncurses, tgetent, [],
+            [AC_CHECK_LIB(tinfo, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfo])],
+              [AS_IF([test "x${enable_ncurses}" != "x"],
+                [AC_MSG_ERROR([tgetent not found in ncurses tinfo])])]
+            )]
+          )],
           [AS_IF([test "x${enable_ncurses}" != "x"], [
             AC_MSG_ERROR([libncurses not found])])]
         )]