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