Adding DTD from svn:externals link in samba-docs SVN repo
[ira/wip.git] / docs-xml / aclocal.m4
1 dnl (C) 2003-2004 Jelmer Vernooij <jelmer@samba.org>
2 dnl Published under the GNU GPL
3 dnl
4 dnl DOCS_DEFINE_TARGET
5 dnl arg1: Target that is defined
6 dnl arg2: Requirement
7 dnl arg3: Official name
8 dnl arg4: Makefile target name
9
10 AC_DEFUN(DOCS_DEFINE_TARGET, [
11         if test "x$$1_REQUIRES" = x; then
12                 $1_REQUIRES="$$2_REQUIRES"
13         else
14                 $1_REQUIRES="$$1_REQUIRES $$2_REQUIRES"
15         fi
16
17         if test x"$$1_REQUIRES" = x; then
18                 TARGETS="$TARGETS $4"
19         else
20                 AC_MSG_RESULT([Building the $3 requires : $$1_REQUIRES])
21         fi
22 ])
23
24 dnl DOCS_TARGET_REQUIRE_PROGRAM
25 dnl arg1: program variable
26 dnl arg2: program executable name
27 dnl arg3: target that requires it
28
29 AC_DEFUN(DOCS_TARGET_REQUIRE_PROGRAM, [
30         AC_CHECK_PROGS([$1], [$2])
31         if test x"$$1" = x; then
32                 if test x"$$3_REQUIRES" = x; then
33                         $3_REQUIRES="$2"
34                 else
35                         $3_REQUIRES="$$3_REQUIRES $2"
36                 fi
37         fi
38 ])
39
40 dnl DOCS_TARGET_REQUIRE_DIR
41 dnl arg1: list of possible paths
42 dnl arg2: file in dir know to exist
43 dnl arg3: variable to store found path in
44 dnl arg4: target that requires it
45
46 AC_DEFUN(DOCS_TARGET_REQUIRE_DIR, [
47     AC_MSG_CHECKING([for $2])
48         AC_SUBST($3)
49         for I in $1; 
50         do 
51                 test -f "$I/$2" && $3="$I"
52         done
53
54         if test x$$3 = x; then
55                 if test x"$$4_REQUIRES" = x; then
56                         $4_REQUIRES="$3"
57                 else
58                         $4_REQUIRES="$$4_REQUIRES $3"
59                 fi
60                 AC_MSG_RESULT([not found])
61         else
62                 AC_MSG_RESULT([found in $$3])
63         fi
64 ])