4 AM_INIT_AUTOMAKE(abook, 0.5.2pre)
5 AM_CONFIG_HEADER(config.h)
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.])
17 if test "x$U" != "x"; then
18 AC_MSG_ERROR(Compiler not ANSI compliant)
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 ***]))
26 AC_CHECK_FUNCS(setlocale)
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)
33 if test x$ac_widec_funcs = xyes -a x$ac_have_wchar_h = xyes; then
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])
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)
49 dnl -------------------
50 dnl (n)curses detection
51 dnl -------------------
54 AC_ARG_WITH(curses, [ --with-curses=DIR Where ncurses is installed ],
55 [if test $withval != yes; then
56 abook_cv_curses=$withval
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"
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"
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")])
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"
77 AC_CHECK_HEADERS(ncurses.h)],
81 dnl --------------------------
82 dnl end of (n)curses detection
83 dnl --------------------------
85 dnl ------------------
86 dnl readline detection
87 dnl ------------------
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
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"
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 ***])
105 dnl -------------------------
106 dnl end of readline detection
107 dnl -------------------------
109 if test x$ac_widec_support = xtrue; then
110 AC_DEFINE(HANDLE_MULTIBYTE, 1, [Handle multibyte characters])
113 AC_CHECK_FUNCS(resizeterm)
115 AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)],)
116 AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)],)
118 AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging support ], [case "${enableval}" in
121 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
122 esac], [debug=false])
124 if test x$debug = xtrue; then
125 CPPFLAGS="-DDEBUG $CPPFLAGS"
129 if test x$GCC = xyes; then
130 CFLAGS="-Wall $CFLAGS"
133 AC_OUTPUT(Makefile abook.spec)