]> git.deb.at Git - pkg/abook.git/blob - configure.in
wide character support
[pkg/abook.git] / configure.in
1 dnl abook configure.in
2
3 AC_INIT(abook.c)
4 AM_INIT_AUTOMAKE(abook, 0.5.2pre)
5 AM_CONFIG_HEADER(config.h)
6
7 AC_DEFINE(HAVE_SNPRINTF, 0, [Define if snprintf is available.])
8 AC_DEFINE(HAVE_VSNPRINTF, 0, [Define if vsnprintf is available.])
9 AC_DEFINE(HAVE_STDARG_H, 0, [Define if you have the <stdarg.h> header file.])
10 AC_DEFINE(HAVE_NCURSES, 0, [Define if you have the <ncurses.h> header file.])
11
12 AC_CANONICAL_HOST
13
14 AC_PROG_CC
15 AC_ISC_POSIX
16 AM_C_PROTOTYPES
17 if test "x$U" != "x"; then
18         AC_MSG_ERROR(Compiler not ANSI compliant)
19 fi
20 AC_C_INLINE
21 AC_PROG_INSTALL
22 AC_HEADER_STDC
23 AC_CHECK_HEADERS(unistd.h locale.h termios.h linux/termios.h sys/ioctl.h)
24 AC_CHECK_HEADER(stdarg.h,AC_DEFINE(HAVE_STDARG_H),AC_MSG_ERROR([*** stdarg.h is missing on your system ***]))
25 AC_FUNC_STRCOLL
26 AC_CHECK_FUNCS(setlocale)
27
28 ac_widec_funcs=yes
29 AC_CHECK_HEADER(wchar.h,[ac_have_wchar_h=yes], [ac_have_wchar_h=no])
30 AC_CHECK_FUNCS(mbtowc wcwidth,,ac_widec_funcs=no)
31 AC_CHECK_TYPE(wchar_t,,ac_widec_funcs=no)
32
33 if test x$ac_widec_funcs = xyes -a x$ac_have_wchar_h = xyes; then
34         ac_widec_possible=yes
35 else
36         ac_widec_possible=no
37 fi
38
39 AC_ARG_ENABLE(widec, [  --enable-widec          Enable wide character support (experimental) ], [case "${enableval}" in
40         yes) ac_widec_support=true ;;
41         no) ac_widec_support=false ;;
42         *) AC_MSG_ERROR(bad value ${enableval} for --enable-widec) ;;
43         esac], [ac_widec_support=false])
44
45 if test x$ac_widec_support = xtrue -a x$ac_widec_possible != xyes; then
46         AC_MSG_ERROR(Wide character support is not possible due to missing wide character functions or wchar.h)
47 fi
48
49 dnl -------------------
50 dnl (n)curses detection
51 dnl -------------------
52
53 abook_cv_curses=/usr
54 AC_ARG_WITH(curses, [  --with-curses=DIR       Where ncurses is installed ],
55         [if test $withval != yes; then
56                 abook_cv_curses=$withval
57         fi
58         if test x$abook_cv_curses != x/usr; then
59                 LDFLAGS="-L${abook_cv_curses}/lib $LDFLAGS"
60                 CPPFLAGS="$CPPFLAGS -I${abook_cv_curses}/include"
61         fi])
62
63 if test x$ac_widec_support = xtrue; then
64         AC_CHECK_LIB(ncursesw, initscr,
65                 [LIBS="$LIBS -lncursesw"
66                 if test x$abook_cv_curses = x/usr -a -d /usr/include/ncursesw; then
67                         CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
68                 fi
69                 AC_CHECK_HEADERS(ncurses.h)],[
70                 AC_MSG_ERROR("Wide character support is not possible due to missing ncursesw library. Please install it or disable wide character support")])
71 else
72         AC_CHECK_LIB(ncurses, initscr,
73                 [LIBS="$LIBS -lncurses"
74                 if test x$abook_cv_curses = x/usr -a -d /usr/include/ncurses; then
75                         CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"
76                 fi
77                 AC_CHECK_HEADERS(ncurses.h)],
78                 [CF_CURSES_LIBS])
79 fi
80
81 dnl --------------------------
82 dnl end of (n)curses detection
83 dnl --------------------------
84
85 dnl ------------------
86 dnl readline detection
87 dnl ------------------
88
89 abook_cv_readline=/usr
90 AC_ARG_WITH(readline, [  --with-readline=DIR     Where readline is installed ],
91         [if test $withval != yes; then
92                 abook_cv_readline=$withval
93         fi
94         if test x$abook_cv_readline != x/usr; then
95                 LDFLAGS="-L${abook_cv_readline}/lib $LDFLAGS"
96                 CPPFLAGS="$CPPFLAGS -I${abook_cv_readline}/include"
97         fi])
98
99 AC_LIB_READLINE
100
101 if test x$ac_cv_lib_readline = xno -o x$ac_cv_lib_readline_history = xno; then
102         AC_MSG_ERROR([*** readline library not found or it doesn't support history ***])
103 fi
104
105 dnl -------------------------
106 dnl end of readline detection
107 dnl -------------------------
108
109 if test x$ac_widec_support = xtrue; then
110         AC_DEFINE(HANDLE_MULTIBYTE, 1, [Handle multibyte characters])
111 fi
112
113 AC_CHECK_FUNCS(resizeterm)
114
115 AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)],)
116 AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)],)
117
118 AC_ARG_ENABLE(debug, [  --enable-debug          Enable debugging support ], [case "${enableval}" in
119         yes) debug=true ;;
120         no) debug=false ;;
121         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
122         esac], [debug=false])
123
124 if test x$debug = xtrue; then
125         CPPFLAGS="-DDEBUG $CPPFLAGS"
126         CFLAGS="-g $CFLAGS"
127 fi
128
129 if test x$GCC = xyes; then
130         CFLAGS="-Wall $CFLAGS"
131 fi
132
133 AC_OUTPUT(Makefile abook.spec)
134