source: trunk/m4/ax_gperf.m4 @ 12

Revision 12, 1.3 KB checked in by mmamonski, 13 years ago (diff)

version 1.0.7 release candidate

  • Property svn:keywords set to Id
Line 
1# $Id$
2#
3# SYNOPSIS
4#
5#   AX_GPERF([ACTION-IF-FOUND[, [ACTION-IF-NOT-FOUND]])
6#
7# DESCRIPTION
8#
9#   Test for Gperf perfect hash function generator binary.
10#   When not found GPERF is set with location of fallback
11#   script which prints error message and exits with non-zero
12#   error code.
13#
14#   This macro calls::
15#
16#     AC_SUBST(GPERF)
17#
18# LAST MODIFICATION
19#
20#   2007-12-14
21#
22# LICENSE
23#
24#   Written by Łukasz Cieśnik <lukasz.ciesnik@gmail.com>
25#   and placed under Public Domain
26#
27
28AC_DEFUN([AX_GPERF], [
29        AC_MSG_CHECKING([for gperf])
30        if { echo a; echo b; echo c; } | gperf >/dev/null 2>&1; then
31                ax_prog_gperf_ok=yes
32                GPERF=gperf
33        else
34                if echo $srcdir | grep -q "^/"; then
35                        abs_srcdir="$srcdir"
36                else
37                        abs_srcdir="`pwd`/$srcdir"
38                fi
39                GPERF="${abs_builddir}/scripts/gperf-fallback.sh"
40                cat >$GPERF <<EOF
41#!/bin/sh
42cat >&2 <<MESSAGE
43 * ERROR: gperf was not found at configuration time while some sources are
44 * build by it.  Either install gperf <http://www.gnu.org/software/gperf/>
45 * or download tarball with generated sources included (than you will
46 * not be able to modify .gperf files).
47MESSAGE
48exit 1
49EOF
50                chmod +x $GPERF
51                ax_prog_gperf_ok=no
52        fi
53        AC_SUBST(GPERF)
54        AC_MSG_RESULT([$ax_prog_gperf_ok])
55        if test x$ax_prog_gperf_ok = xyes; then
56                ifelse([$1], , :, [$1])
57        else
58                ifelse([$2], , :, [$2])
59        fi
60])
Note: See TracBrowser for help on using the repository browser.