| 1 |
# Configure paths for anything that uses gtk-style *-config scripts |
|---|
| 2 |
# The script must support `--cflags' and `--libs' args |
|---|
| 3 |
# If any of these features are used, it must also support: |
|---|
| 4 |
# `--version', `--prefix' and `--exec-prefix' |
|---|
| 5 |
# (In other words, it must be like gtk-config) |
|---|
| 6 |
# |
|---|
| 7 |
# At present there is no support for additional "MODULES" (see AM_PATH_GTK) |
|---|
| 8 |
# |
|---|
| 9 |
# Angus Lees 99-3-20 <gusl@cse.unsw.edu.au> |
|---|
| 10 |
# (shamelessly stolen from gtk.m4 and then hacked around a fair amount) |
|---|
| 11 |
|
|---|
| 12 |
dnl AM_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
|---|
| 13 |
dnl Run LIBRARY-config script and define LIBRARY_CFLAGS and LIBRARY_LIBS |
|---|
| 14 |
dnl |
|---|
| 15 |
AC_DEFUN(AM_PATH_GENERIC, |
|---|
| 16 |
[dnl |
|---|
| 17 |
dnl we're going to need uppercase, lowercase and user-friendly versions of the |
|---|
| 18 |
dnl string `LIBRARY' |
|---|
| 19 |
define(UP, translit([$1], [a-z], [A-Z]))dnl |
|---|
| 20 |
define(DOWN, translit([$1], [A-Z], [a-z]))dnl |
|---|
| 21 |
|
|---|
| 22 |
dnl |
|---|
| 23 |
dnl Get the cflags and libraries from the LIBRARY-config script |
|---|
| 24 |
dnl |
|---|
| 25 |
AC_ARG_WITH(DOWN-prefix,[ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)], |
|---|
| 26 |
DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="") |
|---|
| 27 |
AC_ARG_WITH(DOWN-exec-prefix,[ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)], |
|---|
| 28 |
DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="") |
|---|
| 29 |
|
|---|
| 30 |
if test x$DOWN[]_config_exec_prefix != x ; then |
|---|
| 31 |
DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix" |
|---|
| 32 |
if test x${UP[]_CONFIG+set} != xset ; then |
|---|
| 33 |
UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config |
|---|
| 34 |
fi |
|---|
| 35 |
fi |
|---|
| 36 |
if test x$DOWN[]_config_prefix != x ; then |
|---|
| 37 |
DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix" |
|---|
| 38 |
if test x${UP[]_CONFIG+set} != xset ; then |
|---|
| 39 |
UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config |
|---|
| 40 |
fi |
|---|
| 41 |
fi |
|---|
| 42 |
|
|---|
| 43 |
AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no) |
|---|
| 44 |
ifelse([$2], , |
|---|
| 45 |
AC_MSG_CHECKING(for $1), |
|---|
| 46 |
AC_MSG_CHECKING(for $1 - version >= $2) |
|---|
| 47 |
) |
|---|
| 48 |
no_[]DOWN="" |
|---|
| 49 |
if test "$UP[]_CONFIG" = "no" ; then |
|---|
| 50 |
no_[]DOWN=yes |
|---|
| 51 |
else |
|---|
| 52 |
UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`" |
|---|
| 53 |
UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`" |
|---|
| 54 |
ifelse([$2], , ,[ |
|---|
| 55 |
DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \ |
|---|
| 56 |
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
|---|
| 57 |
DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \ |
|---|
| 58 |
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
|---|
| 59 |
DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \ |
|---|
| 60 |
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
|---|
| 61 |
DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])" |
|---|
| 62 |
DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])" |
|---|
| 63 |
DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])" |
|---|
| 64 |
|
|---|
| 65 |
# Compare wanted version to what config script returned |
|---|
| 66 |
if test "$DOWN[]_config_major_version" -lt \ |
|---|
| 67 |
"$DOWN[]_wanted_major_version" \ |
|---|
| 68 |
-o \( "$DOWN[]_config_major_version" -eq \ |
|---|
| 69 |
"$DOWN[]_wanted_major_version" \ |
|---|
| 70 |
-a "$DOWN[]_config_minor_version" -lt \ |
|---|
| 71 |
"$DOWN[]_wanted_minor_version" \) \ |
|---|
| 72 |
-o \( "$DOWN[]_config_major_version" -eq \ |
|---|
| 73 |
"$DOWN[]_wanted_major_version" \ |
|---|
| 74 |
-a "$DOWN[]_config_minor_version" -eq \ |
|---|
| 75 |
"$DOWN[]_wanted_minor_version" \ |
|---|
| 76 |
-a "$DOWN[]_config_micro_version" -lt \ |
|---|
| 77 |
"$DOWN[]_wanted_micro_version" \) ; then |
|---|
| 78 |
# older version found |
|---|
| 79 |
no_[]DOWN=yes |
|---|
| 80 |
echo -n "*** An old version of $1 " |
|---|
| 81 |
echo -n "($DOWN[]_config_major_version" |
|---|
| 82 |
echo -n ".$DOWN[]_config_minor_version" |
|---|
| 83 |
echo ".$DOWN[]_config_micro_version) was found." |
|---|
| 84 |
echo -n "*** You need a version of $1 newer than " |
|---|
| 85 |
echo -n "$DOWN[]_wanted_major_version" |
|---|
| 86 |
echo -n ".$DOWN[]_wanted_minor_version" |
|---|
| 87 |
echo ".$DOWN[]_wanted_micro_version." |
|---|
| 88 |
echo "***" |
|---|
| 89 |
echo "*** If you have already installed a sufficiently new version, this error" |
|---|
| 90 |
echo "*** probably means that the wrong copy of the DOWN-config shell script is" |
|---|
| 91 |
echo "*** being found. The easiest way to fix thihs is to remove the old version" |
|---|
| 92 |
echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the" |
|---|
| 93 |
echo "*** correct copy of DOWN-config. (In this case, you will have to" |
|---|
| 94 |
echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf" |
|---|
| 95 |
echo "*** so that the correct libraries are found at run-time)" |
|---|
| 96 |
fi |
|---|
| 97 |
]) |
|---|
| 98 |
fi |
|---|
| 99 |
if test "x$no_[]DOWN" = x ; then |
|---|
| 100 |
AC_MSG_RESULT(yes) |
|---|
| 101 |
ifelse([$3], , :, [$3]) |
|---|
| 102 |
else |
|---|
| 103 |
AC_MSG_RESULT(no) |
|---|
| 104 |
if test "$UP[]_CONFIG" = "no" ; then |
|---|
| 105 |
echo "*** The DOWN-config script installed by $1 could not be found" |
|---|
| 106 |
echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in" |
|---|
| 107 |
echo "*** your path, or set the UP[]_CONFIG environment variable to the" |
|---|
| 108 |
echo "*** full path to DOWN-config." |
|---|
| 109 |
fi |
|---|
| 110 |
UP[]_CFLAGS="" |
|---|
| 111 |
UP[]_LIBS="" |
|---|
| 112 |
ifelse([$4], , :, [$4]) |
|---|
| 113 |
fi |
|---|
| 114 |
AC_SUBST(UP[]_CFLAGS) |
|---|
| 115 |
AC_SUBST(UP[]_LIBS) |
|---|
| 116 |
]) |
|---|