1 |
|
dnl |
2 |
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) |
dnl This macro checks that the function strptime exists and that |
3 |
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page |
dnl it is declared in the time.h header. |
4 |
dnl also defines GSTUFF_PKG_ERRORS on error |
dnl |
5 |
AC_DEFUN([PKG_CHECK_MODULES], [ |
dnl Here is an example of its use: |
6 |
succeeded=no |
dnl |
7 |
|
dnl strptime.c replacement: |
8 |
if test -z "$PKG_CONFIG"; then |
dnl |
9 |
AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
dnl #ifndef HAVE_STRPTIME |
10 |
fi |
dnl .... |
11 |
|
dnl #endif /* HAVE_STRPTIME */ |
12 |
if test "$PKG_CONFIG" = "no" ; then |
dnl |
13 |
echo "*** The pkg-config script could not be found. Make sure it is" |
dnl In sources using strptime |
14 |
echo "*** in your path, or set the PKG_CONFIG environment variable" |
dnl |
15 |
echo "*** to the full path to pkg-config." |
dnl #ifndef HAVE_STRPTIME_DECL |
16 |
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." |
dnl extern char *strptime(const char *__s, const char *__fmt, struct tm *__tp); |
17 |
else |
dnl #endif /* HAVE_STRPTIME_DECL */ |
18 |
PKG_CONFIG_MIN_VERSION=0.9.0 |
dnl |
19 |
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then |
dnl @author Loic Dachary <loic@senga.org> |
20 |
AC_MSG_CHECKING(for $2) |
dnl @version 1.0 |
21 |
|
dnl |
22 |
if $PKG_CONFIG --exists "$2" ; then |
|
23 |
AC_MSG_RESULT(yes) |
AC_DEFUN(AC_FUNC_STRPTIME, [ |
24 |
succeeded=yes |
AC_CHECK_FUNCS(strptime) |
25 |
|
AC_MSG_CHECKING(for strptime declaration in time.h) |
26 |
AC_MSG_CHECKING($1_CFLAGS) |
AC_EGREP_HEADER(strptime, time.h, [ |
27 |
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"` |
AC_DEFINE([HAVE_STRPTIME_DECL],,[Define if the function strptime is declared in <time.h>]) |
28 |
AC_MSG_RESULT($$1_CFLAGS) |
AC_MSG_RESULT(yes) |
29 |
|
], [ |
30 |
AC_MSG_CHECKING($1_LIBS) |
AC_MSG_RESULT(no) |
31 |
$1_LIBS=`$PKG_CONFIG --libs "$2"` |
]) |
|
AC_MSG_RESULT($$1_LIBS) |
|
|
else |
|
|
$1_CFLAGS="" |
|
|
$1_LIBS="" |
|
|
## If we have a custom action on failure, don't print errors, but |
|
|
## do set a variable so people can do so. |
|
|
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` |
|
|
ifelse([$4], ,echo $$1_PKG_ERRORS,) |
|
|
fi |
|
|
|
|
|
AC_SUBST($1_CFLAGS) |
|
|
AC_SUBST($1_LIBS) |
|
|
else |
|
|
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." |
|
|
echo "*** See http://www.freedesktop.org/software/pkgconfig" |
|
|
fi |
|
|
fi |
|
|
|
|
|
if test $succeeded = yes; then |
|
|
ifelse([$3], , :, [$3]) |
|
|
else |
|
|
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) |
|
|
fi |
|
32 |
]) |
]) |
|
|
|
|
|
|