File: ax_check_libjpeg.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 (63 lines) | stat: -rw-r--r-- 1,784 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
# 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_COMPUTE_INT([JPEG_LIB_VERSION],[JPEG_LIB_VERSION],[#include "jpeglib.h"])
          AX_COMPARE_VERSION([$ax_check_libjpeg_version], [ge], [$JPEG_LIB_VERSION], [ax_check_libjpeg="ok"], [ax_check_libjpeg="bad"])
          AC_MSG_RESULT([$JPEG_LIB_VERSION, $ax_check_libjpeg])
        ],
        [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
])