diff options
Diffstat (limited to 'src/libgrecs.m4')
-rw-r--r-- | src/libgrecs.m4 | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/libgrecs.m4 b/src/libgrecs.m4 new file mode 100644 index 0000000..88ce312 --- /dev/null +++ b/src/libgrecs.m4 | |||
@@ -0,0 +1,47 @@ | |||
1 | # libgrecs.m4 serial 1 | ||
2 | dnl This file is part of Grecs | ||
3 | dnl Copyright (C) 2007, 2009-2011 Sergey Poznyakoff | ||
4 | dnl | ||
5 | dnl Grecs is free software; you can redistribute it and/or modify | ||
6 | dnl it under the terms of the GNU General Public License as published by | ||
7 | dnl the Free Software Foundation; either version 3, or (at your option) | ||
8 | dnl any later version. | ||
9 | dnl | ||
10 | dnl Grecs is distributed in the hope that it will be useful, | ||
11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | dnl GNU General Public License for more details. | ||
14 | dnl | ||
15 | dnl You should have received a copy of the GNU General Public License | ||
16 | dnl along with Grecs. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | dnl AM_LIBGRECS([minversion],[if-found],[if-notfound]) | ||
19 | AC_DEFUN([AM_LIBGRECS],[ | ||
20 | cv_libgrecs=no | ||
21 | save_LIBS=$LIBS | ||
22 | AC_CHECK_LIB([grecs],[grecs_parse], | ||
23 | [AC_CHECK_HEADER([grecs.h], [cv_libgrecs=yes])]) | ||
24 | if test "$cv_libgrecs" = "yes"; then | ||
25 | LIBS="$save_LIBS -lgrecs" | ||
26 | m4_if($1,,,[ | ||
27 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | ||
28 | #include <grecs.h> | ||
29 | ]], | ||
30 | [exit(grecs_version_cmp("[libgrecs ]$1"));])], | ||
31 | [], | ||
32 | [cv_libgrecs=no])]) | ||
33 | if test "$cv_libgrecs" = "yes"; then | ||
34 | m4_if($2,,[ | ||
35 | AC_DEFINE([HAVE_GRECS_H],[1], | ||
36 | [Define if <grecs.h> is available]) | ||
37 | AC_DEFINE([HAVE_LIBGRECS],[1], | ||
38 | [Define if libgrecs is available]) | ||
39 | save_LIBS=$LIBS | ||
40 | ],[ | ||
41 | $2]) | ||
42 | else | ||
43 | m4_if($3,,:,[$3]) | ||
44 | fi | ||
45 | LIBS=$save_LIBS | ||
46 | fi | ||
47 | ]) | ||