File: ax_check_libjpeg.m4

package info (click to toggle)
povray 1%3A3.7.0.0-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 105,396 kB
  • ctags: 115,305
  • sloc: cpp: 438,613; ansic: 118,761; sh: 37,706; pascal: 6,420; asm: 3,355; ada: 1,681; makefile: 1,282; cs: 879; awk: 590; perl: 245; xml: 95
file content (83 lines) | stat: -rw-r--r-- 2,236 bytes parent folder | download | duplicates (7)
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
# SYNOPSIS
#
#   AX_CHECK_LIBJPEG(required_version, lib_dir)
#
# DESCRIPTION
#
#   Check whether the system has libjpeg 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_LIBJPEG],
[
  ax_check_libjpeg_save_cppflags="$CPPFLAGS"
  ax_check_libjpeg_save_ldflags="$LDFLAGS"
  if test x"$2" != x""; then
    CPPFLAGS="-I$2/../include $CPPFLAGS"
    LDFLAGS="-L$2 $LDFLAGS"
  fi

  # required numeric version (e.g. 6b -> 62)
  ax_check_libjpeg_version_num=`echo $1 | tr [[a-i]] [[1-9]]`

  # check the library
  AC_SEARCH_LIBS(
    [jpeg_std_error],
    [jpeg],
    [
      # check include file
      AC_CHECK_HEADER(
        [jpeglib.h],
        [
          # check library version, update LIBS
	  if test x"$1" != x"$ax_check_libjpeg_version_num"; then
            AC_MSG_CHECKING([for libjpeg version >= $1 ($ax_check_libjpeg_version_num)])
          else
            AC_MSG_CHECKING([for libjpeg version >= $1])
          fi
          AC_RUN_IFELSE(
            [
              AC_LANG_SOURCE(
[#include <stdio.h>
#include "jpeglib.h"
int main (void)
{
  fprintf (stderr, "%d\n", JPEG_LIB_VERSION);
  return 0;
}]
              )
            ],
            [
              ax_check_libjpeg_version=`eval $ac_try 2>&1`
              AX_COMPARE_VERSION([$ax_check_libjpeg_version], [ge], [$ax_check_libjpeg_version_num], [ax_check_libjpeg="ok"], [ax_check_libjpeg="bad"])
              AC_MSG_RESULT([$ax_check_libjpeg_version, $ax_check_libjpeg])
            ],
            [
              ax_check_libjpeg="unknown"
              AC_MSG_RESULT([$ax_check_libjpeg])
            ],
            [AC_MSG_RESULT([cross-compiling, forced])]
          )  # AC_RUN_IFELSE
        ],
        [ax_check_libjpeg="no headers"]
      )  # AC_CHECK_HEADER
    ],
    [ax_check_libjpeg="not found"],
    []
  )  # AC_SEARCH_LIBS

  if test x"$ax_check_libjpeg" != x"ok"; then
    CPPFLAGS="$ax_check_libjpeg_save_cppflags"
    LDFLAGS="$ax_check_libjpeg_save_ldflags"
  fi
])