File: ax_check_libtiff.m4

package info (click to toggle)
povray 1%3A3.7.0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 147,232 kB
  • sloc: cpp: 845,011; ansic: 122,118; sh: 34,204; pascal: 6,420; asm: 3,355; ada: 1,681; makefile: 1,389; cs: 879; awk: 590; perl: 245; xml: 95
file content (93 lines) | stat: -rw-r--r-- 2,314 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# SYNOPSIS
#
#   AX_CHECK_LIBTIFF(required_version, lib_dir)
#
# DESCRIPTION
#
#   Check whether the system has libtiff version required_version.
#
# LAST MODIFICATION
#
#   2007-11-08
#
# COPYLEFT
#
#   Copyright (c) 2006 Nicolas Calimet
#
#   Copying and distribution of this file, with or without
#   modification, are permitted in any medium without royalty provided
#   the copyright notice and this notice are preserved.

AC_DEFUN([AX_CHECK_LIBTIFF],
[
  PKG_CHECK_MODULES([LIBTIFF],[libtiff-4 >= $1],[
    CPPFLAGS="$LIBTIFF_CFLAGS $CPPFLAGS"
    LIBS="$LIBTIFF_LIBS $LIBS"
    ax_check_libtiff=ok
  ],[
  ax_check_libtiff_save_cppflags="$CPPFLAGS"
  ax_check_libtiff_save_ldflags="$LDFLAGS"
  if test x"$2" != x""; then
    CPPFLAGS="-I$2/../include $CPPFLAGS"
    LDFLAGS="-L$2 $LDFLAGS"
  fi

  # check the library
  AC_SEARCH_LIBS(
    [TIFFGetVersion],
    [tiff],
    [
      # check include file
      AC_CHECK_HEADER(
        [tiffio.h],
        [
          # check library version, update LIBS
          AC_MSG_CHECKING([for libtiff version >= $1])
          AC_RUN_IFELSE(
            [
              AC_LANG_SOURCE(
[#include <stdio.h>
#include <string.h>
#include "tiffio.h"
int main (void)
{
  char version[[81]];
  char *p, *c;
  sprintf (version, "%.79s", TIFFGetVersion ());
  p = strstr (version, "Version ") + strlen ("Version ");
  if (! p)
    return 1;
  c = strchr (p, '\n');
  if (! c)
    return 1;
  *c = '\0';
  fprintf (stderr, "%s\n", p);
  return 0;
}]
              )
            ],
            [
              ax_check_libtiff_version=`eval $ac_try 2>&1`
              AX_COMPARE_VERSION([$ax_check_libtiff_version], [ge], [$1], [ax_check_libtiff="ok"], [ax_check_libtiff="bad"])
              AC_MSG_RESULT([$ax_check_libtiff_version, $ax_check_libtiff])
            ],
            [
              ax_check_libtiff="unknown"
              AC_MSG_RESULT([$ax_check_libtiff])
            ],
            [AC_MSG_RESULT([cross-compiling, forced])]
          )  # AC_RUN_IFELSE
        ],
        [ax_check_libtiff="no headers"]
      )  # AC_CHECK_HEADER
    ],
    [ax_check_libtiff="not found"],
    []
  )  # AC_SEARCH_LIBS

  if test x"$ax_check_libtiff" != x"ok"; then
    CPPFLAGS="$ax_check_libtiff_save_cppflags"
    LDFLAGS="$ax_check_libtiff_save_ldflags"
  fi
  ])
])