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