1AC_INIT(urlview.c)
2AM_INIT_AUTOMAKE(urlview, 0.9)
3dnl AM_CONFIG_HEADER(config.h)
4AC_PROG_CC_STDC
5AC_PROG_CC_C99
6CFLAGS="$CFLAGS -DURLVIEW -Dunix"
7AC_ARG_WITH(slang, [  --with-slang[=DIR]      use S-Lang instead of curses],
8	[AC_DEFINE(USE_SLANG)
9	if test $withval = yes -a -d ../slang; then
10		withval=../slang
11	fi
12	if test $withval != yes; then
13		if test $withval/include; then
14			CPPFLAGS="$CPPFLAGS -I$withval/include"
15			LIBS="$LIBS -L$withval/lib -lslang -lm"
16		else
17			CPPFLAGS="$CPPFLAGS -I$withval/src"
18			LIBS="$LIBS $withval/src/objs/libslang.a -lm"
19		fi
20	else
21		if test -d /usr/include/slang; then
22			CPPFLAGS="$CPPFLAGS -I/usr/include/slang"
23		fi
24		LIBS="$LIBS -lslang -lm"
25	fi],
26
27	[AC_CHECK_LIB(ncursesw, initscr,
28	 [LIBS="$LIBS -lncursesw"],
29	 [AC_CHECK_LIB(ncurses, initscr, [LIBS="$LIBS -lncurses"], [LIBS="$LIBS -lcurses"])])
30	AC_CHECK_FUNCS(curs_set)
31	AC_CHECK_HEADERS(ncurses.h)
32	AC_CHECK_HEADER(ncursesw/curses.h, [CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"],
33		[AC_CHECK_HEADER(ncurses/curses.h, [CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"])])])
34
35AC_REPLACE_FUNCS(snprintf)
36
37AC_ARG_WITH(rx, [  --with-rx=DIR           where to find librx],
38[if test $withval != yes; then
39	CPPFLAGS="$CPPFLAGS -I$withval"
40	if test -d $withval/include; then
41		CPPFLAGS=$CPPFLAGS/include
42	fi
43
44	if test -d $withval/lib; then
45		LIBS="$LIBS $withval/lib/librx.a"
46	else
47		LIBS="$LIBS $withval/librx.a"
48	fi
49fi],
50[AC_CHECK_FUNC(regcomp, [], [AC_CHECK_LIB(rx, regcomp, [LIBS="$LIBS -lrx"],
51	[AC_MSG_ERROR(you must install GNU librx)])])
52AC_CHECK_HEADERS(regex.h)
53])
54
55AC_CHECK_HEADERS(stdarg.h)
56AC_CHECK_HEADERS(varargs.h)
57
58AC_ARG_ENABLE(warnings, [  --enable-warnings       turn on compiler warnings],
59[if test $enableval = yes; then
60	CFLAGS="$CFLAGS -pedantic -ansi -Wall"
61fi])
62
63AC_OUTPUT(Makefile)
64