]> git.deb.at Git - pkg/abook.git/blob - configure.in
vformat: added abook's specific libvformat wrapper: vcard.[ch]
[pkg/abook.git] / configure.in
1 dnl abook configure.in
2
3 AC_INIT(abook.c)
4 AM_INIT_AUTOMAKE(abook, 0.6.0pre2)
5 AM_CONFIG_HEADER(config.h)
6
7 dnl ---------------
8 dnl gettext support
9 dnl ---------------
10
11 AC_USE_SYSTEM_EXTENSIONS
12 AM_GNU_GETTEXT
13 AM_GNU_GETTEXT_VERSION([0.18.1])
14
15 AC_DEFUN([ABOOK_EXPAND_PREFIX], [
16         $1=$2
17         dnl expanding twice, since from autoconf 2.60 on, $datadir refers to
18         dnl $datarootdir which in turn refers to $prefix
19         $1=`(   test "x$prefix" = xNONE && prefix="$ac_default_prefix"
20                 eval tmp_abook_prefix=\""[$]$1"\"
21                 eval echo $tmp_abook_prefix
22                 )`
23 ])
24
25 ABOOK_EXPAND_PREFIX(abook_localedir, "$datadir/locale")
26 localedir="\$(datadir)/locale"
27
28 AC_ARG_WITH(localedir,
29         [  --with-localedir=PATH      Where the locale files are installed ])
30 if test "x$with_localedir" != "x"; then
31         abook_localedir="$with_localedir"
32         localedir="$with_localedir"
33 fi
34
35 AC_DEFINE_UNQUOTED(LOCALEDIR, "$abook_localedir", [locale directory])
36 AC_SUBST(localedir)
37
38 AM_CONDITIONAL(USE_INCLUDED_INTL_H, test x$USE_INCLUDED_LIBINTL = xyes)
39
40 dnl ----------------------
41 dnl end of gettext support
42 dnl ----------------------
43
44 AC_PROG_CC
45 AC_ISC_POSIX
46 AM_C_PROTOTYPES
47 if test "x$U" != "x"; then
48         AC_MSG_ERROR(Compiler not ANSI compliant)
49 fi
50 AC_C_INLINE
51 AC_PROG_INSTALL
52 AC_HEADER_STDC
53 AC_CHECK_HEADERS(unistd.h locale.h sys/ioctl.h iconv.h)
54 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 ***]))
55 AC_FUNC_STRCOLL
56 AC_CHECK_FUNCS(setlocale)
57
58 ac_widec_funcs=yes
59 AC_CHECK_HEADER(wchar.h,[
60         ac_have_wchar_h=yes
61         AC_DEFINE(HAVE_WCHAR_H, 1, [Define if you have the <wchar.h> header file.])],
62         [ac_have_wchar_h=no])
63 AC_CHECK_FUNCS(mbtowc wcwidth mbrtowc mbsinit,,ac_widec_funcs=no)
64 AC_CHECK_DECLS(wcwidth)
65 AC_CHECK_TYPE(wchar_t,,ac_widec_funcs=no)
66
67 if test x$ac_widec_funcs = xyes -a x$ac_have_wchar_h = xyes; then
68         ac_widec_possible=yes
69 else
70         ac_widec_possible=no
71 fi
72
73 dnl -------------------
74 dnl (n)curses detection
75 dnl -------------------
76
77 abook_cv_curses=/usr
78 AC_ARG_WITH(curses, [  --with-curses=DIR       Where ncurses is installed ],
79         [if test $withval != yes; then
80                 abook_cv_curses=$withval
81         fi
82         if test x$abook_cv_curses != x/usr; then
83                 LDFLAGS="-L${abook_cv_curses}/lib $LDFLAGS"
84                 CPPFLAGS="$CPPFLAGS -I${abook_cv_curses}/include"
85         fi])
86
87 AC_CHECK_LIB(ncursesw, initscr,
88         [LIBS="$LIBS -lncursesw"
89         if test x$abook_cv_curses = x/usr -a -d /usr/include/ncursesw; then
90                 CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
91         fi
92         AC_CHECK_HEADERS(ncurses.h)],[
93         ac_widec_possible=no
94         AC_CHECK_LIB(ncurses, initscr,
95                 [LIBS="$LIBS -lncurses"
96                 if test x$abook_cv_curses = x/usr -a -d /usr/include/ncurses; then
97                         CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"
98                 fi
99                 AC_CHECK_HEADERS(ncurses.h)],
100                 [CF_CURSES_LIBS])
101         ])
102
103 dnl --------------------------
104 dnl end of (n)curses detection
105 dnl --------------------------
106
107 dnl ------------------
108 dnl readline detection
109 dnl ------------------
110
111 abook_cv_readline=/usr
112 AC_ARG_WITH(readline, [  --with-readline=DIR     Where readline is installed ],
113         [if test $withval != yes; then
114                 abook_cv_readline=$withval
115         fi
116         if test x$abook_cv_readline != x/usr; then
117                 LDFLAGS="-L${abook_cv_readline}/lib $LDFLAGS"
118                 CPPFLAGS="$CPPFLAGS -I${abook_cv_readline}/include"
119         fi])
120
121 AC_LIB_READLINE
122
123 if test x$ac_cv_lib_readline = xno -o x$ac_cv_lib_readline_history = xno; then
124         AC_MSG_ERROR([*** readline library not found or it doesn't support history ***])
125 fi
126
127 dnl -------------------------
128 dnl end of readline detection
129 dnl -------------------------
130
131 dnl ------------------
132 dnl vformat detection
133 dnl ------------------
134
135 AC_ARG_ENABLE(vformat, [  --enable-vformat          Use libvformat is available ], [case "${enableval}" in
136         yes) vformat=true ;;
137         no) vformat=false ;;
138         *) AC_MSG_ERROR(bad value ${enableval} for --enable-vformat) ;;
139         esac], [vformat=false])
140 VFORMAT="no"
141 if test x$vformat = xtrue; then
142    AC_CHECK_HEADER([vf_iface.h], [
143      AC_CHECK_LIB([vformat], [vf_read_file], [
144      MODULES="$MODULES m_vcf"
145      VFORMAT="yes"
146      LDFLAGS="-lvformat $LDFLAGS"
147      CFLAGS="-DVFORMAT=1 $CFLAGS"
148   ])
149 ])
150 fi
151 AC_SUBST(VFORMAT)
152
153 dnl -------------------------
154 dnl end of vformat detection
155 dnl -------------------------
156
157
158 if test x$ac_widec_possible = xyes; then
159         AC_DEFINE(HANDLE_MULTIBYTE, 1, [Handle multibyte characters])
160 fi
161
162 AC_CHECK_FUNCS(resizeterm)
163
164 AC_CHECK_FUNCS(snprintf vsnprintf)
165
166 AC_CHECK_FUNCS(strcasestr, AC_DEFINE(HAVE_STRCASESTR))
167
168 AC_ARG_ENABLE(debug, [  --enable-debug          Enable debugging support ], [case "${enableval}" in
169         yes) debug=true ;;
170         no) debug=false ;;
171         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
172         esac], [debug=false])
173
174 if test x$debug = xtrue; then
175         CPPFLAGS="-DDEBUG=1 $CPPFLAGS"
176         CFLAGS="-g $CFLAGS"
177 fi
178
179 if test x$GCC = xyes; then
180         CFLAGS="-Wall $CFLAGS"
181 fi
182
183 AC_OUTPUT(Makefile abook.spec intl/Makefile po/Makefile.in)