Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add pkg-config support of ncursesw, and enable maintainer mode & sile…

…nt rules of automake.
  • Loading branch information...
commit f43225be68af2f806046f0c092103aa00ee4b9fe 1 parent 716e181
Shih-Yuan Lee fourdollars authored
Showing with 12 additions and 47 deletions.
  1. +10 −43 configure.ac
  2. +2 −4 test/gen_keystroke.c
53 configure.ac
View
@@ -35,7 +35,9 @@ AC_DEFINE_UNQUOTED(LIBCHEWING_BINARY_VERSION, "$LIBCHEWING_BINARY_VERSION", [The
AC_DEFINE_UNQUOTED(LIBCHEWING_VERSION, "$PACKAGE_VERSION", [The release version of libchewing.])
# Init automake stuff
+AM_MAINTAINER_MODE([enable])
AM_INIT_AUTOMAKE
+AM_SILENT_RULES([yes])
AM_CONFIG_HEADER([include/config.h])
AC_PREFIX_DEFAULT(/usr)
@@ -84,56 +86,21 @@ AC_CHECK_FUNCS([memchr memmove memset mkdir strchr strstr])
# optional modules
CHECK_REQUIRED_VERSION=0.9.4
+NCURSESW_REQUIRED_VERSION=5.9
+NCURSES_REQUIRED_VERSION=5.9
# Checks for check unit test framework
PKG_CHECK_MODULES(CHECK, check >= $CHECK_REQUIRED_VERSION,
- enable_check=yes, enble_check=no)
+ enable_check=yes, enable_check=no)
AM_CONDITIONAL(ENABLE_UNIT_TEST, test x$enable_check = "xyes")
# Checks for ncursesw
-OLDCFLAGS=$CFLAGS
-LIB_NAME=ncursesw
-NCURSESW_CFLAGS=
-NCURSESW_LIBS=
-for p in "$HOME/include" "$prefix/include" /usr/local/include /usr/include
-do
- if test -f "$p/ncursesw/ncurses.h"
- then
- NCURSESW_CFLAGS="-I$p"
- AC_DEFINE(HAVE_NCURSESW_NCURSES_H, 1, [ Define to 1 if you have the <ncursesw/ncurses.h> header file. ])
- break
- elif test -f "$p/ncurses/ncurses.h"
- then
- NCURSESW_CFLAGS="-I$p"
- AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1, [ Define to 1 if you have the <ncurses/ncurses.h> header file. ])
- break
- fi
-done
-
-for p in "$HOME/lib" "$prefix/lib" /usr/local/lib /usr/lib
-do
- if test -f "$p/libncursesw.so"
- then
- if test "$p" != x/usr/lib
- then
- NCURSESW_LIBS="-L$p -lncursesw"
- else
- NCURSESW_LIBS="-lncursesw"
- fi
- break
- fi
-done
-
-enable_ncursesw=yes
-if test -z "$NCURSESW_CFLAGS"; then
- enable_ncursesw=no
+PKG_CHECK_MODULES(NCURSESW, ncursesw >= $NCURSESW_REQUIRED_VERSION,
+ enable_curses=yes, enable_curses=no)
+AM_CONDITIONAL(ENABLE_TEXT_UI, test x$enable_curses = "xyes")
+if test "$enable_curses" = "yes"; then
+ AC_DEFINE(HAVE_CURSES_H, 1, [ Define to 1 if you have the <curses.h> header file. ])
fi
-if test -z "$NCURSESW_LIBS"; then
- enable_ncursesw=no
-fi
-AC_SUBST(NCURSESW_CFLAGS)
-AC_SUBST(NCURSESW_LIBS)
-AM_CONDITIONAL(ENABLE_TEXT_UI, test x$enable_ncursesw = "xyes")
# Options
6 test/gen_keystroke.c
View
@@ -20,10 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_NCURSESW_NCURSES_H
-#include <ncursesw/ncurses.h>
-#elif defined( HAVE_NCURSES_NCURSES_H )
-#include <ncurses/ncurses.h>
+#ifdef HAVE_CURSES_H
+#include <curses.h>
#else
#error "There is no curses package found."
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.