summaryrefslogtreecommitdiff
path: root/configure.in
blob: 463203265482b0783bb56114ac22ef16d90ddcbc (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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.5)
AC_INIT(src/cr-input.c)

PACKAGE=libcroco
LIBCROCO_MAJOR_VERSION=0
LIBCROCO_MINOR_VERSION=1
LIBCROCO_MICRO_VERSION=0

LIBCROCO_VERSION=$LIBCROCO_MAJOR_VERSION.$LIBCROCO_MINOR_VERSION.$LIBCROCO_MICRO_VERSION
LIBCROCO_VERSION_INFO=$LIBCROCO_MAJOR_VERSION:$LIBCROCO_MINOR_VERSION:$LIBCROCO_MICRO_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(libcroco-config.h)

AM_MAINTAINER_MODE

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 ***************************************************************

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
	AC_DEFINE(G_DISABLE_CHECKS, 1, [disable runtime asserts])
fi

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

dnl
dnl Find pkg-config
dnl

AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test x$PKG_CONFIG = xno ; then
  AC_MSG_ERROR([*** pkg-config not found. See http://www.freedesktop.org/software/pkgconfig/])
fi

dnl check libxml2 version
have_libxml2=no
PKG_CHECK_MODULES(LIBXML2, [libxml-2.0 >= 2.5.1], 
			   [have_libxml2=yes
			   AC_DEFINE(HAVE_LIBXML2, 1, [use libxml2])], have_libxml2=no)

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

if test "$WITH_TESTS" != no ; then
   if test "$have_libxml2" != no; then
	AC_DEFINE(WITH_TESTS, 1, [enable the unit tests])
   else
	WITH_TESTS=no
   fi
fi

AC_SUBST(WITH_TESTS)
AM_CONDITIONAL(HAVE_TESTS, test $WITH_TESTS != no)
			    
dnl --enable-seleng
dnl this option enables compilation of the selection engine
WITH_SELENG=no
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="auto")

if test "$WITH_SELENG" != no ; then
   if test "$have_libxml2" != no; then
	AC_DEFINE(WITH_SELENG, 1, [use css2 selection engine])
   else
	WITH_SELENG=no
   fi
fi

AC_SUBST(WITH_SELENG)
AM_CONDITIONAL(HAVE_SELENG, test $WITH_SELENG != no)

dnl By default compile in debug mode
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 "
#-pedantic -Wshadow -0 -Wuninitialized

CROCO_LIBS="-L${libdir} -lcroco `pkg-config --libs glib-2.0`"
CROCO_CFLAGS="-I${includedir}/libcroco `pkg-config --cflags glib-2.0`"

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

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
croco-config
src/Makefile
csslint/Makefile
tests/Makefile
])

dnl =============================================================================================
echo "
	=========================================================
	      LIBCROCO, GNOME CSS2 PARSING 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}
	

"