1 dnl /usr/share/aclocal/guidod-cvs/ax_warning_default_aclocaldir.m4
2 dnl @synopsis AX_WARNING_DEFAULT_ACLOCALDIR [(dirvariable [,[defsetting][,[A][,[N/A]]]])]
3 dnl @synopsis AX_ENABLE_DEFAULT_ACLOCALDIR [(dirvariable [,defsetting])]
5 dnl print a warning message if the $(datadir)/aclocal directory is not
6 dnl in the dirlist searched by the aclocal tool. This macro is useful
7 dnl if some `make install` would target $(datadir)/aclocal to install
8 dnl an autoconf m4 file of your project to be picked up by other
11 dnl default $1 dirvariable = aclocaldir
12 dnl default $2 defsetting = ${datadir}/aclocal
13 dnl default $3 action = nothing to do
14 dnl default $4 action = warn the user about mismatch
16 dnl In the _WARNING_ variant, the defsetting is not placed in
17 dnl dirvariable nor is it ac_subst'ed in any way. The default
18 dnl fail-action $4 is to send a warning message to the user, and the
19 dnl default accept-action $3 is nothing. It is expected that a Makefile
20 dnl is generated with aclocaldir=${datadir}/aclocal
22 dnl The _ENABLE_ variant however will set not only the $aclocaldir
23 dnl shell var of the script, but it is also AC-SUBST'ed on default -
24 dnl and furthermore a configure option "--enable-default-aclocaldir" is
25 dnl provided. Only if that option is set then $2 default is not set to
26 dnl the canonic default in the a $prefix subpath but instead $2 default
27 dnl is set to the primary path where `aclocal` looks for macros. The
28 dnl user may also override the default on the command line.
31 dnl @category Automake
32 dnl @author Guido U. Draheim <guidod@gmx.de>
33 dnl @version 2005-01-21
34 dnl @license GPLWithACException
36 AC_DEFUN([AX_WARNING_DEFAULT_ACLOCALDIR],[dnl
37 AC_REQUIRE([AX_EXPAND_PREFIX])dnl
38 AS_VAR_PUSHDEF([DIR],[ax_warning_default_aclocal_dir])dnl
39 AS_VAR_PUSHDEF([BIN],[ax_warning_default_aclocal_bin])dnl
40 AS_VAR_PUSHDEF([LOC],[ax_warning_default_aclocal_loc])dnl
41 LOC='m4_if([$2],,[${datadir}/aclocal],[$2])'
42 m4_ifval([$1],[test ".$[]$1" != "." && LOC="$[]$1"])
43 if test ".$ACLOCAL" = "." ; then
44 AC_PATH_PROG([ACLOCAL],[aclocal],[:])
47 test ".$BIN" = "." && BIN="aclocal"
48 DIR=`test ".$SHELL" = "." && SHELL="'sh'" ; eval "$BIN --print-ac-dir"`
49 test ".$DIR" = "." && test -d "/usr/share/aclocal" && DIR="/usr/share/aclocal"
50 test ".$DIR" = "." && DIR="/tmp"
51 DIR=`eval "echo $DIR"` # we need to expand
52 DIR=`eval "echo $DIR"`
53 LOC=`eval "echo $LOC"`
54 LOC=`eval "echo $LOC"`
55 LOC=`eval "echo $LOC"`
56 LOC=`eval "echo $LOC"`
57 AC_RUN_LOG([: test "$LOC" = "$DIR"])
58 if test "$LOC" != "$DIR" ; then
59 if test -f "$DIR/dirlist" ; then
60 for DIR in `cat $DIR/dirlist` $DIR ; do
61 AC_RUN_LOG([: test "$LOC" = "$DIR"])
62 test "$LOC" = "$DIR" && break
65 if test "$LOC" != "$DIR" ; then
66 m4_ifval([$4],[$4],[dnl
67 AC_MSG_NOTICE([warning: m4_if([$1],,[aclocaldir],[$1])=$LOC dnl
69 AC_MSG_NOTICE([perhaps: make install m4_if([$1],,[aclocaldir],[$1])=$DIR])
70 cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
71 aclocaldir: the m4_if([$1],,[default aclocaldir],[$1 value]) of $LOC
72 aclocaldir: is not listed in the dirlist where aclocal will look
73 aclocaldir: for macros - you can override the install-path using
74 aclocaldir: make install aclocaldir=$DIR
75 aclocaldir: or append the directory to aclocal reconfigures later as
76 aclocaldir: aclocal -I $LOC
77 aclocaldir: when an autoconf macro is needed from that directory
79 m4_ifvaln([$5],[$5])])dnl
80 m4_ifvaln([$3],[else $3])dnl
83 AS_VAR_POPDEF([LOC])dnl
84 AS_VAR_POPDEF([BIN])dnl
85 AS_VAR_POPDEF([DIR])dnl
88 AC_DEFUN([AX_ENABLE_DEFAULT_ACLOCALDIR],[dnl
89 AS_VAR_PUSHDEF([BIN],[ax_warning_default_aclocal_bin])dnl
90 AS_VAR_PUSHDEF([DIR],[ax_warning_default_aclocal_def])dnl
91 AS_VAR_PUSHDEF([DEF],[ax_warning_default_aclocal_def])dnl
92 AC_ARG_ENABLE([enable-default-aclocaldir],
93 [ --enable-default-aclocaldir(=PATH) override the datadir/aclocal default])
94 test ".$enable_default_aclocaldir" = "." && enable_default_aclocaldir="no"
95 case ".$enable_default_aclocaldir" in
96 .no) DIR='m4_if([$2],,[${datadir}/aclocal],[$2])' ;;
98 if test ".$ACLOCAL" = "." ; then
99 AC_PATH_PROG([ACLOCAL],[aclocal],[:])
102 test ".$BIN" = "." && BIN="aclocal"
103 DIR=`test ".$SHELL" = "." && SHELL="'sh'" ; eval "$BIN --print-ac-dir"`
104 test ".$DIR" = "." && test -d "/usr/share/aclocal" && DIR="/usr/share/aclocal"
105 test ".$DIR" = "." && DIR="/tmp" ;;
106 *) DIR="$enable_default_aclocaldir" ;;
108 AX_WARNING_DEFAULT_ACLOCALDIR([$1],[$DEF],[$3],[$4],[$5])
109 m4_if([$1],,[aclocaldir],[$1])="$ax_warning_default_aclocal_dir"
110 AC_SUBST(m4_if([$1],,[aclocaldir],[$1]))
111 AS_VAR_POPDEF([DEF])dnl
112 AS_VAR_POPDEF([DIR])dnl
113 AS_VAR_POPDEF([BIN])dnl