beta-0.89.2
[luatex.git] / source / libs / zziplib / zziplib-0.13.62 / m4 / ax_warning_default_pkgconfig.m4
blobf5cdfb3c2550b7e7d8305e47dac0ba00c35f8db1
1 dnl /usr/share/aclocal/guidod-cvs/ax_warning_default_pkgconfig.m4
2 dnl @synopsis AX_WARNING_DEFAULT_PKGCONFIGDIR [(dirvariable [,[defsetting][,[A][,[N/A]]]])]
3 dnl @synopsis AX_ENABLE_DEFAULT_PKGCONFIGDIR [(dirvariable [,defsetting])]
4 dnl
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
9 dnl projects.
10 dnl
11 dnl  default $1 dirvariable = pkgconfigdir
12 dnl  default $2 defsetting  = ${libdir}/pkgconfig
13 dnl  default $3 action = nothing to do
14 dnl  default $4 action = warn the user about mismatch
15 dnl
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 pkgconfigdir=${libdir}/pkgconfig
21 dnl
22 dnl The _ENABLE_ variant however will set not only the $pkgconfigdir
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-pkgconfigdir"
25 dnl is provided. Only if that option is set then $2 default is not set
26 dnl to the canonic default in the a $prefix subpath but instead $2
27 dnl default is set to the primary path where `pkg-config` looks for .pc
28 dnl files. The user may also override the default on the command line.
29 dnl
30 dnl @category Misc
31 dnl @author Guido U. Draheim <guidod@gmx.de>
32 dnl @version 2005-01-21
33 dnl @license GPLWithACException
35 AC_DEFUN([AX_WARNING_DEFAULT_PKGCONFIGDIR],[dnl
36 AC_REQUIRE([AX_EXPAND_PREFIX])dnl
37 AS_VAR_PUSHDEF([DIR],[ax_warning_default_pkgconfig_dir])dnl
38 AS_VAR_PUSHDEF([BIN],[ax_warning_default_pkgconfig_bin])dnl
39 AS_VAR_PUSHDEF([LOC],[ax_warning_default_pkgconfig_loc])dnl
40 LOC='m4_if([$2],,[${libdir}/pkgconfig],[$2])'
41 m4_ifval([$1],[test ".$[]$1" != "." && LOC="$[]$1"])
42  if test ".$PKG_CONFIG" = "." ; then # we use the same default as in pkg.m4
43     AC_PATH_PROG([PKG_CONFIG],[pkg-config],[no])
44  fi
45  if test "$PKG_CONFIG" = "no"
46  then DIR="/" ; test -d "/usr/lib/pkgconfig" && DIR="/usr/lib/pkgconfig"
47  else BIN=`AS_DIRNAME(["$DIR"])` ;
48       if test -d "$BIN/lib/pkgconfig" ; then
49           DIR="$BIN/lib/pkgconfig"
50       else BIN=`AS_DIRNAME(["$DIR"])`
51       if test -d "$BIN/lib/pkgconfig" ; then
52           DIR="$BIN/lib/pkgconfig"
53       else
54       if test -d "/usr/lib/pkgconfig" ; then
55           DIR="/usr/lib/pkgconfig"
56       else
57           DIR="/"
58       fi fi fi
59  fi
60 AC_RUN_LOG([: last pkgconfig dir is assumed as "$DIR"])
61 DIR=`eval "echo $DIR"`
62 DIR=`eval "echo $DIR"`
63 LOC=`eval "echo $LOC"`
64 LOC=`eval "echo $LOC"`
65 LOC=`eval "echo $LOC"`
66 LOC=`eval "echo $LOC"`
67 for DIR in `echo "$PKG_CONFIG_PATH:$DIR" | sed -e 's,:, ,g'` ; do
68     AC_RUN_LOG([: test ".$LOC" = ".$DIR"])
69     test ".$LOC" = ".$DIR" && break
70 done
71 if  test "$LOC" != "$DIR" ; then
72         m4_ifval([$4],[$4],[dnl
73  AC_MSG_NOTICE([warning: m4_if([$1],,[pkgconfigdir],[$1])=$LOC dnl
74 (see config.log)])
75    AC_MSG_NOTICE([perhaps: make install m4_if([$1],,[pkgconfigdir],[$1])=$DIR])
76    cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
77  pkgconfigdir:  the m4_if([$1],,[default pkgconfigdir],[$1 value]) of $LOC
78  pkgconfigdir:  is not listed in the dirlist where pkg-config will look for
79  pkgconfigdir:  package-configs - you can override the install-path using
80  pkgconfigdir:  make install m4_if([$1],,[pkgconfigdir],[$1])=$DIR
81  pkgconfigdir:  or set/append the directory to the environment variable
82  pkgconfigdir:  PKG_CONFIG_PATH="$LOC"
83 EOF
84    m4_ifvaln([$5],[$5])])dnl
85    m4_ifvaln([$3],[else $3])dnl
87 AS_VAR_POPDEF([LOC])dnl
88 AS_VAR_POPDEF([BIN])dnl
89 AS_VAR_POPDEF([DIR])dnl
92 AC_DEFUN([AX_ENABLE_DEFAULT_PKGCONFIGDIR],[dnl
93 AS_VAR_PUSHDEF([BIN],[ax_warning_default_pkgconfig_bin])dnl
94 AS_VAR_PUSHDEF([DIR],[ax_warning_default_pkgconfig_def])dnl
95 AS_VAR_PUSHDEF([DEF],[ax_warning_default_pkgconfig_def])dnl
96 AC_ARG_ENABLE([enable-default-pkgconfigdir],
97 [  --enable-default-pkgconfigdir(=PATH) override the libdir/pkgconfig default])
98 test ".$enable_default_pkgconfigdir" = "." && enable_default_pkgconfigdir="no"
99 case ".$enable_default_pkgconfigdir" in
100   .no) DIR='m4_if([$2],,[${libdir}/pkgconfig],[$2])' ;;
101   .yes) # autodetect
102  if test ".$PKG_CONFIG" = "." ; then # we use the same default as in pkg.m4
103     AC_PATH_PROG([PKG_CONFIG],[pkg-config],[no])
104  fi
105  if test "$PKG_CONFIG" = "no"
106  then DIR="/tmp" ; test -d "/usr/lib/pkgconfig" && DIR="/usr/lib/pkgconfig"
107  else BIN=`AS_DIRNAME(["$DIR"])` ;
108       if test -d "$BIN/lib/pkgconfig" ; then
109           DIR="$BIN/lib/pkgconfig"
110       else BIN=`AS_DIRNAME(["$DIR"])`
111       if test -d "$BIN/lib/pkgconfig" ; then
112           DIR="$BIN/lib/pkgconfig"
113       else
114       if test -d "/usr/lib/pkgconfig" ; then
115           DIR="/usr/lib/pkgconfig"
116       else
117           DIR="/tmp"
118       fi fi fi
119  fi ;;
120   *) DIR="$enable_default_pkgconfigdir" ;;
121 esac
122 AX_WARNING_DEFAULT_PKGCONFIGDIR([$1],[$DEF],[$3],[$4],[$5])
123 m4_if([$1],,[pkgconfigdir],[$1])="$ax_warning_default_pkgconfig_dir"
124 AC_SUBST(m4_if([$1],,[pkgconfigdir],[$1]))
125 AS_VAR_POPDEF([DEF])dnl
126 AS_VAR_POPDEF([DIR])dnl
127 AS_VAR_POPDEF([BIN])dnl