annotate GEMBASSY-1.0.3/m4/pngdriver.m4 @ 1:84a17b3fad1f draft

Uploaded
author ktnyt
date Fri, 26 Jun 2015 05:20:29 -0400
parents 8300eb051bea
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1 dnl @synopsis CHECK_PNGDRIVER()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2 dnl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3 dnl This macro searches for an installed png/gd/zlib library. If nothing
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4 dnl was specified when calling configure, it searches first in /usr/local
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5 dnl and then in /usr. If the --with-pngdriver=DIR is specified, it will try
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6 dnl to find it in DIR/include/zlib.h and DIR/lib/libz.a. If --without-pngdriver
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7 dnl is specified, the library is not searched at all.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8 dnl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9 dnl It defines the symbol PLD_png if the librarys are found. You should
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10 dnl use autoheader to include a definition for this symbol in a config.h
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11 dnl file.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
12 dnl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
13 dnl Sources files should then use something like
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
14 dnl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
15 dnl #ifdef PLD_png
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
16 dnl #include <zlib.h>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
17 dnl #endif /* PLD_png */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
18 dnl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
19 dnl @author Ian Longden <il@sanger.ac.uk>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
20 dnl Modified: Alan Bleasby. Corrected library order
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
21 dnl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
22
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
23 AC_DEFUN([CHECK_PNGDRIVER],
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
24 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
25 # Handle user hints
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
26 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
27 [AC_MSG_CHECKING([if png driver is wanted])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
28 AC_ARG_WITH([pngdriver],
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
29 [AS_HELP_STRING([--with-pngdriver=@<:@DIR@:>@],
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
30 [root directory path of png/gd/zlib installation (defaults to /usr)])],
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
31 [if test "$withval" != no ; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
32 AC_MSG_RESULT([yes])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
33 ALT_HOME="$withval"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
34 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
35 AC_MSG_RESULT([no])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
36 fi], [
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
37 AC_MSG_RESULT([yes])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
38 ALT_HOME=/usr
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
39 ])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
40
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
41
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
42 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
43 # Locate png/gd/zlib, if wanted
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
44 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
45 if test -d "${ALT_HOME}"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
46 then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
47
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
48 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
49 # Keep a copy if it fails
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
50 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
51 ALT_LDFLAGS="$LDFLAGS"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
52 ALT_CPPFLAGS="$CPPFLAGS"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
53
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
54 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
55 # Set
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
56 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
57 LDFLAGS="${LDFLAGS} -L${ALT_HOME}/lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
58 CPPFLAGS="$CPPFLAGS -I$ALT_HOME/include"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
59
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
60 ICCHECK=0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
61 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
62 solaris*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
63 AC_CHECK_LIB(iconv, libiconv_close, ICCHECK=1, ICCHECK=0, -L${ALT_HOME}/lib -liconv)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
64 if test $ICCHECK = "1" ; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
65 LDFLAGS="${LDFLAGS} -L${ALT_HOME}/lib -liconv"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
66 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
67 LDFLAGS="$LDFLAGS -R$ALT_HOME/lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
68 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
69 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
70
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
71
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
72
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
73
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
74
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
75 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
76 # Check for zlib in ALT_HOME
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
77 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
78 AC_CHECK_LIB(z, inflateEnd, CHECK=1, CHECK=0, -L${ALT_HOME}/lib -lz)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
79 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
80
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
81 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
82 # Check for png
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
83 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
84 if test $CHECK = "1" ; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
85 AC_CHECK_LIB(png, png_destroy_read_struct, CHECK=1, CHECK=0 , -L${ALT_HOME}/lib -lz)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
86 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
87
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
88
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
89
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
90
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
91 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
92 # Check for gd
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
93 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
94 if test $CHECK = "1"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
95 AC_CHECK_LIB(gd, gdImageCreateFromPng, CHECK=1, CHECK=0 , -L${ALT_HOME}/lib -lgd -lpng -lz -lm)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
96 if test $CHECK = "0"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
97 echo need to upgrade gd for png driver for plplot
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
98 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
99 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
100 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
101 # If everything found okay then proceed to include png driver in config.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
102 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
103 if test $CHECK = "1" ; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
104 LIBS="$LIBS -lgd -lpng -lz -lm"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
105
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
106 if test $ICCHECK = "1" ; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
107 LIBS="$LIBS -liconv"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
108 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
109
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
110 case $host_os in
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
111 solaris*)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
112 LDFLAGS="$LDFLAGS -R$ALT_HOME/lib"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
113 ;;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
114 esac
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
115
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
116 AC_DEFINE([PLD_png], [1], [Define to 1 is PNG support is available])
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
117 AM_CONDITIONAL(AMPNG, true)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
118 echo PNG libraries found
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
119 if test $ALT_HOME = "/usr" ; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
120 LDFLAGS="$ALT_LDFLAGS"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
121 CPPFLAGS="$ALT_CPPFLAGS"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
122 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
123 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
124 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
125 # If not okay then reset FLAGS.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
126 #
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
127 AM_CONDITIONAL(AMPNG, false)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
128 LDFLAGS="$ALT_LDFLAGS"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
129 CPPFLAGS="$ALT_CPPFLAGS"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
130 echo No png driver will be made due to librarys missing/old.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
131 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
132 # echo PNG STUFF FOLLOWS!!!
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
133 # echo CHECK = $CHECK
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
134 # echo LIBS = $LIBS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
135 # echo LDFLAGS = $LDFLAGS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
136 # echo CPPFLAGS = $CPPFLAGS
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
137
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
138
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
139 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
140 if test $withval != "no"; then
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
141 echo "Directory $ALT_HOME does not exist"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
142 exit 0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
143 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
144 fi
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
145 ])