1# Process this file with autoconf to produce a configure script.
2AC_INIT([src/ui.c])
3AM_INIT_AUTOMAKE(pwman, 0.4.5)
4AM_CONFIG_HEADER(config.h)
5AC_CONFIG_FILES([pwman.spec])
6
7# Checks for programs.
8AC_PROG_CC
9AC_ISC_POSIX
10
11AC_CHECK_HEADERS(unistd.h locale.h termios.h linux/termios.h sys/ioctl.h string.h)
12
13AC_CHECK_FUNCS(drand48)
14AC_CHECK_LIB(c, strcasestr, CFLAGS="$CFLAGS -DHAVE_STRCASESTR" )
15# Checks for libraries.
16dnl -------------------
17dnl ncurses detection
18dnl -------------------
19
20curses_loc=/usr
21AC_ARG_WITH(curses, [  --with-ncurses=PATH	Where ncurses is installed ],
22        [if test $withval != yes; then
23                curses_loc=$withval
24        fi
25        if test x$curses_loc != x/usr; then
26                LDFLAGS="-L${curses_loc}/lib $LDFLAGS"
27                CPPFLAGS="$CPPFLAGS -I${curses_loc}/include"
28        fi])
29
30AC_CHECK_LIB(curses, initscr,
31        [LIBS="$LIBS -lcurses"
32        if test x$curses_loc = x/usr -a -d /usr/include/ncurses; then
33                CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"
34        fi
35        AC_CHECK_HEADERS(ncurses.h)],
36	[ echo "*************************************************************"
37	  echo "  ncurses not found. "
38	  echo "  Set path to ncurses install with --with-ncurses"
39	  echo "*************************************************************"
40	  exit])
41
42dnl
43dnl Checks for libxml2
44dnl
45AC_ARG_WITH(libxml2,
46            [  --with-libxml2=PFX   Prefix where libxml is installed ],
47            libxml2_loc="$withval", libxml2_loc="")
48
49if test x$libxml2_loc != x ; then
50     if test x${XML2_CONFIG+set} != xset ; then
51        XML2_CONFIG=$libxml2_loc/bin/xml2-config
52     fi
53fi
54
55AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
56
57if test "$XML2_CONFIG" = "no" ; then
58	echo "*************************************************************"
59	echo "  libxml2 not found. "
60	echo "  It may not be installed or may be in a installed in a "
61	echo "  location other than /usr"
62	echo "  Set path to libxml2 install with --with-libxml2"
63	echo "*************************************************************"
64	exit
65else
66	XML_CFLAGS=`$XML2_CONFIG $libxml2_args --cflags`
67	XML_LIBS=`$XML2_CONFIG $libxml2_args --libs`
68fi
69
70
71LIBS="$LIBS $XML_LIBS";
72CFLAGS="$CFLAGS $XML_CFLAGS";
73
74dnl
75dnl Debugging
76dnl
77AC_ARG_WITH(debug,
78            [  --with-debug   Turn on Debugging ],
79	    [ LIBS="$LIBS -ggdb"
80	      CFLAGS="$CFLAGS -DDEBUG"
81	      echo "* Debugging is On *" ],
82	      echo "* Debugging is Off *")
83
84AC_SUBST(CFLAGS)
85AC_SUBST(CPPFLAGS)
86AC_SUBST(LDFLAGS)
87
88dnl --------------------------
89dnl end of xml detection
90dnl --------------------------
91
92AC_SUBST(CFLAGS)
93AC_SUBST(CPPFLAGS)
94AC_SUBST(LDFLAGS)
95
96# Checks for header files.
97AC_HEADER_STDC
98AC_CHECK_HEADERS([string.h])
99
100# Checks for typedefs, structures, and compiler characteristics.
101AC_TYPE_SIZE_T
102
103# Checks for library functions.
104
105AC_OUTPUT([Makefile src/Makefile doc/Makefile])
106