An Example Macro

Macros are not trivial to write, since they need to extract their information without interfering with the external system. They also need to account for many possibilities.

AC_DEFUN([JH_PYTHON_CHECK],
[AC_CACHE_VAL([jh_cv_path_python],
[if test "x$PYTHON" != x; then
  jh_cv_path_python="$PYTHON"
else
    dnl python code to check for required python
    jh_python_check='
    import sys, string
    if sys.version_info < $1:
        sys.exit(1)
    $2
    sys.exit(0)'
    dnl
    
      for jh_python in python python2 python2.3 python2.2 python2.1 python2.0;
      do
        jh_save_IFS=$IFS; IFS=$PATH_SEPARATOR
        jh_dummy="$PATH"
        for jh_dir in $jh_dummy; do
    ...
        done
        test -n "$jh_cv_path_python" && break
      done
fi
])