summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 6af1203158396423d84a13885bc98bf3f8704d37 (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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.53)
AC_INIT([Xoo], 0.9, [frederic.plourde@collabora.co.uk])
AC_CONFIG_SRCDIR([src/main.c])

AM_INIT_AUTOMAKE()
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_CONFIG_HEADER(config.h)

AC_ARG_WITH(expat-includes,    
  [  --with-expat-includes=DIR     Use Expat includes in DIR], 
	   expat_includes=$withval, expat_includes=yes)

AC_ARG_WITH(expat-lib,         
  [  --with-expat-lib=DIR          Use Expat library in DIR], 
	   expat_lib=$withval, expat_lib=yes)

# Checks for programs.
AC_GNU_SOURCE
AC_PROG_CC
AC_PATH_XTRA
GLIB_GSETTINGS
PKG_CHECK_MODULES(APP, [gtk+-3.0])

dnl ------ XTest ------------------------------------------------------------

XTEST_LIBS=
AC_CHECK_HEADER(X11/extensions/XTest.h, [
    AC_CHECK_LIB(Xtst, XTestQueryExtension, [
      XTEST_LIBS="-lXtst"],
      AC_MSG_ERROR([*** XTEST extension libs not found and required ***])
      , $X_LIBS)
  ])
AC_SUBST(XTEST_LIBS)


dnl ------ Expat ------------------------------------------------------------


case "$expat_includes" in
 yes|no)
	EXPAT_CFLAGS=""
	;;
 *)
	EXPAT_CFLAGS="-I$expat_includes"
	;;
esac
	
case "$expat_lib" in
 yes)
	EXPAT_LIBS="-lexpat"
	;;
 no)
	;;
 *)
	EXPAT_LIBS="-L$expat_lib -lexpat"
	;;
esac

expatsaved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
expatsaved_LIBS="$LIBS"
LIBS="$LIBS $EXPAT_LIBS"

AC_CHECK_HEADER(expat.h)
case "$ac_cv_header_expat_h" in
  no)
	 AC_CHECK_HEADER(xmlparse.h)

	 case "$ac_cv_header_xmlparse_h" in
	   no)
		have_expat_header=no;
		;;
	   yes)
		HAVE_XMLPARSE_H=1
		AC_SUBST(HAVE_XMLPARSE_H)
		AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
				       [Use xmlparse.h instead of expat.h])
		have_expat_header=yes
	        ;;
	 esac
	 ;;
  yes)
	 have_expat_header=yes
	;;
esac
	
case "$have_expat_header" in
  no)
	expat=no
	;;
  yes)
	AC_CHECK_FUNCS(XML_ParserCreate)

	case "$ac_cv_func_XML_ParserCreate" in
       no)
	  	expat=no
		;;
	  yes)
		HAVE_EXPAT=1
		AC_SUBST(HAVE_EXPAT)
		AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT,
		[Found a useable expat library])
		;;
	esac
	;;
esac
	
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"

if test x$expat = xno; then
      AC_MSG_ERROR([cannot find expat library])
fi

AC_DEFINE(USE_EXPAT, [1], [Use Expat XML Parser])


if test "x$GCC" = "xyes"; then
        GCC_WARNINGS="-Wall -fno-strict-aliasing"
        APP_CFLAGS="$GCC_WARNINGS $APP_CFLAGS"
fi

AC_SUBST(APP_CFLAGS)
AC_SUBST(APP_LIBS)

AC_SUBST(EXPAT_LIBS)
AC_SUBST(EXPAT_CFLAGS)

# Checks for header files.

AC_HEADER_STDC

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T


# Checks for library functions.
 
AC_OUTPUT([Makefile src/Makefile data/Makefile])