summaryrefslogtreecommitdiff
path: root/Build/source/libs/libpng/libpng.ac
blob: bf05b425f967678c6d2797669e68d0360bb6a797 (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
# beginning of libpng.ac
if test "$needs_pnglib" = no; then
  LIBPNGCPPFLAGS=
  LDLIBPNG=
  LIBPNGDEP=
else
  EXTRA_LIBPNG_INCLUDE=
  EXTRA_LIBPNG_LIBDIR=

  if test "$with_system_pnglib" = yes; then
    if test "x$with_pnglib_libdir" != x; then
      EXTRA_LIBPNG_LIBDIR="-L$with_pnglib_libdir"
    fi
    if test "x$with_pnglib_include" != x; then
      EXTRA_LIBPNG_INCLUDE="-I$with_pnglib_include"
    fi
  fi

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

  LDFLAGS="$LDFLAGS $EXTRA_LIBPNG_LIBDIR"
  CPP="$CPP $EXTRA_LIBPNG_INCLUDE"

  if test "$with_system_pnglib" = yes; then
      AC_CHECK_LIB(png, png_set_read_fn,
        pnglib=-lpng,
        AC_MSG_WARN(Standard PNG library not found. Compiling my own.)
        with_system_pnglib=no,
        -lz -lm)
  fi

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

  if test "$with_system_pnglib" != yes; then
    LIBPNGCPPFLAGS='-I$(LIBPNGDIR) -I$(LIBPNGSRCDIR)'
    LDLIBPNG='$(LIBPNGDIR)/libpng.a'
    LIBPNGDEP='$(LIBPNGDIR)/libpng.a'
    using_system_pnglib=no
  else
    LIBPNGCPPFLAGS="$EXTRA_LIBPNG_INCLUDE"
    LDLIBPNG="$EXTRA_LIBPNG_LIBDIR -lpng"
    LIBPNGDEP=
    using_system_pnglib=yes
  fi
fi

AC_SUBST(LIBPNGCPPFLAGS)
AC_SUBST(LDLIBPNG)
AC_SUBST(LIBPNGDEP)
# end of libpng.ac