summaryrefslogtreecommitdiff
path: root/ext/gd/config.m4
blob: 6378535f0ad10df16df37bac40b978b1853fddee (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
AC_MSG_CHECKING(whether to include GD support)
AC_ARG_WITH(gd,
[  --without-gd            Disable GD support.
  --with-gd[=DIR]         Include GD support (DIR is GD's install dir).],
[
  case "$withval" in
    no)
      AC_MSG_RESULT(no) ;;
    yes)
      GD_LIBS="-lgd"
      AC_DEFINE(HAVE_LIBGD)
      AC_MSG_RESULT(yes)
      AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ])
      ac_cv_lib_gd_gdImageLine=yes
      ;;
    *)
dnl A whole whack of possible places where this might be
      test -f $withval/include/gd1.3/gd.h && GD_INCLUDE="-I$withval/include/gd1.3"
      test -f $withval/include/gd/gd.h && GD_INCLUDE="-I$withval/include/gd"
      test -f $withval/include/gd.h && GD_INCLUDE="-I$withval/include"
      test -f $withval/gd1.3/gd.h && GD_INCLUDE="-I$withval/gd1.3"
      test -f $withval/gd/gd.h && GD_INCLUDE="-I$withval/gd"
      test -f $withval/gd.h && GD_INCLUDE="-I$withval"

      test -f $withval/lib/libgd.a && GD_LIB="$withval/lib"
      test -f $withval/lib/gd/libgd.a && GD_LIB="$withval/lib/gd"
      test -f $withval/lib/gd1.3/libgd.a && GD_LIB="$withval/lib/gd1.3"
      test -f $withval/libgd.a && GD_LIB="$withval"
      test -f $withval/gd/libgd.a && GD_LIB="$withval/gd"
      test -f $withval/gd1.3/libgd.a && GD_LIB="$withval/gd1.3"

      if test -n "$GD_INCLUDE" && test -n "$GD_LIB" ; then
        GD_LIBS="-L$GD_LIB -lgd"
        AC_DEFINE(HAVE_LIBGD)
        AC_MSG_RESULT(yes)
        AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ])
	ac_cv_lib_gd_gdImageLine=yes
      else
        AC_MSG_ERROR(Unable to find libgd.a anywhere under $withval)
      fi ;;
  esac
],[
  AC_CHECK_LIB(gd, gdImageLine)
  AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ])
])
if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then
  if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
    GD_INCLUDE="-I/usr/pkg/include/gd"
  fi
  AC_CHECK_LIB(ttf, TT_Open_Face)
  PHP_EXTENSION(gd)
  EXTRA_LIBS="$EXTRA_LIBS $GD_LIBS"
  INCLUDES="$INCLUDES $GD_INCLUDE"
fi