/[CvsGraph]/cvsgraph/configure.in
ViewVC logotype

Annotate of /cvsgraph/configure.in

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.14 - (show annotations)
Thu Oct 21 20:08:42 2004 UTC (13 years, 1 month ago) by bertho
Branch: MAIN
CVS Tags: REL_1_5_1
Changes since 1.13: +3 -0 lines
Implement selection of png compression level with image_compress and enable
interlacing (progressive load) for both png and jpeg images with image_interlace.
1 dnl Configure.in script for CvsGraph
2 dnl Most of the stuff is gathered from other
3 dnl scripts that seem to do a pretty good job.
4
5 AC_INIT(cvsgraph.c)
6 AC_CONFIG_HEADER(config.h)
7
8 AC_PROG_CC
9 AC_PROG_LEX
10 AC_PROG_YACC
11
12 LEXFLAGS="-8"
13 LEXSPEED="-Cf"
14 INCL=""
15
16 dnl Extra libraries 'with'-options
17 AC_ARG_WITH(gd-inc,[ --with-gd-inc=DIR location of the gd includes],
18 [INCL="${INCL} -I${withval}"
19 ])
20
21 AC_ARG_WITH(gd-lib,[ --with-gd-lib=DIR location of the gd library],
22 [LIBS="${LIBS} -L${withval}"
23 ])
24
25 LIBS="$LIBS -lgd"
26 LIBPATH=""
27
28 AC_ARG_WITH(freetype-lib,[ --with-freetype-lib=DIR location of freetype library],
29 [LIBS="${LIBS} -L${withval}"
30 ])
31
32 AC_ARG_WITH(freetype2-lib,[ --with-freetype2-lib=DIR location of freetype2 library],
33 [LIBS="${LIBS} -L${withval}"
34 ])
35
36 AC_ARG_WITH(png-inc,[ --with-png-inc=DIR location of png includes],
37 [INCL="${INCL} -I${withval}"
38 ])
39
40 AC_ARG_WITH(png-lib,[ --with-png-lib=DIR location of png library],
41 [LIBS="${LIBS} -L${withval}"
42 ])
43
44 AC_ARG_WITH(jpeg-inc,[ --with-jpeg-inc=DIR location of jpeg includes],
45 [INCL="${INCL} -I${withval}"
46 ])
47
48 AC_ARG_WITH(jpeg-lib,[ --with-jpeg-lib=DIR location of jpeg library],
49 [LIBS="${LIBS} -L${withval}"
50 ])
51
52 AC_ARG_WITH(z-inc,[ --with-z-inc=DIR location of zlib includes],
53 [INCL="${INCL} -I${withval}"
54 ])
55
56 AC_ARG_WITH(z-lib,[ --with-z-lib=DIR location of zlib library],
57 [LIBS="${LIBS} -L${withval}"
58 ])
59
60 AC_ARG_ENABLE(speed,[ --disable-speed Turn off lex table optimization reducing speed and size of executable],
61 [if test "$enableval" = "no"; then LEXSPEED=""; fi])
62
63 if test "x$LEXSPEED" != "x"
64 then
65 LEXFLAGS="$LEXFLAGS $LEXSPEED"
66 fi
67
68 CPPFLAGS="$CPPFLAGS $INCL"
69 CFLAGS="$CFLAGS $INCL"
70
71 dnl Tests for gcc
72 if test "x${GCC}" = "xyes"
73 then
74 CFLAGS="$CFLAGS -Wall"
75 AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
76 AC_TRY_RUN([
77 int main(void) {
78 static int Array[[3]];
79 unsigned int B = 3;
80 int i;
81 for(i=0; i<B; i++) Array[[i]] = i - 3;
82 exit( Array[[1]] != -2 );
83 }],
84 ac_cv_c_gcc_strength_bug="no",
85 ac_cv_c_gcc_strength_bug="yes",
86 ac_cv_c_gcc_strength_bug="yes") )
87 if test "$ac_cv_c_gcc_strength_bug" = "yes"
88 then
89 CFLAGS="$CFLAGS -fno-strength-reduce"
90 fi
91 fi
92
93 AC_CACHE_CHECK( "sizes of int and void *", ac_cv_c_size_int_ptr,
94 AC_TRY_RUN([
95 int main(void) {
96 return sizeof(int) == sizeof(void *);
97 }],
98 ac_cv_c_size_int_ptr="no",
99 ac_cv_c_size_int_ptr="yes",
100 ac_cv_c_size_int_ptr="yes") )
101
102 AC_CACHE_CHECK( "sizes of long and void *", ac_cv_c_size_long_ptr,
103 AC_TRY_RUN([
104 int main(void) {
105 return sizeof(long) == sizeof(void *);
106 }],
107 ac_cv_c_size_long_ptr="no",
108 ac_cv_c_size_long_ptr="yes",
109 ac_cv_c_size_long_ptr="yes") )
110
111 AC_CACHE_CHECK( "sizes of long long and void *", ac_cv_c_size_longlong_ptr,
112 AC_TRY_RUN([
113 int main(void) {
114 return sizeof(long long) == sizeof(void *);
115 }],
116 ac_cv_c_size_longlong_ptr="no",
117 ac_cv_c_size_longlong_ptr="yes",
118 ac_cv_c_size_longlong_ptr="yes") )
119
120 if test "$ac_cv_c_size_int_ptr" = "no"
121 then
122 if test "$ac_cv_c_size_long_ptr" = "no"
123 then
124 if test "$ac_cv_c_size_longlong_ptr" = "no"
125 then
126 echo "** The size of an integer is not equal to a pointer."
127 echo " There are currently assumtions in the app that"
128 echo " prevents it from running if these sizes are not"
129 echo " equal."
130 echo " Please configure with a compiler that uses the"
131 echo " same sizes for ints and pointers."
132 exit 1
133 else
134 INTTYPE="long long"
135 fi
136 else
137 INTTYPE="long"
138 fi
139 else
140 INTTYPE="int"
141 fi
142
143 dnl Check getopt.h because Solaris 8 doesn't have one
144 AC_CHECK_HEADER(getopt.h, [ AC_DEFINE(HAVE_GETOPT_H) ])
145
146 dnl Check sys/wait.h because Windows doesn't have one
147 AC_CHECK_HEADER(sys/wait.h, [ AC_DEFINE(HAVE_SYS_WAIT_H) ])
148
149 dnl Make sure the gd header is here
150 AC_CHECK_HEADER( gd.h,[ have_gd_h="yes" ],[ have_gd_h="no" ])
151
152 if test "$have_gd_h" != "yes"; then
153 echo
154 echo "** The GD library is required for CvsGraph to function."
155 echo " Get it from http://www.boutell.com, compile it and"
156 echo " use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify"
157 echo " its location. You might also have to use --with-z-inc, --with-z-lib"
158 echo " and --with-png-inc, --with-png-lib for gd versions 1.6 and higher."
159 echo " Check config.log for more information on the problem. If your system"
160 echo " has libgd installed, you probably mis the gd.h header file."
161 exit 1
162 fi
163
164 dnl Checks for libraries.
165 AC_CHECK_LIB(m, sqrt, [
166 AC_DEFINE(LIBM)
167 MATHLIBS="-lm"
168 ])
169
170 AC_CHECK_LIB(z, compress, [
171 ac_have_libz="yes"
172 ZLIB="-lz"
173 ] , [
174 ac_have_libz="no"
175 ] , ${LIBPATH} ${MATHLIBS} )
176
177 AC_CHECK_LIB(freetype, FT_Load_Glyph, [
178 ac_have_libfreetype="yes"
179 LIBFT="-lfreetype"
180 ] , [
181 ac_have_libfreetype="no"
182 ] , ${LIBPATH} ${MATHLIBS} )
183
184 AC_CHECK_LIB(ttf, TT_Load_Glyph, [
185 ac_have_libttf="yes"
186 LIBTT="-lttf"
187 ] , [
188 ac_have_libttf="no"
189 ] , ${LIBPATH} ${MATHLIBS} )
190
191 AC_CHECK_LIB(png, png_create_read_struct , [
192 ac_have_libpng="yes"
193 LIBPNG="-lpng"
194 ] , [
195 ac_have_libpng="no"
196 ] , ${LIBPATH} ${ZLIB} ${MATHLIBS} )
197
198 AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [
199 ac_have_libjpeg="yes"
200 LIBJPEG="-ljpeg"
201 ] , [
202 ac_have_libjpeg="no"
203 ] , ${LIBPATH} ${MATHLIBS} )
204
205 dnl Check which libraries we need to add
206 OLIBS="${LIBS}"
207 LIBS="${LIBS} ${MATHLIB}"
208 AC_CACHE_CHECK( "whether libpng needs -lz", ac_cv_png_needs_z,
209 AC_TRY_LINK_FUNC( png_create_read_struct, [
210 ac_cv_png_needs_z="no"
211 ] , [
212 ac_cv_png_needs_z="yes"
213 ] ) )
214 LIBS="${OLIBS}"
215
216
217 OLIBS="${LIBS}"
218 LIBS="${LIBS} ${LIBFT} ${LIBTT} ${LIBJPEG} ${MATHLIB}"
219 AC_CACHE_CHECK( "whether libgd needs -lpng", ac_cv_gd_needs_png,
220 AC_TRY_LINK_FUNC( gdImagePng, [
221 ac_cv_gd_needs_png="no"
222 ] , [
223 ac_cv_gd_needs_png="yes"
224 ] ) )
225 LIBS="${OLIBS}"
226
227 OLIBS="${LIBS}"
228 LIBS="${LIBS} ${LIBFT} ${LIBTT} ${LIBPNG} ${LIBZ} ${MATHLIB}"
229 AC_CACHE_CHECK( "whether libgd needs -ljpeg", ac_cv_gd_needs_jpeg,
230 AC_TRY_LINK_FUNC( gdImageJpeg, [
231 ac_cv_gd_needs_jpeg="no"
232 ] , [
233 ac_cv_gd_needs_jpeg="yes"
234 ] ) )
235 LIBS="${OLIBS}"
236
237 OLIBS="${LIBS}"
238 LIBS="${LIBS} ${LIBFT} ${LIBJPEG} ${LIBPNG} ${LIBZ} ${MATHLIB}"
239 AC_CACHE_CHECK( "whether libgd needs -lttf", ac_cv_gd_needs_ttf,
240 AC_TRY_LINK_FUNC( gdImageStringTTF, [
241 ac_cv_gd_needs_ttf="no"
242 ] , [
243 ac_cv_gd_needs_ttf="yes"
244 ] ) )
245 LIBS="${OLIBS}"
246
247 OLIBS="${LIBS}"
248 LIBS="${LIBS} ${LIBTT} ${LIBJPEG} ${LIBPNG} ${LIBZ} ${MATHLIB}"
249 AC_CACHE_CHECK( "whether libgd needs -lfreetype", ac_cv_gd_needs_freetype,
250 AC_TRY_LINK_FUNC( gdImageStringFT, [
251 ac_cv_gd_needs_freetype="no"
252 ] , [
253 ac_cv_gd_needs_freetype="yes"
254 ] ) )
255 LIBS="${OLIBS}"
256
257 if test "$ac_cv_gd_needs_freetype" = "yes"
258 then
259 if test "$ac_have_libfreetype" != "yes" -a "$ac_have_libttf" != "yes"
260 then
261 echo "** WARNING: Required library libfreetype not found"
262 fi
263 LIBS="${LIBS} ${LIBFT}"
264 fi
265
266 if test "$ac_cv_gd_needs_ttf" = "yes"
267 then
268 if test "$ac_have_libttf" != "yes" -a "$ac_have_libfreetype" != "yes"
269 then
270 echo "** WARNING: Required library libttf not found"
271 fi
272 LIBS="${LIBS} ${LIBTT}"
273 fi
274
275 if test "$ac_cv_gd_needs_jpeg" = "yes"
276 then
277 if test "$ac_have_libjpeg" != "yes"
278 then
279 echo "** WARNING: Required library libjpeg not found"
280 fi
281 LIBS="${LIBS} ${LIBJPEG}"
282 fi
283
284 if test "$ac_cv_gd_needs_png" = "yes"
285 then
286 if test "$ac_have_libpng" != "yes"
287 then
288 echo "** WARNING: Required library libpng not found"
289 fi
290 LIBS="${LIBS} ${LIBPNG}"
291 if test "$ac_cv_png_needs_z" = "yes"
292 then
293 if test "$ac_have_libz" != "yes"
294 then
295 echo "** WARNING: Required library libz not found"
296 fi
297 LIBS="${LIBS} ${LIBZ}"
298 fi
299 fi
300
301 LIBS="${LIBS} ${MATHLIBS}"
302
303 dnl which version of gd do we have here?
304 AC_CHECK_LIB(gd, gdImageGif, [
305 AC_DEFINE(HAVE_IMAGE_GIF)
306 have_gifs="yes"
307 ] ,
308 have_gifs="no"
309 )
310
311 dnl The new versions of libgd include gifs again after the patent expired.
312 dnl So this check should not be required anymore.
313 dnl if test "${have_gifs}" = "yes"
314 dnl then
315 dnl echo "** You have a very old GD library. Please consider"
316 dnl echo " upgrading to a more recent version (1.8.4 or newer)."
317 dnl echo " --Note that f.x. ViewCVS needs CvsGraph to generate PNG"
318 dnl echo " images and ancient GD libraries might contain many bugs."
319 dnl echo " However, if you need GIFs, then you must stick to this"
320 dnl echo " old version."
321 dnl fi
322
323 AC_CHECK_LIB(gd, gdImagePng, [
324 AC_DEFINE(HAVE_IMAGE_PNG)
325 ])
326 AC_CHECK_LIB(gd, gdImagePngEx, [
327 AC_DEFINE(HAVE_GDIMAGEPNGEX)
328 ])
329 AC_CHECK_LIB(gd, gdImageJpeg, [
330 AC_DEFINE(HAVE_IMAGE_JPEG)
331 ])
332 AC_CHECK_LIB(gd, gdImageStringTTF, [
333 if test "$ac_have_libttf" = "yes"
334 then
335 AC_DEFINE(HAVE_GDIMAGESTRINGTTF)
336 fi
337 ])
338 AC_CHECK_LIB(gd, gdImageStringFT, [
339 if test "$ac_have_libfreetype" = "yes"
340 then
341 AC_DEFINE(HAVE_GDIMAGESTRINGFT)
342 fi
343 ])
344 AC_CHECK_LIB(gd, gdImageFilledArc, [
345 AC_DEFINE(HAVE_GDIMAGEFILLEDARC)
346 ])
347
348
349 AC_SUBST(LEXFLAGS)
350 AC_SUBST(INTTYPE)
351
352 AC_OUTPUT(Makefile)
353
354 echo "Configure done. Run 'make' to build CvsGraph"
355

  ViewVC Help
Powered by ViewVC 1.1.0 with CvsGraph 1.7.0