3 #--------------------------------------------------------------------------
8 dnl This is just like the AC_PROG_AWK that comes with autoconf
9 dnl except it gets the path as well. Note that we go ahead and
10 dnl say that we provide AC_PROG_AWK since we did one better.
11 AC_DEFUN([AC_PATH_AWK],
12 [AC_PATH_PROGS(AWK, mawk gawk nawk awk, )
13 AC_PROVIDE([AC_PROG_AWK])dnl
16 dnl Now for various awk checks.
19 dnl AC_TRY_AWK(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
20 AC_DEFUN([AC_TRY_AWK],
21 [AC_REQUIRE([AC_PROG_AWK])dnl
22 cat > conftest.awk <<EOF
23 [#]line __oline__ "configure"
26 cat > conftest.txt <<EOF
29 if ($AWK -f conftest.awk conftest.txt >/dev/null; exit) 2>&AC_FD_CC
33 ifelse([$2], , :, [$2])
36 echo "configure:__oline__: $AWK -f conftest.awk conftest.txt" >&AC_FD_CC
37 echo "configure:__oline__: failed program was:" >&AC_FD_CC
38 cat conftest.awk >&AC_FD_CC
39 echo "configure:__oline__: failed input file was:" >&AC_FD_CC
40 cat conftest.txt >&AC_FD_CC
41 ifelse([$3], , , [ rm -fr conftest*
47 # see if AWK has the 'gensub' function
48 # AC_AWK_GENSUB(ACTION-IF-TRUE [, ACTION-IF-FALSE])
50 AC_DEFUN([AC_AWK_GENSUB],
51 [AC_MSG_CHECKING([whether awk ($AWK) has gensub])
52 AC_TRY_AWK([{gensub(/foo/,"bar","g");}] ,[$1] ,[$2])
55 # see if AWK has the 'gsub' function
56 # AC_AWK_GSUB(ACTION-IF-TRUE [, ACTION-IF-FALSE])
58 AC_DEFUN([AC_AWK_GSUB],
59 [AC_MSG_CHECKING([whether awk ($AWK) has gsub])
60 AC_TRY_AWK([{gsub(/foo/,"bar");}] ,[$1] ,[$2])
63 # see if AWK has the 'strftime' function
64 # AC_AWK_STRFTIME(ACTION-IF-TRUE [, ACTION-IF-FALSE])
66 AC_DEFUN([AC_AWK_STRFTIME],
67 [AC_MSG_CHECKING([whether awk ($AWK) has strftime])
68 AC_TRY_AWK([{print strftime()}] ,[$1] ,[$2])
71 # see if AWK has the 'toupper' function
72 # AC_AWK_TOUPPER(ACTION-IF-TRUE [, ACTION-IF-FALSE])
74 AC_DEFUN([AC_AWK_TOUPPER],
75 [AC_MSG_CHECKING([whether awk ($AWK) has toupper])
76 AC_TRY_AWK([{print toupper("test")}] ,[$1] ,[$2])
81 #--------------------------------------------------------------------------