summaryrefslogtreecommitdiff
path: root/configure.in
blob: 1d42557f97e32d8ec54e32e64ac98b6a12e7d5ed (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
AC_INIT([libmateweather], [1.2.1], [http://www.mate-desktop.org])
AC_PREREQ(2.59)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_MACRO_DIR([m4])

# Before making a release, the LT_VERSION string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
#   been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
#   change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A

LT_VERSION=7:9:6
AC_SUBST(LT_VERSION)

AC_CANONICAL_HOST
AC_MSG_CHECKING([for Win32])
case "$host" in
  *-*-mingw*)
    mateweather_native_win32="yes"
    ;;
  *)
    mateweather_native_win32="no"
    ;;
esac
AC_MSG_RESULT([$mateweather_native_win32])
AM_CONDITIONAL(OS_WIN32, [test "$mateweather_native_win32" = "yes"])

GTK_REQUIRED=2.11.0
GLIB_REQUIRED=2.13.0
LIBSOUP_REQUIRED=2.4.0
LIBSOUP_GNOME_REQUIRED=1.1.0
MATECONF_REQUIRED=1.1.0
LIBXML_REQUIRED=2.6.0

AM_MAINTAINER_MODE
MATE_MAINTAINER_MODE_DEFINES

IT_PROG_INTLTOOL([0.40.3])
PKG_PROG_PKG_CONFIG([0.19])

AC_PROG_CC
AM_PROG_CC_C_O
AC_ISC_POSIX
AC_STDC_HEADERS
AM_PROG_LIBTOOL
AC_PATH_PROG(MATECONFTOOL, mateconftool-2)

AC_ARG_ENABLE(all-translations-in-one-xml,
        [AC_HELP_STRING([--enable-all-translations-in-one-xml],
                        [Put all translations in a big Locations.xml file (slow to parse)])],
        [enable_big_xml=yes],
        [enable_big_xml=no])
AM_CONDITIONAL(USE_ONE_BIG_XML, test "x$enable_big_xml" = "xyes")

AC_ARG_ENABLE(locations-compression,
        [AC_HELP_STRING([--enable-locations-compression],
                        [Compress Locations.xml files])],
        [enable_locations_compression=yes],
        [enable_locations_compression=no])
if test "x$enable_locations_compression" = "xyes"; then
    COMPRESS_EXT=.gz
else
    COMPRESS_EXT=
fi
AC_SUBST(COMPRESS_EXT)

MATE_COMPILE_WARNINGS

dnl ***************************************************************************
dnl *** --enable-more-warnings turns on more compiler warnings              ***
dnl ***************************************************************************
AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
set_more_warnings="$enableval",[
    set_more_warnings=no
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
    AC_MSG_RESULT(yes)
    CFLAGS="\
    -Wall \
    -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
    -Wnested-externs -Wpointer-arith \
    -Wcast-align -Wsign-compare \
    -std=gnu89 \
    $CFLAGS"

    for option in -Wno-strict-aliasing -Wno-sign-compare; do
        SAVE_CFLAGS="$CFLAGS"
        CFLAGS="$CFLAGS $option"
        AC_MSG_CHECKING([whether gcc understands $option])
        AC_TRY_COMPILE([], [],
            has_option=yes,
            has_option=no,)
        if test $has_option = no; then
            CFLAGS="$SAVE_CFLAGS"
        fi
        AC_MSG_RESULT($has_option)
        unset has_option
        unset SAVE_CFLAGS
    done
    unset option
else
    AC_MSG_RESULT(no)
fi

if test "x$enable_maintainer_mode" = "xyes"; then
	CFLAGS="$CFLAGS $DISABLE_DEPRECATED"
fi

dnl -- Check for GTK+ 2.0 (required) ------------------------------------------
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
GTK_CFLAGS="$GTK_CFLAGS -DGTK_DISABLE_SINGLE_INCLUDES"
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

dnl -- Check for libxml (required) ------------------------------------------
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED)
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)

dnl -- check for libsoup (required) -----------------------------------------
PKG_CHECK_MODULES(LIBSOUP_GNOME,
		  [libsoup-gnome-2.4 >= $LIBSOUP_GNOME_REQUIRED],
		  [LIBSOUP_CFLAGS="$LIBSOUP_GNOME_CFLAGS"
		   LIBSOUP_LIBS="$LIBSOUP_GNOME_LIBS"
		   AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [Have libsoup-gnome])],
		  [PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= $LIBSOUP_REQUIRED])])
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)

dnl -- check for mateconf (required) -----------------------------------------
PKG_CHECK_MODULES(MATECONF,
		  [mateconf-2.0])
AC_SUBST(MATECONF_CFLAGS)
AC_SUBST(MATECONF_LIBS)

AM_MATECONF_SOURCE_2

dnl -- check for glib; redundant at this point, but sets $GLIB_MKENUMS
AM_PATH_GLIB_2_0($GLIB_REQUIRED)
CFLAGS="$CFLAGS -DG_DISABLE_SINGLE_INCLUDES"

dnl gettext

GETTEXT_PACKAGE=libmateweather
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext Package])
AM_GLIB_GNU_GETTEXT


dnl ***************************************************************************
dnl ***  REGEX                                                              ***
dnl ***************************************************************************
AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
               [REGEX_LIBS=-lregex],
               [AC_MSG_ERROR([No regex library found])])])
AC_SUBST(REGEX_LIBS)


dnl ***************************************************************************
dnl *** Check for presence of tm.tm_gmtoff on the system                    ***
dnl ***************************************************************************
AC_CHECK_MEMBER([struct tm.tm_gmtoff],[struct_tm_tm_gmtoff=true],[struct_tm_tm_gmtoff=false],[#include <time.h>])
case $struct_tm_tm_gmtoff in
        true)
                AC_DEFINE_UNQUOTED(HAVE_TM_TM_GMOFF, 1, Have the tm.tm_gmtoff member.)
                ;;
        *)
                AC_CHECK_DECL(timezone,AC_DEFINE(HAVE_TIMEZONE,1,Have timezone),,
[
#include <time.h>
])
                ;;
esac

dnl ***************************************************************************
dnl *** _NL_MEASUREMENT_MEASUREMENT is an enum and not a define             ***
dnl ***************************************************************************
AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
AC_TRY_LINK([#include <langinfo.h>], [
char c;
c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
], gtk_ok=yes, gtk_ok=no)
AC_MSG_RESULT($gtk_ok)
if test "$gtk_ok" = "yes"; then
  AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT], [1],
            [Define if _NL_MEASUREMENT_MEASUREMENT is available])
fi

dnl ***************************************************************************
dnl *** Find tzdata                                                         ***
dnl ***************************************************************************
AC_ARG_WITH(zoneinfo-dir,
	    [  --with-zoneinfo-dir     tzdata zoneinfo directory],
	    ZONEINFO_DIR="$withval")
if test -z "$ZONEINFO_DIR"; then
    if test -d /usr/share/zoneinfo; then
	ZONEINFO_DIR="/usr/share/zoneinfo"
    elif test -d /usr/share/lib/zoneinfo/tab; then
	ZONEINFO_DIR="/usr/share/lib/zoneinfo/tab"
    else
	AC_MSG_ERROR(Can't find zoneinfo directory. Use --with-zoneinfo-dir)
    fi
fi
AC_DEFINE_UNQUOTED(ZONEINFO_DIR, "$ZONEINFO_DIR", [zoneinfo directory])

dnl ***************************************************************************
dnl *** Python bindings
dnl ***************************************************************************
AC_ARG_ENABLE(python,
        [AC_HELP_STRING([--enable-python],
                        [Build libmateweather python bindings])],
        [enable_python=yes],
        [enable_python=no])
if test "$enable_python" = "yes"; then
   AM_PATH_PYTHON()
   AM_CHECK_PYTHON_HEADERS(,enable_python=no)
   PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0)
   pygtk_defsdir=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
   PYGTK_DEFS="$pygtk_defsdir/gtk.defs"
   AC_SUBST(PYGTK_DEFS)
fi
AM_CONDITIONAL(BUILD_PYTHON, test "x$enable_python" = "xyes")

dnl ***************************************************************************
dnl *** Honour aclocal flags                                                ***
dnl ***************************************************************************
ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
AC_SUBST(ACLOCAL_AMFLAGS)

AC_SUBST(VERSION)
AC_SUBST(PACKAGE)
AC_SUBST(DATADIR)
AC_SUBST(LIBDIR)
AC_SUBST(PYTHONDIR)
AC_SUBST(GLADEDIR)

##################################################
# Checks for gtk-doc and docbook-tools
##################################################
GTK_DOC_CHECK([1.9])

dnl ***************************************************************************
dnl *** Output Makefiles et al                                              ***
dnl ***************************************************************************
AC_OUTPUT([
Makefile
doc/Makefile
po/Makefile.in
po-locations/Makefile
libmateweather/Makefile
libmateweather/mateweather.pc
libmateweather/mateweather-uninstalled.pc
data/Makefile
python/Makefile
icons/Makefile
])

if test "x$enable_big_xml" = "xyes"; then
	LOCATIONS_XML_TRANSLATIONS="one big file"
else
	LOCATIONS_XML_TRANSLATIONS="one file per translation"
fi

dnl ***************************************************************************
dnl *** Display Summary                                                     ***
dnl ***************************************************************************
echo "
libmateweather-$VERSION configure summary:

	Prefix:				${prefix}
	Source code location:		${srcdir}
	Compiler:			${CC}
	Python bindings:		${enable_python}
	Locations.xml translations:	${LOCATIONS_XML_TRANSLATIONS}
	Locations.xml compression:	${enable_locations_compression}
" >&2