4 AM_INIT_AUTOMAKE(abook, 0.5.2pre)
5 AM_CONFIG_HEADER(config.h)
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.])
15 if test "x$U" != "x"; then
16 AC_MSG_ERROR(Compiler not ANSI compliant)
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 ***]))
24 AC_CHECK_FUNCS(setlocale)
27 AC_CHECK_HEADER(wchar.h,[
29 AC_DEFINE(HAVE_WCHAR_H, 1, [Define if you have the <wchar.h> header file.])],
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)
35 if test x$ac_widec_funcs = xyes -a x$ac_have_wchar_h = xyes; then
41 dnl -------------------
42 dnl (n)curses detection
43 dnl -------------------
46 AC_ARG_WITH(curses, [ --with-curses=DIR Where ncurses is installed ],
47 [if test $withval != yes; then
48 abook_cv_curses=$withval
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"
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"
60 AC_CHECK_HEADERS(ncurses.h)],[
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"
67 AC_CHECK_HEADERS(ncurses.h)],
71 dnl --------------------------
72 dnl end of (n)curses detection
73 dnl --------------------------
75 dnl ------------------
76 dnl readline detection
77 dnl ------------------
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
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"
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 ***])
95 dnl -------------------------
96 dnl end of readline detection
97 dnl -------------------------
99 if test x$ac_widec_possible = xyes; then
100 AC_DEFINE(HANDLE_MULTIBYTE, 1, [Handle multibyte characters])
103 AC_CHECK_FUNCS(resizeterm)
105 AC_CHECK_FUNCS(snprintf vsnprintf)
107 AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging support ], [case "${enableval}" in
110 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
111 esac], [debug=false])
113 if test x$debug = xtrue; then
114 CPPFLAGS="-DDEBUG $CPPFLAGS"
118 if test x$GCC = xyes; then
119 CFLAGS="-Wall $CFLAGS"
122 AC_OUTPUT(Makefile abook.spec)