Skip to content
This repository
Browse code

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 2 changed files with 12 additions and 47 deletions. Show diff stats Hide diff stats

  1. +10 43 configure.ac
  2. +2 4 test/gen_keystroke.c
53 configure.ac
@@ -35,7 +35,9 @@ AC_DEFINE_UNQUOTED(LIBCHEWING_BINARY_VERSION, "$LIBCHEWING_BINARY_VERSION", [The
35 35 AC_DEFINE_UNQUOTED(LIBCHEWING_VERSION, "$PACKAGE_VERSION", [The release version of libchewing.])
36 36
37 37 # Init automake stuff
  38 +AM_MAINTAINER_MODE([enable])
38 39 AM_INIT_AUTOMAKE
  40 +AM_SILENT_RULES([yes])
39 41 AM_CONFIG_HEADER([include/config.h])
40 42 AC_PREFIX_DEFAULT(/usr)
41 43
@@ -84,56 +86,21 @@ AC_CHECK_FUNCS([memchr memmove memset mkdir strchr strstr])
84 86
85 87 # optional modules
86 88 CHECK_REQUIRED_VERSION=0.9.4
  89 +NCURSESW_REQUIRED_VERSION=5.9
  90 +NCURSES_REQUIRED_VERSION=5.9
87 91
88 92 # Checks for check unit test framework
89 93 PKG_CHECK_MODULES(CHECK, check >= $CHECK_REQUIRED_VERSION,
90   - enable_check=yes, enble_check=no)
  94 + enable_check=yes, enable_check=no)
91 95 AM_CONDITIONAL(ENABLE_UNIT_TEST, test x$enable_check = "xyes")
92 96
93 97 # Checks for ncursesw
94   -OLDCFLAGS=$CFLAGS
95   -LIB_NAME=ncursesw
96   -NCURSESW_CFLAGS=
97   -NCURSESW_LIBS=
98   -for p in "$HOME/include" "$prefix/include" /usr/local/include /usr/include
99   -do
100   - if test -f "$p/ncursesw/ncurses.h"
101   - then
102   - NCURSESW_CFLAGS="-I$p"
103   - AC_DEFINE(HAVE_NCURSESW_NCURSES_H, 1, [ Define to 1 if you have the <ncursesw/ncurses.h> header file. ])
104   - break
105   - elif test -f "$p/ncurses/ncurses.h"
106   - then
107   - NCURSESW_CFLAGS="-I$p"
108   - AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1, [ Define to 1 if you have the <ncurses/ncurses.h> header file. ])
109   - break
110   - fi
111   -done
112   -
113   -for p in "$HOME/lib" "$prefix/lib" /usr/local/lib /usr/lib
114   -do
115   - if test -f "$p/libncursesw.so"
116   - then
117   - if test "$p" != x/usr/lib
118   - then
119   - NCURSESW_LIBS="-L$p -lncursesw"
120   - else
121   - NCURSESW_LIBS="-lncursesw"
122   - fi
123   - break
124   - fi
125   -done
126   -
127   -enable_ncursesw=yes
128   -if test -z "$NCURSESW_CFLAGS"; then
129   - enable_ncursesw=no
  98 +PKG_CHECK_MODULES(NCURSESW, ncursesw >= $NCURSESW_REQUIRED_VERSION,
  99 + enable_curses=yes, enable_curses=no)
  100 +AM_CONDITIONAL(ENABLE_TEXT_UI, test x$enable_curses = "xyes")
  101 +if test "$enable_curses" = "yes"; then
  102 + AC_DEFINE(HAVE_CURSES_H, 1, [ Define to 1 if you have the <curses.h> header file. ])
130 103 fi
131   -if test -z "$NCURSESW_LIBS"; then
132   - enable_ncursesw=no
133   -fi
134   -AC_SUBST(NCURSESW_CFLAGS)
135   -AC_SUBST(NCURSESW_LIBS)
136   -AM_CONDITIONAL(ENABLE_TEXT_UI, test x$enable_ncursesw = "xyes")
137 104
138 105 # Options
139 106
6 test/gen_keystroke.c
@@ -20,10 +20,8 @@
20 20 #include <stdio.h>
21 21 #include <stdlib.h>
22 22 #include <string.h>
23   -#ifdef HAVE_NCURSESW_NCURSES_H
24   -#include <ncursesw/ncurses.h>
25   -#elif defined( HAVE_NCURSES_NCURSES_H )
26   -#include <ncurses/ncurses.h>
  23 +#ifdef HAVE_CURSES_H
  24 +#include <curses.h>
27 25 #else
28 26 #error "There is no curses package found."
29 27 #endif

0 comments on commit f43225b

Please sign in to comment.
Something went wrong with that request. Please try again.