1 # ===========================================================================
3 # ===========================================================================
14 # Copyright (c) 2011 Boris Manojlovic <boris@steki.net>
16 # This program is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by the
18 # Free Software Foundation; either version 2 of the License, or (at your
19 # option) any later version.
21 # This program is distributed in the hope that it will be useful, but
22 # WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
24 # Public License for more details.
26 # You should have received a copy of the GNU General Public License along
27 # with this program. If not, see <http://www.gnu.org/licenses/>.
29 # As a special exception, the respective Autoconf Macro's copyright owner
30 # gives unlimited permission to copy, distribute and modify the configure
31 # scripts that are the output of Autoconf when processing the Macro. You
32 # need not follow the terms of the GNU General Public License when using
33 # or distributing such scripts, even though portions of the text of the
34 # Macro appear in them. The GNU General Public License (GPL) does govern
35 # all other use of the material that constitutes the Autoconf Macro.
37 # This special exception to the GPL applies to versions of the Autoconf
38 # Macro released by the Autoconf Archive. When you make and distribute a
39 # modified version of the Autoconf Macro, you may extend this special
40 # exception to the GPL to apply to your modified version as well.
44 AU_ALIAS([CHECK_CGIUTIL], [AX_CHECK_CGIUTIL])
45 AC_DEFUN([AX_CHECK_CGIUTIL],
49 [AC_ARG_WITH(cgi-util,
51 --with-cgi-util=DIR root directory path of cgi-util installation [defaults to
52 /usr/local or /usr if not found in /usr/local]
53 --without-cgi-util to disable cgi-util usage completely],
55 if test "$withval" != "no"; then
56 if test -d "$withval" ; then
58 cgi_util_places="$withval"
60 AC_MSG_WARN([Sorry, $withval does not exist])
64 dnl just provide default places where it most probably could be found
65 cgi_util_places="/usr/local /usr /opt/local /sw"
72 if test -n "$cgi_util_places" ; then
73 # check the user supplied or any other more or less 'standard' place:
74 # Most UNIX systems : /usr/local and /usr
75 # MacPorts / Fink on OSX : /opt/local respectively /sw
76 for CGIUTIL_HOME in ${cgi_util_places} ; do
77 if test -f "${CGIUTIL_HOME}/include/cgi-util.h"; then break; fi
81 # if cgi-util.h was nowhere to be found, give a notice and bail out
82 if test ! -n "${CGIUTIL_HOME}"; then
83 AC_MSG_ERROR(No cgi-util.h in any include directory of ${cgi_util_places}: either specify a valid cgi-util installation with --with-cgi-util=DIR or disable cgi-util usage with --without-cgi-util)
88 AC_CHECK_LIB(cgi-util, cgi_init, [cgi_util_cv_libcgi_util=yes], [cgi_util_cv_libcgi_util=no])
89 AC_CHECK_HEADER(cgi-util.h, [cgiutil_cv_cgiutil_h=yes], [cgi_util_cv_cgi_util_h=no])
91 CGIUTIL_LIBS="-lcgi-util"
92 CGIUTIL_CFLAGS="-I${CGIUTIL_HOME}/include"
93 if test "$cgi_util_cv_libcgi_util" != "yes" -a "$cgiutil_cv_cgiutil_h" != "yes"
95 # If either header or library was not found, revert and bomb
96 AC_MSG_ERROR(either specify a valid cgi-util installation with --with-cgi-util=DIR or disable cgi-util usage with --without-cgi-util)
99 AC_SUBST(CGIUTIL_LIBS)
100 AC_SUBST(CGIUTIL_CFLAGS)
101 AC_SUBST(CGIUTIL_LDFLAGS) dnl no really use for this library