1dnl abook configure.in
2
3AC_INIT([Abook], [0.6.1], [abook-devel@lists.sourceforge.net], [abook], [http://abook.sourceforge.net])
4AC_CONFIG_SRCDIR([abook.c])
5AC_CONFIG_HEADER(config.h)
6AM_INIT_AUTOMAKE
7
8dnl ---------------
9dnl gettext support
10dnl ---------------
11
12AC_USE_SYSTEM_EXTENSIONS
13AM_GNU_GETTEXT([external])
14AM_GNU_GETTEXT_VERSION([0.18.1])
15
16AC_DEFUN([ABOOK_EXPAND_PREFIX], [
17	$1=$2
18	dnl expanding twice, since from autoconf 2.60 on, $datadir refers to
19	dnl $datarootdir which in turn refers to $prefix
20	$1=`(	test "x$prefix" = xNONE && prefix="$ac_default_prefix"
21		eval tmp_abook_prefix=\""[$]$1"\"
22		eval echo $tmp_abook_prefix
23		)`
24])
25
26ABOOK_EXPAND_PREFIX(abook_localedir, "$datadir/locale")
27localedir="\$(datadir)/locale"
28
29AC_ARG_WITH(localedir,
30	[  --with-localedir=PATH      Where the locale files are installed ])
31if test "x$with_localedir" != "x"; then
32	abook_localedir="$with_localedir"
33	localedir="$with_localedir"
34fi
35
36AC_DEFINE_UNQUOTED(LOCALEDIR, "$abook_localedir", [locale directory])
37AC_SUBST(localedir)
38
39AM_CONDITIONAL(USE_INCLUDED_INTL_H, test x$USE_INCLUDED_LIBINTL = xyes)
40
41dnl ----------------------
42dnl end of gettext support
43dnl ----------------------
44
45AC_PROG_CC
46AC_SEARCH_LIBS([strerror],[cposix])
47if test "x$U" != "x"; then
48	AC_MSG_ERROR(Compiler not ANSI compliant)
49fi
50AC_C_INLINE
51AC_PROG_INSTALL
52AC_HEADER_STDC
53AC_CHECK_HEADERS(unistd.h locale.h sys/ioctl.h iconv.h)
54AC_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 ***]))
55AC_FUNC_STRCOLL
56AC_CHECK_FUNCS(setlocale)
57
58ac_widec_funcs=yes
59AC_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])
63AC_CHECK_FUNCS(mbtowc wcwidth mbrtowc mbsinit,,ac_widec_funcs=no)
64AC_CHECK_DECLS(wcwidth)
65AC_CHECK_TYPE(wchar_t,,ac_widec_funcs=no)
66
67if test x$ac_widec_funcs = xyes -a x$ac_have_wchar_h = xyes; then
68	ac_widec_possible=yes
69else
70	ac_widec_possible=no
71fi
72
73dnl -------------------
74dnl (n)curses detection
75dnl -------------------
76
77abook_cv_curses=/usr
78AC_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
87AC_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
103dnl --------------------------
104dnl end of (n)curses detection
105dnl --------------------------
106
107dnl ------------------
108dnl readline detection
109dnl ------------------
110
111abook_cv_readline=/usr
112AC_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
121AC_LIB_READLINE
122
123if 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 ***])
125fi
126
127dnl -------------------------
128dnl end of readline detection
129dnl -------------------------
130
131dnl ------------------
132dnl vformat detection
133dnl ------------------
134
135AC_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])
140if test x$vformat = xtrue; then
141   AC_CHECK_HEADER([vf_iface.h], [
142     AC_CHECK_LIB([vformat], [vf_read_file], [
143     MODULES="$MODULES m_vcf"
144     AC_DEFINE(HAVE_VFORMAT,1,[Defined if the vformat library is available])
145     have_vformat=yes
146  ])
147])
148fi
149AM_CONDITIONAL(ENABLE_VFORMAT_SUPPORT,test x"$have_vformat" = "xyes")
150
151dnl -------------------------
152dnl end of vformat detection
153dnl -------------------------
154
155
156if test x$ac_widec_possible = xyes; then
157	AC_DEFINE(HANDLE_MULTIBYTE, 1, [Handle multibyte characters])
158fi
159
160AC_CHECK_FUNCS(resizeterm)
161
162AC_CHECK_FUNCS(snprintf vsnprintf)
163
164AC_CHECK_FUNCS(strcasestr, AC_DEFINE(HAVE_STRCASESTR))
165
166AC_ARG_ENABLE(debug, [  --enable-debug          Enable debugging support ], [case "${enableval}" in
167	yes) debug=true ;;
168	no) debug=false ;;
169	*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
170	esac], [debug=false])
171
172if test x$debug = xtrue; then
173	CPPFLAGS="-DDEBUG=1 $CPPFLAGS"
174	CFLAGS="-g $CFLAGS"
175fi
176
177if test x$GCC = xyes; then
178	CFLAGS="-Wall $CFLAGS"
179fi
180
181AC_CONFIG_FILES([Makefile abook.spec po/Makefile.in])
182AC_OUTPUT
183