]> git.sesse.net Git - vlc/commitdiff
ncurses: base detection of wide characters support on the presence of libncursesw...
authorRafaël Carré <funman@videolan.org>
Tue, 30 Oct 2007 03:42:18 +0000 (03:42 +0000)
committerRafaël Carré <funman@videolan.org>
Tue, 30 Oct 2007 03:42:18 +0000 (03:42 +0000)
configure.ac
modules/gui/ncurses.c

index 1f5135d69fa2d34a36a71c32aa759326fc901607..57b8d9902bba2eb26447cd5989ce3f1c8dd8e49e 100644 (file)
@@ -5353,21 +5353,24 @@ dnl
 dnl  ncurses module
 dnl
 AC_ARG_ENABLE(ncurses,
-  [  --disable-ncurses       ncurses interface support (default enabled)],
+  [  --disable-ncurses       ncurses interface support (default auto)],
   [if test "${enable_ncurses}" != "no"; then
-     AC_CHECK_HEADERS(ncursesw/curses.h,
-       [AC_CHECK_LIB( ncursesw, mvprintw,
-         [VLC_ADD_PLUGINS([ncurses])
-         VLC_ADD_LIBS([ncurses],[-lncursesw])])
-       ],
-       [AC_CHECK_HEADER(curses.h,
-         [AC_CHECK_LIB(ncurses, mvprintw,
-           [VLC_ADD_PLUGINS([ncurses])
-           VLC_ADD_LIBS([ncurses],[-lncurses])]
-         )]
-       )]
-     )  
-   fi])
+    AC_CHECK_HEADER(ncurses.h,
+      [AC_CHECK_LIB(ncursesw, mvprintw,
+        [VLC_ADD_PLUGINS([ncurses])
+        VLC_ADD_LIBS([ncurses],[-lncursesw])
+        AC_DEFINE([HAVE_NCURSESW], 1, [Define to 1 if you have libncursesw.])
+        ],
+        [AC_CHECK_LIB( ncurses, mvprintw,
+          [VLC_ADD_PLUGINS([ncurses])
+          VLC_ADD_LIBS([ncurses],[-lncurses])],
+          [AS_IF([test "x${enable_ncurses}" != "x"], [
+            AC_MSG_ERROR([libncurses not found])])]
+        )]
+      )]
+    )
+  fi]
+)
 
 dnl
 dnl  XOSD plugin
index 1c10a75ac080845fcb096429b0b8e7e0b0f20439..30497191b8939a9c10d89a89e31684b2dc16da83 100644 (file)
 #include <errno.h>                                                 /* ENOMEM */
 #include <time.h>
 
-#ifdef HAVE_NCURSESW_CURSES_H
-#include <ncursesw/curses.h>
-#else
-#include <curses.h>
+#ifdef HAVE_NCURSESW
+#   define _XOPEN_SOURCE_EXTENDED 1
 #endif
 
+#include <ncurses.h>
+
 #include <vlc_interface.h>
 #include <vlc_vout.h>
 #include <vlc_aout.h>
@@ -437,7 +437,7 @@ static char *KeyToUTF8( int i_key, char *psz_part )
 
     psz_part[len] = (char)i_key;
 
-#ifdef HAVE_NCURSESW_CURSES_H
+#ifdef HAVE_NCURSESW
     psz_utf8 = strdup( psz_part );
 #else
     psz_utf8 = FromLocaleDup( psz_part );
@@ -1151,7 +1151,7 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
     va_list  vl_args;
     char    *p_buf = NULL;
     int      i_len;
-#ifdef HAVE_NCURSESW_CURSES_H
+#ifdef HAVE_NCURSESW
     size_t   i_char_len;    /* UCS character length */
     size_t   i_width;       /* Display width */
     wchar_t *psz_wide;      /* wchar_t representation of p_buf */
@@ -1166,7 +1166,7 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
         return;
 
     i_len = strlen( p_buf );
-#ifdef HAVE_NCURSESW_CURSES_H
+#ifdef HAVE_NCURSESW
     psz_wide = (wchar_t *) malloc( sizeof( wchar_t ) * ( i_len + 1 ) );
 
     i_char_len = mbstowcs( psz_wide, p_buf, i_len );
@@ -1199,7 +1199,7 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
             p_buf[w/2  ] = '.';
             p_buf[w/2+1] = '.';
         }
-#ifdef HAVE_NCURSESW_CURSES_H
+#ifdef HAVE_NCURSESW
         mvprintw( y, x, "%s", p_buf );
 #else
         char *psz_local = ToLocale( p_buf );
@@ -1209,7 +1209,7 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
     }
     else
     {
-#ifdef HAVE_NCURSESW_CURSES_H
+#ifdef HAVE_NCURSESW
         mvprintw( y, x, "%s", p_buf );
         mvhline( y, x + i_width, ' ', w - i_width );
 #else