summaryrefslogtreecommitdiff
path: root/configure.in
blob: 2e4e585be6eb692acfd3da23d8a6cf158d5bbf09 (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
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.5)
AC_INIT(src/parser/cr-input.c)

PACKAGE=libcroco
LIBCROCO_MAJOR_VERSION=0
LIBCROCO_MINOR_VERSION=3
LIBCROCO_MICRO_VERSION=0

LIBCROCO_VERSION=$LIBCROCO_MAJOR_VERSION.$LIBCROCO_MINOR_VERSION.$LIBCROCO_MICRO_VERSION
LIBCROCO_VERSION_INFO=`expr $LIBCROCO_MAJOR_VERSION + $LIBCROCO_MINOR_VERSION`:$LIBCROCO_MICRO_VERSION:$LIBCROCO_MINOR_VERSION
LIBCROCO_VERSION_NUMBER=`expr $LIBCROCO_MAJOR_VERSION \* 10000 + $LIBCROCO_MINOR_VERSION \* 100 + $LIBCROCO_MICRO_VERSION`
VERSION=$LIBCROCO_VERSION

AC_SUBST(LIBCROCO_MAJOR_VERSION)
AC_SUBST(LIBCROCO_MINOR_VERSION)
AC_SUBST(LIBCROCO_MICRO_VERSION)
AC_SUBST(LIBCROCO_VERSION)
AC_SUBST(LIBCROCO_VERSION_INFO)
AC_SUBST(LIBCROCO_VERSION_NUMBER)
AC_SUBST(VERSION)

AM_INIT_AUTOMAKE($PACKAGE, $LIBCROCO_VERSION)
AM_CONFIG_HEADER(config.h)

AM_MAINTAINER_MODE

dnl
dnl First, here goes the list
dnl of the version of the libraries we depend
dnl on.
dnl

GLIB2_VERSION=2.0
LIBXML2_VERSION=2.4.23
LIBGNOMEUI_VERSION=2.0.3
PANGO_VERSION=1.0.4

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_CPP

dnl Make sure we have an ANSI compiler
AM_C_PROTOTYPES
test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)

dnl Checks for libraries.
dnl Checks for header files.
AC_STDC_HEADERS
AC_ISC_POSIX

AM_PROG_LIBTOOL

dnl **************************************************************
dnl check for the different --enable-option=val  
dnl messages issued by the user
dnl ***************************************************************
G_DISABLE_CHECKS=0
AC_ARG_ENABLE(checks,
		AC_HELP_STRING([--enable-checks=yes|no],
	 	[enables runtime safety checks. Default=yes]),
		WITH_CHECKS=$enableval,
		WITH_CHECKS="yes")

if test "$WITH_CHECKS" = "no" ; then
	G_DISABLE_CHECKS=1
fi
AC_SUBST(G_DISABLE_CHECKS)

dnl ************************************************
dnl end of check of the different --enable-feature options
dnl *************************************************

dnl
dnl check glib-2.0 version
dnl
have_glib2=no
PKG_CHECK_MODULES(GLIB2, 
		  [glib-2.0 >= $GLIB2_VERSION],
		  [have_glib2=yes
	 	  CROCO_HAVE_GLIB2=1],
		  have_glib2=no)
if test "$have_glib2" = no ; then
	AC_MSG_ERROR([*** glib2 not found. See http://www.gtk.org])
fi

AC_SUBST(GLIB2_VERSION)
AC_SUBST(CROCO_HAVE_GLIB2)

dnl check libxml2 version

have_libxml2=no
CROCO_HAVE_LIBXML2=0
PKG_CHECK_MODULES(LIBXML2, [libxml-2.0 >= $LIBXML2_VERSION],
			   [have_libxml2=yes
			   CROCO_HAVE_LIBXML2=1],
			   have_libxml2=no)
AC_SUBST(LIBXML2_VERSION)
AC_SUBST(CROCO_HAVE_LIBXML2)

CROCO_PARSER_LIB=libcroco.la
AC_SUBST(CROCO_PARSER_LIB)

dnl
dnl check glib-2.0 version
dnl
have_pango=no
PKG_CHECK_MODULES(PANGO, 
		  [pango >= $PANGO_VERSION],
		  [have_pango=yes
	 	  CROCO_HAVE_PANGO=1],
		  have_pango=no)
if test "$have_pango" = no ; then
	AC_MSG_ERROR([*** pango not found. See http://www.pango.org])
fi

AC_SUBST(PANGO_VERSION)
AC_SUBST(CROCO_HAVE_PANGO)

dnl --enable-tests
dnl this option enables compilation of the unit tests built in to .c files
dnl and also some stuff in the test/ subdir
CROCO_TESTS_ENABLED=0
AC_ARG_ENABLE(tests, 
	       AC_HELP_STRING([--enable-tests=yes|no], 
	                      [Enables unit test code, Default=no]),
	       WITH_TESTS=$enableval,
	       WITH_TESTS=no)

if test "$WITH_TESTS" = "yes" ; then
	CROCO_TESTS_ENABLED=1
else
	WITH_TESTS="no"
fi

AC_SUBST(WITH_TESTS)
AC_SUBST(CROCO_TESTS_ENABLED)
AM_CONDITIONAL(HAVE_TESTS, test "$WITH_TESTS" = "yes")

dnl --enable-seleng
dnl this option enables compilation of the selection engine
CROCO_SELENG_ENABLED=0
AC_ARG_ENABLE(seleng, 
	       AC_HELP_STRING([--enable-seleng=yes|no|auto], 
	                      [Enables the css2 selector engine based on libxml2. Default=auto]),
	       WITH_SELENG=$enableval,
	       WITH_SELENG="no")

if test "$WITH_SELENG" = "auto" ; then
	if test "x$have_libxml2" != "xno" -a "x$have_pango" != "xno" ; then
		CROCO_SELENG_ENABLED=1			
		WITH_SELENG="yes"
	else
		WITH_SELENG="no"
   	fi

	if test "x$WITH_SELENG" = "yes" ; then
		if test "x$have_libxml2" != "yes" ; then
			AC_MSG_ERROR([*** libxml2 is not present, so you cannot have seleng enabled. Go to http://xmlsoft.org to get libxml2 version $LIBXML2_VERSION ***])
		fi

		if test "x$have_pango" != "yes" ; then
			AC_MSG_ERROR([*** pango is not present, so you cannot have seleng enabled. Go to http://www.pango.org to get pango version $PANGO_VERSION ***])
		fi
	fi

elif test "$WITH_SELENG" = "yes" ; then
	CROCO_SELENG_ENABLED=1
else
  	WITH_SELENG="no"
fi
if test "$WITH_SELENG" = "yes" ; then
	CROCO_SELENG_LIB_NAME=crseleng
	CROCO_SELENG_LIB="lib${CROCO_SELENG_LIB_NAME}.la"
fi

AC_SUBST(CROCO_SELENG_ENABLED)
AC_SUBST(WITH_SELENG)
AC_SUBST(CROCO_SELENG_LIB)
AM_CONDITIONAL(HAVE_SELENG, test "$WITH_SELENG" = "yes")

dnl --enable-layeng
dnl this option enable the layout engine/box model/style stuffs.
CROCO_LAYENG_ENABLED=0
AC_ARG_ENABLE(layeng,
	AC_HELP_STRING([--enable-layeng=yes|no|auto],
	[Enables the layout engine. Default=auto]),
	WITH_LAYENG=$enableval,
	WITH_LAYENG="no")

if test "$WITH_LAYENG" = "auto" ; then
	if test "$WITH_SELENG" = "yes" ; then
		CROCO_LAYENG_ENABLED=1
		WITH_LAYENG="yes"
	else
		WITH_LAYENG="no"
	fi

elif test "$WITH_LAYENG" = "yes" ; then
	CROCO_LAYENG_ENABLED=1
else
	WITH_LAYENG="no"
fi

if test "$WITH_LAYENG" = "yes" ; then
	CROCO_LAYENG_LIB_NAME=crlayeng
	CROCO_LAYENG_LIB="lib${CROCO_LAYENG_LIB_NAME}.la"
fi

AC_SUBST(WITH_LAYENG)
AC_SUBST(CROCO_LAYENG_ENABLED)
AC_SUBST(CROCO_LAYENG_LIB)
AM_CONDITIONAL(HAVE_LAYENG, test "$WITH_LAYENG" = "yes")

dnl choose which tests to launch and in which condition
dnl okay, this should not go here but it seems like 
dnl AM_CONDITIONAL() and it peer if/endif construction
dnl is bugged and does not properly support a serie 
dnl of several non nested if/endif. So, I will handle this
dnl this way until I find a better way.
CORE_TESTS=
SELENG_TESTS=
LAYENG_TESTS=

if test "$WITH_TESTS" = "yes" ; then
	CORE_TESTS="test0 test1 test2 test3 test4 test6"
	if test "$WITH_SELENG" = yes ; then
		SELENG_TESTS="test5"
	fi
	if test "$WITH_LAYENG" = "yes" ; then
		LAYENG_TESTS="test7" ;
	fi
fi

AC_SUBST(CORE_TESTS)
AC_SUBST(SELENG_TESTS)
AC_SUBST(LAYENG_TESTS)

CROCO_HAVE_LIBGNOMEUI2=0
if test "$WITH_LAYENG" = "yes" ; then
	PKG_CHECK_MODULES(LIBGNOMEUI2,
			 [libgnomeui-2.0 >= $LIBGNOMEUI_VERSION],
			 [have_libgnomeui2=yes CROCO_HAVE_LIBGNOMEUI2=1],
			 have_libgnomeui2=no)
	if test "$have_libgnomeui2" = "no" ; then
		AC_MSG_ERROR([*** libgnomeui2 not found. See http://www.gnome.org])
	fi	
fi
AC_SUBST(CROCO_HAVE_LIBGNOMEUI2)
dnl **********************************
dnl *By default compile in debug mode
dnl **********************************

if test "x$GCC" = "xyes" ; then
	CFLAGS="$CFLAGS -Wall"
fi


dnl************************
dnl*Dodji's environment.
dnl************************

if test "x$LOGNAME" = "xdodji" -a "x$GCC" = "xyes" ; then
	CFLAGS="-g -Wunused -Wimplicit -Wreturn-type -Wswitch \
	-Wcomment -Wtrigraphs -Wformat -Wchar-subscripts \ 
        -Wparentheses -Wpointer-arith -Wcast-align \
        -Wwrite-strings -Waggregate-return -Wstrict-prototypes \
        -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
	
fi

#-pedantic  -0 -Wshadow -Wuninitialized

dnl
dnl Define the CROCO_LIBS and CROCO_CFLAGS variables. These will be used
dnl by client application to know where to find croco include files and libs.
dnl
CROCO_LIBS=" $GLIB2_LIBS $LIBXML2_LIBS -L${libdir} -lcroco"

CROCO_CFLAGS="-I${includedir}/libcroco -I${includedir}/libcroco/parser \
-I${includedir}/libcroco/seleng -I${includedir}/libcroco/layeng \
$GLIB2_CFLAGS $LIBXML2_CFLAGS"

if test "$USE_LIBXML2" = "yes" ; then
	LIBXML2_LIBS=`pkg-config --libs libxml-2.0`
	CROCO_LIBS="$CROCO_LIBS $LIBXML2_LIBS"
	LIBXML2_CFLAGS=`pkg-config --cflags libxml-2.0`
	CROCO_CFLAGS="$CROCO_CFLAGS $LIBXML2_CFLAGS"
	REQUIRE_LIBXML2=libxml-2.0
else
	REQUIRE_LIBXML2=
fi

if test "$WITH_SELENG" = "yes" ; then
	CROCO_LIBS="$CROCO_LIBS -l$CROCO_SELENG_LIB_NAME"
fi

if test "$WITH_LAYENG" = "yes" ; then
	CROCO_LIBS="$CROCO_LIBS $LIBGNOMEUI2_LIBS -l$CROCO_LAYENG_LIB_NAME"
	CROCO_CFLAGS="$CROCO_CFLAGS $LIBGNOMEUI2_CFLAGS"
fi

AC_SUBST(LIBXML2_LIBS)
AC_SUBST(LIBXML2_CFLAGS)
AC_SUBST(REQUIRE_LIBXML2)
AC_SUBST(CROCO_CFLAGS)
AC_SUBST(CROCO_LIBS)

AC_SUBST(LDFLAGS)
AC_SUBST(CFLAGS)

AC_PROG_MAKE_SET
AC_OUTPUT([
Makefile
libcroco.pc
libcroco.spec
croco-config
src/Makefile
src/parser/Makefile
src/parser/libcroco-config.h
src/seleng/Makefile
src/layeng/Makefile
csslint/Makefile
tests/Makefile
])

dnl =============================================================================================
echo "
	=====================================================================
	      LIBCROCO, GNOME CSS2 PARSING AND MANIPULATION TOOLKIT $VERSION
	=====================================================================

	prefix:				      :	${prefix}
	source code location:		      :	${srcdir}
	compiler: 			      :	${CC}
	cflags:				      :	${CFLAGS}

	Maintainer mode:		      :	${USE_MAINTAINER_MODE}
	Building unit tests:		      :	${WITH_TESTS}
	Building with selection engine:	      :	${WITH_SELENG}
	Building with layout engine:	      : ${WITH_LAYENG}

"