Imported Upstream version 1.47.9
[platform/upstream/help2man.git] / aclocal.m4
1 # Local macros for help2man
2
3 # Copyright (C) 2012, 2014 Free Software Foundation, Inc.
4
5 # Copying and distribution of this file, with or without modification,
6 # are permitted in any medium without royalty provided the copyright
7 # notice and this notice are preserved.  This file is offered as-is,
8 # without any warranty.
9
10 # Written by Brendan O'Dea <bod@debian.org>
11
12 changequote()
13 define(RIGHT_BRACKET, ])
14 changequote([, ])
15
16 dnl LOCAL_PROG_PERL([MIN-VERSION])
17 AC_DEFUN(LOCAL_PROG_PERL,
18 [# find perl binary
19 AC_MSG_CHECKING([for perl])
20 AC_CACHE_VAL(ac_cv_prog_PERL,
21 [ifelse([$1],,,[echo "configure:__oline__: ...version $1 required" >&AC_FD_CC
22   ])# allow user to override
23   if test -n "$PERL"; then
24     ac_try="$PERL"
25   else
26     ac_try="perl perl5"
27   fi
28
29   for ac_prog in $ac_try; do
30     echo "configure:__oline__: trying $ac_prog" >&AC_FD_CC
31     if ($ac_prog -e 'printf "found version %g\n",$RIGHT_BRACKET dnl
32 ifelse([$1],,,[;exit($RIGHT_BRACKET<$1)])') 1>&AC_FD_CC 2>&1; then
33       ac_cv_prog_PERL=$ac_prog
34       break
35     fi
36   done])dnl
37 PERL="$ac_cv_prog_PERL"
38 if test -n "$PERL"; then
39   AC_MSG_RESULT($PERL)
40 else
41   AC_MSG_RESULT(no)
42 fi
43 AC_SUBST(PERL)dnl
44 ])dnl
45
46 dnl Check for perl module
47 dnl LOCAL_PERL_MODULE(MODULE, [MIN-VERSION])
48 AC_DEFUN(LOCAL_PERL_MODULE,
49 [# check module exists
50 AC_MSG_CHECKING([for module $1])
51 define([AC_CV_NAME], translit([ac_cv_module_$1], [:], [_]))dnl
52 AC_CACHE_VAL(AC_CV_NAME,
53 [ifelse([$2],,,[echo "configure:__oline__: ...version $2 required" >&AC_FD_CC
54   ])if ($PERL -m$1[]ifelse([$2],,,[=$2]) -e 1) 1>&AC_FD_CC 2>&1; then
55     AC_CV_NAME=yes
56   else
57     AC_CV_NAME=no
58   fi
59 ])dnl
60 AC_MSG_RESULT([$]AC_CV_NAME)
61 ])dnl
62
63 dnl Set path to program, or use automake's "missing"
64 dnl LOCAL_PROG_OR_MISSING(PROG)
65 AC_DEFUN(LOCAL_PROG_OR_MISSING,
66 [ # find path or use "missing"
67 define([PROG_VAR], translit([$1], [a-z-], [A-Z_]))
68 AC_PATH_PROG(PROG_VAR, [$1], [$ac_aux_dir/missing $1])
69 ])dnl