File: ax_check_gd.html

package info (click to toggle)
autoconf-archive 20060312-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,180 kB
  • ctags: 13
  • sloc: sh: 455; makefile: 44
file content (123 lines) | stat: -rw-r--r-- 3,946 bytes parent folder | download
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
 <head>
  <title>
   Autoconf Macro: ax_check_gd
  </title>
  <link rel="stylesheet" type="text/css" href="ac-archive.css">
 </head>
 <body>
  <table summary="web navigation" style="width:100%;">
   <tbody>
    <tr>
     <td style="width:50%;" align="center">
      <a href="http://autoconf-archive.cryp.to/ax_check_gd.m4">Download M4
      Source</a>
     </td>
     <td style="width:50%;" align="center">
      <a href="macros-by-category.html">Macro Index Page</a>
     </td>
    </tr>
   </tbody>
  </table>
  <hr>
  <h1>
   ax_check_gd
  </h1>
  <h2>
   Synopsis
  </h2>
  <p class="indent" style="white-space:nowrap;">
   <code>AX_CHECK_GD</code>
  </p>
  <h2>
   Description
  </h2>
  <div class="indent">
   <p>
    Check for the gd library. (See http://www.boutell.com/gd/) If gd is found,
    the output variables GD_CFLAGS, GD_LDFLAGS and GD_LIBS will contain the
    compiler flags, linker flags and libraries necessary to use gd; otherwise,
    those variables will be empty. In addition, the symbol HAVE_GD is defined
    if the library is found, and the symbols HAVE_GD_GIF, HAVE_GD_JPEG and
    HAVE_GD_PNG are defined if the lirbary supports creating images in gif,
    jpeg and png formats, respectively.
   </p>
   <p>
    The user may use --with-gd=no or --without-gd to skip checking for the
    library. (The default is --with-gd=yes.) If the library is installed in an
    unusual location, --with-gd=DIR will cause the macro to look for
    gdlib-config in DIR/bin or, failing that, for the headers and libraries in
    DIR/include and DIR/lib.
   </p>
   <p>
    Feedback welcome!
   </p>
  </div>
  <h2>
   Author
  </h2>
  <p class="indent">
   Nick Markham &lt;markhn@rpi.edu&gt;
  </p>
  <h2>
   Last Modified
  </h2>
  <p class="indent">
   2005-09-22
  </p>
  <h2>
   M4 Source Code
  </h2>
  <div class="indent">
   <pre class="m4source">
AC_DEFUN([AX_CHECK_GD], [
        AC_ARG_WITH(gd,
                AC_HELP_STRING([--with-gd(=DIR)], [use the gd library (in DIR)]),,
                with_gd=yes)

        if test "$with_gd" != no; then
                AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, , [$with_gd/bin:$PATH])
                if test -n "$GDLIB_CONFIG"; then
                        GD_CFLAGS=`$GDLIB_CONFIG --cflags`
                        GD_LDFLAGS=`$GDLIB_CONFIG --ldflags`
                        GD_LIBS=`$GDLIB_CONFIG --libs`
                elif test -d "$with_gd"; then
                        GD_CFLAGS="-I$with_gd/include"
                        GD_LDFLAGS="-L$with_gd/lib"
                        AC_CHECK_LIB(z, inflateReset, GD_LIBS="-lz")
                        AC_CHECK_LIB(png, png_check_sig, GD_LIBS="-lpng $GD_LIBS", , $GD_LIBS)
                fi

                save_CFLAGS="$CFLAGS"
                CFLAGS="$GD_CFLAGS $CFLAGS"
                save_LDFLAGS="$LDFLAGS"
                LDFLAGS="$GD_LDFLAGS $LDFLAGS"

                AC_CHECK_LIB(gd, gdImageCreate, [
                        AC_DEFINE(HAVE_GD, 1, [ Define if you have gd library. ])
                        AC_CHECK_LIB(gd, gdImageGif, AC_DEFINE(HAVE_GD_GIF, 1, [ Define if GD supports gif. ]), , "$GD_LIBS")
                        AC_CHECK_LIB(gd, gdImageJpeg, AC_DEFINE(HAVE_GD_JPEG, 1, [ Define if GD supports jpeg. ]), , "$GD_LIBS")
                        AC_CHECK_LIB(gd, gdImagePng, AC_DEFINE(HAVE_GD_PNG, 1, [ Define if GD supports png. ]), , "$GD_LIBS")
                        GD_LIBS="-lgd $GD_LIBS"
                ], with_gd=no, $GD_LIBS)

                CFLAGS="$save_CFLAGS"
                LDFLAGS="$save_LDFLAGS"
        fi

        if test "$with_gd" = "no"; then
                GD_CFLAGS="";
                GD_LDFLAGS="";
                GD_LIBS="";
        fi

        AC_SUBST(GD_CFLAGS)
        AC_SUBST(GD_LDFLAGS)
        AC_SUBST(GD_LIBS)
])
</pre>
  </div>
 </body>
</html>