2 dnl AC_PROG_GPERF (MINIMUM-VERSION)
4 dnl Check for availability of gperf.
5 dnl Abort if not found or if current version is not up to par.
8 AC_DEFUN([AC_PROG_GPERF],[
9 AC_PATH_PROG(GPERF, gperf, no)
10 if test "$GPERF" = no; then
11 AC_MSG_ERROR(Could not find gperf)
13 min_gperf_version=ifelse([$1], ,2.7,$1)
14 AC_MSG_CHECKING(for gperf - version >= $min_gperf_version)
15 gperf_major_version=`$GPERF --version | \
16 sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\1/'`
17 gperf_minor_version=`$GPERF --version | \
18 sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\2/'`
21 dnl Now check if the installed gperf is sufficiently new.
35 new_str = malloc ((strlen (str) + 1) * sizeof(char));
36 strcpy (new_str, str);
52 /* HP/UX 9 (%@#!) writes to sscanf strings */
53 tmp_version = my_strdup("$min_gperf_version");
54 if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
55 printf ("%s, bad version string\n", "$min_gperf_version");
59 if (($gperf_major_version > major) ||
60 (($gperf_major_version == major) && ($gperf_minor_version >= minor))) {
64 printf ("*** An old version of gperf ($gperf_major_version.$gperf_minor_version) was found.\n");
65 printf ("*** You need a version of gperf newer than %d.%d.%d. The latest version of\n",
67 printf ("*** gperf is always available from ftp://ftp.gnu.org.\n");
72 ],,no_gperf=yes,[/bin/true])
73 if test "x$no_gperf" = x ; then