summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/gd.ac
blob: a27df507498223f0ca437def5d687ab3c51aa66c (plain)
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
if test "$needs_gd" = no; then
  GDCPPFLAGS=
  LDGD=
  GDDEP=
else
  EXTRA_GD_INCLUDE=
  EXTRA_GD_LIBDIR=

  if test "$with_system_gd" = yes; then
    if test "x$with_gd_libdir" != x; then
      EXTRA_GD_LIBDIR="-L$with_gd_libdir"
    fi
    if test "x$with_gd_include" != x; then
      EXTRA_GD_INCLUDE="-I$with_gd_include"
    fi
  fi

  OLD_LDFLAGS=$LDFLAGS
  OLD_CPP=$CPP
  OLD_LIBS=$LIBS

  LDFLAGS="$LDFLAGS $EXTRA_GD_LIBDIR"
  CPP="$CPP $EXTRA_GD_INCLUDE"

  if test "$with_system_gd" = yes; then
    AC_CHECK_LIB(gd, gdImageCreateFromPng,,
      AC_MSG_WARN(Standard gd library not found. Compiling my own.)
      with_system_gd=no)
  fi

  if test "$with_system_gd" = yes; then
    AC_CHECK_LIB(gd, gdImageGif,,
      AC_MSG_WARN(gd library does not have the necessary gif support. Compiling my own.)
      with_system_gd=no)
  fi

  if test "$with_system_gd" = yes; then
    AC_CHECK_HEADERS(gd.h)
    if test "$ac_cv_header_gd_h" != yes; then
      AC_MSG_WARN(gd.h not found. Using my own gd sources.)
      with_system_gd=no
    fi
  fi

  LDFLAGS=$OLD_LDFLAGS
  CPP=$OLD_CPP
  LIBS=$OLD_LIBS

  if test "$with_system_gd" != yes; then
    GDCPPFLAGS='-I$(GDDIR) -I$(GDSRCDIR)'
    LDGD='$(GDDIR)/libgd.a'
    GDDEP='$(GDDIR)/libgd.a'
    using_system_gd=no
  else
    GDCPPFLAGS="$EXTRA_GD_INCLUDE"
    LDGD="$EXTRA_GD_LIBDIR -lgd"
    GDDEP=
    using_system_gd=yes
  fi
fi

AC_SUBST(GDCPPFLAGS)
AC_SUBST(LDGD)
AC_SUBST(GDDEP)