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 Make sure the gd header is here
|
147 |
AC_CHECK_HEADER( gd.h,[ have_gd_h="yes" ],[ have_gd_h="no" ])
|
148 |
|
149 |
if test "$have_gd_h" != "yes"; then
|
150 |
echo
|
151 |
echo "** The GD library is required for CvsGraph to function."
|
152 |
echo " Get it from http://www.boutell.com, compile it and"
|
153 |
echo " use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify"
|
154 |
echo " its location. You might also have to use --with-z-inc, --with-z-lib"
|
155 |
echo " and --with-png-inc, --with-png-lib for gd versions 1.6 and higher."
|
156 |
echo " Check config.log for more information on the problem. If your system"
|
157 |
echo " has libgd installed, you probably mis the gd.h header file."
|
158 |
exit 1
|
159 |
fi
|
160 |
|
161 |
dnl Checks for libraries.
|
162 |
AC_CHECK_LIB(m, sqrt, [
|
163 |
AC_DEFINE(LIBM)
|
164 |
MATHLIBS="-lm"
|
165 |
])
|
166 |
|
167 |
AC_CHECK_LIB(z, compress, [
|
168 |
ac_have_libz="yes"
|
169 |
ZLIB="-lz"
|
170 |
] , [
|
171 |
ac_have_libz="no"
|
172 |
] , ${LIBPATH} ${MATHLIBS} )
|
173 |
|
174 |
AC_CHECK_LIB(freetype, FT_Load_Glyph, [
|
175 |
ac_have_libfreetype="yes"
|
176 |
LIBFT="-lfreetype"
|
177 |
] , [
|
178 |
ac_have_libfreetype="no"
|
179 |
] , ${LIBPATH} ${MATHLIBS} )
|
180 |
|
181 |
AC_CHECK_LIB(ttf, TT_Load_Glyph, [
|
182 |
ac_have_libttf="yes"
|
183 |
LIBTT="-lttf"
|
184 |
] , [
|
185 |
ac_have_libttf="no"
|
186 |
] , ${LIBPATH} ${MATHLIBS} )
|
187 |
|
188 |
AC_CHECK_LIB(png, png_create_read_struct , [
|
189 |
ac_have_libpng="yes"
|
190 |
LIBPNG="-lpng"
|
191 |
] , [
|
192 |
ac_have_libpng="no"
|
193 |
] , ${LIBPATH} ${ZLIB} ${MATHLIBS} )
|
194 |
|
195 |
AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [
|
196 |
ac_have_libjpeg="yes"
|
197 |
LIBJPEG="-ljpeg"
|
198 |
] , [
|
199 |
ac_have_libjpeg="no"
|
200 |
] , ${LIBPATH} ${MATHLIBS} )
|
201 |
|
202 |
dnl Check which libraries we need to add
|
203 |
OLIBS="${LIBS}"
|
204 |
LIBS="${LIBS} ${MATHLIB}"
|
205 |
AC_CACHE_CHECK( "whether libpng needs -lz", ac_cv_png_needs_z,
|
206 |
AC_TRY_LINK_FUNC( png_create_read_struct, [
|
207 |
ac_cv_png_needs_z="no"
|
208 |
] , [
|
209 |
ac_cv_png_needs_z="yes"
|
210 |
] ) )
|
211 |
LIBS="${OLIBS}"
|
212 |
|
213 |
|
214 |
OLIBS="${LIBS}"
|
215 |
LIBS="${LIBS} ${LIBFT} ${LIBTT} ${LIBJPEG} ${MATHLIB}"
|
216 |
AC_CACHE_CHECK( "whether libgd needs -lpng", ac_cv_gd_needs_png,
|
217 |
AC_TRY_LINK_FUNC( gdImagePng, [
|
218 |
ac_cv_gd_needs_png="no"
|
219 |
] , [
|
220 |
ac_cv_gd_needs_png="yes"
|
221 |
] ) )
|
222 |
LIBS="${OLIBS}"
|
223 |
|
224 |
OLIBS="${LIBS}"
|
225 |
LIBS="${LIBS} ${LIBFT} ${LIBTT} ${LIBPNG} ${LIBZ} ${MATHLIB}"
|
226 |
AC_CACHE_CHECK( "whether libgd needs -ljpeg", ac_cv_gd_needs_jpeg,
|
227 |
AC_TRY_LINK_FUNC( gdImageJpeg, [
|
228 |
ac_cv_gd_needs_jpeg="no"
|
229 |
] , [
|
230 |
ac_cv_gd_needs_jpeg="yes"
|
231 |
] ) )
|
232 |
LIBS="${OLIBS}"
|
233 |
|
234 |
OLIBS="${LIBS}"
|
235 |
LIBS="${LIBS} ${LIBFT} ${LIBJPEG} ${LIBPNG} ${LIBZ} ${MATHLIB}"
|
236 |
AC_CACHE_CHECK( "whether libgd needs -lttf", ac_cv_gd_needs_ttf,
|
237 |
AC_TRY_LINK_FUNC( gdImageStringTTF, [
|
238 |
ac_cv_gd_needs_ttf="no"
|
239 |
] , [
|
240 |
ac_cv_gd_needs_ttf="yes"
|
241 |
] ) )
|
242 |
LIBS="${OLIBS}"
|
243 |
|
244 |
OLIBS="${LIBS}"
|
245 |
LIBS="${LIBS} ${LIBTT} ${LIBJPEG} ${LIBPNG} ${LIBZ} ${MATHLIB}"
|
246 |
AC_CACHE_CHECK( "whether libgd needs -lfreetype", ac_cv_gd_needs_freetype,
|
247 |
AC_TRY_LINK_FUNC( gdImageStringFT, [
|
248 |
ac_cv_gd_needs_freetype="no"
|
249 |
] , [
|
250 |
ac_cv_gd_needs_freetype="yes"
|
251 |
] ) )
|
252 |
LIBS="${OLIBS}"
|
253 |
|
254 |
if test "$ac_cv_gd_needs_freetype" = "yes"
|
255 |
then
|
256 |
if test "$ac_have_libfreetype" != "yes" -a "$ac_have_libttf" != "yes"
|
257 |
then
|
258 |
echo "** WARNING: Required library libfreetype not found"
|
259 |
fi
|
260 |
LIBS="${LIBS} ${LIBFT}"
|
261 |
fi
|
262 |
|
263 |
if test "$ac_cv_gd_needs_ttf" = "yes"
|
264 |
then
|
265 |
if test "$ac_have_libttf" != "yes" -a "$ac_have_libfreetype" != "yes"
|
266 |
then
|
267 |
echo "** WARNING: Required library libttf not found"
|
268 |
fi
|
269 |
LIBS="${LIBS} ${LIBTT}"
|
270 |
fi
|
271 |
|
272 |
if test "$ac_cv_gd_needs_jpeg" = "yes"
|
273 |
then
|
274 |
if test "$ac_have_libjpeg" != "yes"
|
275 |
then
|
276 |
echo "** WARNING: Required library libjpeg not found"
|
277 |
fi
|
278 |
LIBS="${LIBS} ${LIBJPEG}"
|
279 |
fi
|
280 |
|
281 |
if test "$ac_cv_gd_needs_png" = "yes"
|
282 |
then
|
283 |
if test "$ac_have_libpng" != "yes"
|
284 |
then
|
285 |
echo "** WARNING: Required library libpng not found"
|
286 |
fi
|
287 |
LIBS="${LIBS} ${LIBPNG}"
|
288 |
if test "$ac_cv_png_needs_z" = "yes"
|
289 |
then
|
290 |
if test "$ac_have_libz" != "yes"
|
291 |
then
|
292 |
echo "** WARNING: Required library libz not found"
|
293 |
fi
|
294 |
LIBS="${LIBS} ${LIBZ}"
|
295 |
fi
|
296 |
fi
|
297 |
|
298 |
LIBS="${LIBS} ${MATHLIBS}"
|
299 |
|
300 |
dnl which version of gd do we have here?
|
301 |
AC_CHECK_LIB(gd, gdImageGif, [
|
302 |
AC_DEFINE(HAVE_IMAGE_GIF)
|
303 |
have_gifs="yes"
|
304 |
] ,
|
305 |
have_gifs="no"
|
306 |
)
|
307 |
|
308 |
if test "${have_gifs}" = "yes"
|
309 |
then
|
310 |
echo "** You have a very old GD library. Please consider"
|
311 |
echo " upgrading to a more recent version (1.8.4 or newer)."
|
312 |
echo " --Note that f.x. ViewCVS needs CvsGraph to generate PNG"
|
313 |
echo " images and ancient GD libraries might contain many bugs."
|
314 |
echo " However, if you need GIFs, then you must stick to this"
|
315 |
echo " old version."
|
316 |
fi
|
317 |
|
318 |
AC_CHECK_LIB(gd, gdImagePng, [
|
319 |
AC_DEFINE(HAVE_IMAGE_PNG)
|
320 |
])
|
321 |
AC_CHECK_LIB(gd, gdImageJpeg, [
|
322 |
AC_DEFINE(HAVE_IMAGE_JPEG)
|
323 |
])
|
324 |
AC_CHECK_LIB(gd, gdImageStringTTF, [
|
325 |
if test "$ac_have_libttf" = "yes"
|
326 |
then
|
327 |
AC_DEFINE(HAVE_GDIMAGESTRINGTTF)
|
328 |
fi
|
329 |
])
|
330 |
AC_CHECK_LIB(gd, gdImageStringFT, [
|
331 |
if test "$ac_have_libfreetype" = "yes"
|
332 |
then
|
333 |
AC_DEFINE(HAVE_GDIMAGESTRINGFT)
|
334 |
fi
|
335 |
])
|
336 |
|
337 |
|
338 |
AC_SUBST(LEXFLAGS)
|
339 |
AC_SUBST(INTTYPE)
|
340 |
|
341 |
AC_OUTPUT(Makefile)
|
342 |
|
343 |
echo "Configure done. Run 'make' to build CvsGraph"
|
344 |
|