File: configure.in

package info (click to toggle)
cvsgraph 1.4.0-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 376 kB
  • ctags: 458
  • sloc: ansic: 3,921; yacc: 372; lex: 183; makefile: 79; php: 42; sh: 14
file content (312 lines) | stat: -rw-r--r-- 7,771 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
dnl Configure.in script for CvsGraph
dnl Most of the stuff is gathered from other
dnl scripts that seem to do a pretty good job.

AC_INIT(cvsgraph.c)
AC_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_PROG_LEX
AC_PROG_YACC

LEXFLAGS="-8"
LEXSPEED="-Cf"
INCL=""

dnl Extra libraries 'with'-options
AC_ARG_WITH(gd-inc,[  --with-gd-inc=DIR       location of the gd includes],
		[INCL="${INCL} -I${withval}"
		])

AC_ARG_WITH(gd-lib,[  --with-gd-lib=DIR       location of the gd library],
		[LIBS="${LIBS} -L${withval}"
		])

LIBS="$LIBS -lgd"
LIBPATH=""

AC_ARG_WITH(freetype-lib,[  --with-freetype-lib=DIR    location of freetype library],
		[LIBS="${LIBS} -L${withval}"
		])

AC_ARG_WITH(freetype2-lib,[  --with-freetype2-lib=DIR    location of freetype2 library],
		[LIBS="${LIBS} -L${withval}"
		])

AC_ARG_WITH(png-inc,[  --with-png-inc=DIR      location of png includes],
		[INCL="${INCL} -I${withval}"
		])

AC_ARG_WITH(png-lib,[  --with-png-lib=DIR      location of png library],
		[LIBS="${LIBS} -L${withval}"
		])

AC_ARG_WITH(jpeg-inc,[  --with-jpeg-inc=DIR    location of jpeg includes],
		[INCL="${INCL} -I${withval}"
		])

AC_ARG_WITH(jpeg-lib,[  --with-jpeg-lib=DIR    location of jpeg library],
		[LIBS="${LIBS} -L${withval}"
		])

AC_ARG_WITH(z-inc,[  --with-z-inc=DIR        location of zlib includes],
		[INCL="${INCL} -I${withval}"
		])

AC_ARG_WITH(z-lib,[  --with-z-lib=DIR        location of zlib library],
		[LIBS="${LIBS} -L${withval}"
		])

AC_ARG_ENABLE(speed,[  --disable-speed         Turn off lex table optimization reducing speed and size of executable],
		[if test "$enableval" = "no"; then LEXSPEED=""; fi])

if test "x$LEXSPEED" != "x"
then
  LEXFLAGS="$LEXFLAGS $LEXSPEED"
fi

CPPFLAGS="$CPPFLAGS $INCL"
CFLAGS="$CFLAGS $INCL"

dnl Tests for gcc
if test "x${GCC}" = "xyes"
then
  CFLAGS="$CFLAGS -Wall"
  AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
                  AC_TRY_RUN([
int main(void) {
  static int Array[[3]];
  unsigned int B = 3;
  int i;
  for(i=0; i<B; i++) Array[[i]] = i - 3;
  exit( Array[[1]] != -2 );
}],
    ac_cv_c_gcc_strength_bug="no",
    ac_cv_c_gcc_strength_bug="yes",
    ac_cv_c_gcc_strength_bug="yes") )
  if test "$ac_cv_c_gcc_strength_bug" = "yes"
  then
    CFLAGS="$CFLAGS -fno-strength-reduce"
  fi
fi

AC_CACHE_CHECK( "sizes of int and void *", ac_cv_c_size_int_ptr,
	  AC_TRY_RUN([
int main(void) {
  return sizeof(int) == sizeof(void *);
}],
    ac_cv_c_size_int_ptr="no",
    ac_cv_c_size_int_ptr="yes",
    ac_cv_c_size_int_ptr="yes") )
if test "$ac_cv_c_size_int_ptr" = "no"
then
	echo "** The size of an integer is not equal to a pointer."
	echo "   There are currently assumtions in the app that"
	echo "   prevents it from running if these sizes are not"
	echo "   equal."
	echo "   Please configure with a compiler that uses the"
	echo "   same sizes for ints and pointers."
	exit 1
fi

dnl Check getopt.h because Solaris 8 doesn't have one
AC_CHECK_HEADER(getopt.h, [ AC_DEFINE(HAVE_GETOPT_H) ])

dnl Make sure the gd header is here
AC_CHECK_HEADER( gd.h,[ have_gd_h="yes" ],[ have_gd_h="no" ])

if test "$have_gd_h" != "yes"; then
echo
	echo "** The GD library is required for CvsGraph to function."
	echo "   Get it from http://www.boutell.com, compile it and"
	echo "   use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify"
	echo "   its location. You might also have to use --with-z-inc, --with-z-lib"
	echo "   and --with-png-inc, --with-png-lib for gd versions 1.6 and higher."
	echo "   Check config.log for more information on the problem. If your system"
        echo "   has libgd installed, you probably mis the gd.h header file."
	exit 1
fi

dnl Checks for libraries.
AC_CHECK_LIB(m, sqrt, [
	AC_DEFINE(LIBM)
	MATHLIBS="-lm"
	])

AC_CHECK_LIB(z, compress, [
	ac_have_libz="yes"
	ZLIB="-lz"
	] , [
	ac_have_libz="no"
	] , ${LIBPATH} ${MATHLIBS} )

AC_CHECK_LIB(freetype, FT_Load_Glyph, [
	ac_have_libfreetype="yes"
	LIBFT="-lfreetype"
	] , [
	ac_have_libfreetype="no"
	] , ${LIBPATH} ${MATHLIBS} )

AC_CHECK_LIB(ttf, TT_Load_Glyph, [
	ac_have_libttf="yes"
	LIBTT="-lttf"
	] , [
	ac_have_libttf="no"
	] , ${LIBPATH} ${MATHLIBS} )

AC_CHECK_LIB(png, png_create_read_struct , [
	ac_have_libpng="yes"
	LIBPNG="-lpng"
	] , [
	ac_have_libpng="no"
	] , ${LIBPATH} ${ZLIB} ${MATHLIBS} )

AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [
	ac_have_libjpeg="yes"
	LIBJPEG="-ljpeg"
	] , [
	ac_have_libjpeg="no"
	] , ${LIBPATH} ${MATHLIBS} )

dnl Check which libraries we need to add
OLIBS="${LIBS}"
LIBS="${LIBS} ${MATHLIB}"
AC_CACHE_CHECK( "whether libpng needs -lz", ac_cv_png_needs_z,
	  AC_TRY_LINK_FUNC( png_create_read_struct, [
	ac_cv_png_needs_z="no"
	] , [
	ac_cv_png_needs_z="yes"
	] ) )
LIBS="${OLIBS}"


OLIBS="${LIBS}"
LIBS="${LIBS} ${LIBFT} ${LIBTT} ${LIBJPEG} ${MATHLIB}"
AC_CACHE_CHECK( "whether libgd needs -lpng", ac_cv_gd_needs_png,
	  AC_TRY_LINK_FUNC( gdImagePng, [
	ac_cv_gd_needs_png="no"
	] , [
	ac_cv_gd_needs_png="yes"
	] ) )
LIBS="${OLIBS}"

OLIBS="${LIBS}"
LIBS="${LIBS} ${LIBFT} ${LIBTT} ${LIBPNG} ${LIBZ} ${MATHLIB}"
AC_CACHE_CHECK( "whether libgd needs -ljpeg", ac_cv_gd_needs_jpeg,
	  AC_TRY_LINK_FUNC( gdImageJpeg, [
	ac_cv_gd_needs_jpeg="no"
	] , [
	ac_cv_gd_needs_jpeg="yes"
	] ) )
LIBS="${OLIBS}"

OLIBS="${LIBS}"
LIBS="${LIBS} ${LIBFT} ${LIBJPEG} ${LIBPNG} ${LIBZ} ${MATHLIB}"
AC_CACHE_CHECK( "whether libgd needs -lttf", ac_cv_gd_needs_ttf,
	  AC_TRY_LINK_FUNC( gdImageStringTTF, [
	ac_cv_gd_needs_ttf="no"
	] , [
	ac_cv_gd_needs_ttf="yes"
	] ) )
LIBS="${OLIBS}"

OLIBS="${LIBS}"
LIBS="${LIBS} ${LIBTT} ${LIBJPEG} ${LIBPNG} ${LIBZ} ${MATHLIB}"
AC_CACHE_CHECK( "whether libgd needs -lfreetype", ac_cv_gd_needs_freetype,
	  AC_TRY_LINK_FUNC( gdImageStringFT, [
	ac_cv_gd_needs_freetype="no"
	] , [
	ac_cv_gd_needs_freetype="yes"
	] ) )
LIBS="${OLIBS}"

if test "$ac_cv_gd_needs_freetype" = "yes"
then
	if test "$ac_have_libfreetype" != "yes" -a "$ac_have_libttf" != "yes"
	then
		echo "** WARNING: Required library libfreetype not found"
	fi
	LIBS="${LIBS} ${LIBFT}"
fi

if test "$ac_cv_gd_needs_ttf" = "yes"
then
	if test "$ac_have_libttf" != "yes" -a "$ac_have_libfreetype" != "yes"
	then
		echo "** WARNING: Required library libttf not found"
	fi
	LIBS="${LIBS} ${LIBTT}"
fi

if test "$ac_cv_gd_needs_jpeg" = "yes"
then
	if test "$ac_have_libjpeg" != "yes"
	then
		echo "** WARNING: Required library libjpeg not found"
	fi
	LIBS="${LIBS} ${LIBJPEG}"
fi

if test "$ac_cv_gd_needs_png" = "yes"
then
	if test "$ac_have_libpng" != "yes"
	then
		echo "** WARNING: Required library libpng not found"
	fi
	LIBS="${LIBS} ${LIBPNG}"
	if test "$ac_cv_png_needs_z" = "yes"
	then
		if test "$ac_have_libz" != "yes"
		then
			echo "** WARNING: Required library libz not found"
		fi
		LIBS="${LIBS} ${LIBZ}"
	fi
fi

LIBS="${LIBS} ${MATHLIBS}"

dnl which version of gd do we have here?
AC_CHECK_LIB(gd, gdImageGif, [
	AC_DEFINE(HAVE_IMAGE_GIF)
	have_gifs="yes"
	] ,
	have_gifs="no"
	)

if test "${have_gifs}" = "yes"
then
	echo "** You have a very old GD library. Please consider"
	echo "   upgrading to a more recent version (1.8.4 or newer)."
	echo "   --Note that f.x. ViewCVS needs CvsGraph to generate PNG"
	echo "     images and ancient GD libraries might contain many bugs."
	echo "     However, if you need GIFs, then you must stick to this"
	echo "     old version."
fi

AC_CHECK_LIB(gd, gdImagePng, [
	AC_DEFINE(HAVE_IMAGE_PNG)
	])
AC_CHECK_LIB(gd, gdImageJpeg, [
	AC_DEFINE(HAVE_IMAGE_JPEG)
	])
AC_CHECK_LIB(gd, gdImageStringTTF, [
	if test "$ac_have_libttf" = "yes"
	then
		AC_DEFINE(HAVE_GDIMAGESTRINGTTF)
	fi
	])
AC_CHECK_LIB(gd, gdImageStringFT, [
	if test "$ac_have_libfreetype" = "yes"
	then
		AC_DEFINE(HAVE_GDIMAGESTRINGFT)
	fi
	])


AC_SUBST(LEXFLAGS)

AC_OUTPUT(Makefile)

echo "Configure done. Run 'make' to build CvsGraph"