Barry version 0.18.1 (debian sid release)
[barry.git] / desktop / configure.ac
blob59c367a17432f449d8bcd25998fb7e4c86fae4bd
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # Parts taken from the pkg.m4 file from pkg-config
5 # Copyright 2004 Scott James Remnant <scott@netsplit.com>
8 AC_PREREQ(2.61)
9 AC_INIT([barrydesktop], [0.18.1], [barry-devel@lists.sourceforge.net])
10 #AM_CONFIG_HEADER(config.h)
11 AC_CONFIG_SRCDIR([src/barrydesktop.cc])
12 AC_CONFIG_HEADERS([config.h:config.h.in])
13 AC_CONFIG_AUX_DIR([.])
14 AC_CONFIG_MACRO_DIR([../m4])
15 AM_INIT_AUTOMAKE
18 # Barry Desktop Version Numbers
20 # Be sure to keep BARRY_DESKTOP_MAJOR == BARRY_MAJOR from ../configure.ac!
21 # (see desktop/src/Makefile.am for the reason)
23 BARRY_DESKTOP_LOGICAL=0
24 BARRY_DESKTOP_MAJOR=18
25 BARRY_DESKTOP_MINOR=1
26 AC_DEFINE_UNQUOTED([BARRY_DESKTOP_LOGICAL], [$BARRY_DESKTOP_LOGICAL], [Logical version number])
27 AC_DEFINE_UNQUOTED([BARRY_DESKTOP_MAJOR], [$BARRY_DESKTOP_MAJOR], [Major library version number])
28 AC_DEFINE_UNQUOTED([BARRY_DESKTOP_MINOR], [$BARRY_DESKTOP_MINOR], [Minor library version number])
29 AC_DEFINE_UNQUOTED([BARRY_DESKTOP_VER_STRING],
30         ["${BARRY_DESKTOP_LOGICAL}.${BARRY_DESKTOP_MAJOR}.${BARRY_DESKTOP_MINOR}"],
31         [Full Barry Desktop version in string form])
32 AC_SUBST([BARRY_DESKTOP_LOGICAL])
33 AC_SUBST([BARRY_DESKTOP_MAJOR])
34 AC_SUBST([BARRY_DESKTOP_MINOR])
37 # Checks for programs.
39 AC_PROG_CC
40 AC_PROG_CXX
41 AC_PROG_MAKE_SET
42 AC_PROG_LIBTOOL
44 AC_LANG([C])
46 PKG_CHECK_MODULES([LIBGCAL], [libgcal >= 0.9.6], [],
47         [
48         LGTEMP_LDFLAGS="$LDFLAGS"
49         LDFLAGS="$LDFLAGS -lgcal"
50         AC_RUN_IFELSE(
51                 [AC_LANG_PROGRAM(
52                         [[
53 #include <stdio.h>
54 #include <string.h>
55 #include <stdlib.h>
57 int get_the_url(char *data, int length, char **url);
59 void xmlCleanupParser(void)
61         // if this gets called, the libgcal we are using is broken
62         exit(1);
64                         ]],
65                         [[
66 const char *xml = "<nothing></nothing>";
67 char *dest;
68 get_the_url(xml, strlen(xml), &dest);
69                         ]]
70                         )
71                 ],
72                 [LG_TRY_AGAIN=yes],
73                 [AC_MSG_ERROR(
75 Your copy of libgcal is older than 0.9.6, and it contains
76 this bug:
78 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597153
80 You will need to upgrade to avoid segfaults when syncing with
81 Google calendar.
83                 )],
84                 [AC_MSG_ERROR(
86 Your copy of libgcal is older than 0.9.6.  Since you are
87 cross-compiling it is not possible to easily check whether
88 the following bug exists in your copy or not:
90 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597153
92 Please upgrade and try again.
94                 )]
95                 )
96         LDFLAGS="$LGTEMP_LDFLAGS"
97         if test "$LG_TRY_AGAIN" = "yes" ; then
98                 AC_MSG_RESULT([found patched libgcal...])
99                 PKG_CHECK_MODULES([LIBGCAL], [libgcal >= 0.9.4])
100         fi
101         ]
102         )
104 AC_LANG([C++])
107 # Search for a GUI-style version of su.  If not specified, we search for
108 # gksu (for Debian), beesu (for Fedora), and kdesu (for openSUSE),
109 # searched in the above order.
111 # User can override with the option.
113 AC_ARG_WITH([guisu],
114         [AS_HELP_STRING([--with-guisu=CMD],
115         [specify GUI oriented su wrapper program @<:@default: searches for gksu, beesu, or kdesu in that order@:>@])],
116         [
117                 GUISU="$with_guisu"
118                 AC_MSG_NOTICE([Using user-specified GUI su wrapper: $GUISU])
119         ],
120         [
121                 if test -x /usr/bin/gksu ; then
122                         GUISU="gksu"
123                         AC_MSG_NOTICE([Found GUI su wrapper: gksu])
124                 elif test -x /usr/bin/beesu ; then
125                         GUISU="beesu"
126                         AC_MSG_NOTICE([Found GUI su wrapper: beesu])
127                 elif test -x /usr/bin/kdesu ; then
128                         GUISU="kdesu"
129                         AC_MSG_NOTICE([Found GUI su wrapper: kdesu])
130                 else
131                         AC_MSG_ERROR([Unable to find a GUI oriented su wrapper.
133         This is required for modem operation, in case permissions are not
134         set on pppd properly.
136         Please specify the GUI su wrapper you wish to use with the
137         --with-guisu configure option.  Note that it MUST be a GUI.
138         You cannot use the command line su.
140         ])
141                 fi
142         ])
144 AC_SUBST([GUISU])
147 # Check for Evolution data server libraries, and allow user to disable
148 # if needed.
150 AC_ARG_WITH([evolution],
151         [AS_HELP_STRING([--with-evolution],
152         [use evolution libs to help configure sync (yes,no,check) @<:@default=check@:>@])],
153         [],
154         [with_evolution=check])
156 if test "x$with_evolution" != xno ; then
157         PKG_CHECK_MODULES([EVOLUTION],
158                 [libebook-1.2 libecal-1.2 libedataserver-1.2],
159                 [
160                         AC_DEFINE([HAVE_EVOLUTION], [1],
161                                 [Define to 1 if Evolution data server libraries are available.])
162                 ],
163                 [
164                         if test "x$with_evolution" != xcheck; then
165                                 AC_MSG_FAILURE([--with-evolution was given, but test for evolution failed])
166                         fi
167                 ])
170 PKG_CHECK_MODULES([BARRY], [libbarry-0 libbarrysync-0 libbarrybackup-0])
171 PKG_CHECK_MODULES([GLIB2], [glib-2.0])
172 PKG_CHECK_MODULES([LIBXMLPP], [libxml++-2.6])
173 PKG_CHECK_MODULES([OPENSYNC22], [opensync-1.0], [], [OS22NOTFOUND=yes])
174 PKG_CHECK_MODULES([OPENSYNC40], [libopensync1], [], [OS40NOTFOUND=yes])
176 if test "$OS22NOTFOUND" = "yes" -a "$OS40NOTFOUND" = "yes" ; then
177         AC_MSG_WARN(dnl
180 *************************************************************************
181 WARNING:
182 Unable to find development libraries for either opensync 0.22 or 0.4x.
183 Barry Desktop will be built without any sync support.
184 *************************************************************************
186 If this is not desired, consider adjusting the PKG_CONFIG_PATH environment
187 variable if you installed software in a non-standard prefix.
189 Alternatively, you may set the environment variables:
191         OPENSYNC22_CFLAGS and OPENSYNC22_LIBS
193         OPENSYNC40_CFLAGS and OPENSYNC40_LIBS
195 to avoid the need to call pkg-config.
197 See the pkg-config man page for more details.
201 AM_CONDITIONAL([WITH_OPENSYNC22], [test "$OS22NOTFOUND" != "yes"])
202 AM_CONDITIONAL([WITH_OPENSYNC40], [test "$OS40NOTFOUND" != "yes"])
204 # Carry the special tree build environment variables from parent configure,
205 # just in case user is doing a complete tree build with --enable-desktop
206 AC_SUBST(TREE_BUILD_CXXFLAGS)
207 AC_SUBST(TREE_BUILD_LDFLAGS)
209 # Check for wxWidgets libraries
210 AM_OPTIONS_WXCONFIG
211 AM_PATH_WXCONFIG([2.8.0], [], [
212         AC_MSG_ERROR([
213         wxWidgets is required to build the Barry desktop,
214         but the wx-config script could not be found.
216         Please check that wx-config is in your path, that the directory
217         where wxWidgets libraries are installed (returned by the
218         'wx-config --libs' command) is in LD_LIBRARY_PATH, and that
219         wxWidgets is version 2.3.4 or above.
220         ])
221         ])
223 # Setup system directories, so src/Makefile.am can use them for the compile
224 # and for the image/data file installations. (image_DATA)
225 basedatadir="$datadir/barry/desktop/"
226 imagedir="$datadir/barry/desktop/images/"
227 xmlmap22dir="$datadir/barry/desktop/0.22/"
228 xmlmap40dir="$datadir/barry/desktop/0.40/"
229 AC_SUBST(basedatadir)
230 AC_SUBST(imagedir)
231 AC_SUBST(xmlmap22dir)
232 AC_SUBST(xmlmap40dir)
234 # Checks for libraries.
235 AC_CHECK_LIB([pthread], [main])
237 # Checks for header files.
238 AC_HEADER_DIRENT
239 AC_HEADER_STDC
240 AC_CHECK_HEADERS([assert.h stdint.h time.h])
242 # Checks for typedefs, structures, and compiler characteristics.
243 #AC_TYPE_SIZE_T
244 AC_HEADER_TIME
245 AC_STRUCT_TM
247 # Checks for library functions.
248 AC_FUNC_CLOSEDIR_VOID
249 AC_PROG_GCC_TRADITIONAL
250 AC_FUNC_MALLOC
251 AC_FUNC_MKTIME
252 AC_FUNC_REALLOC
253 AC_FUNC_SELECT_ARGTYPES
254 AC_FUNC_STAT
255 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
257 AC_CONFIG_FILES([Makefile
258                  images/Makefile
259                  src/Makefile
260                  src/0.22/Makefile
261                  src/0.40/Makefile
262                  man/Makefile])
263 AC_OUTPUT
267 # Add a special hack at the end, to let the user disable RPATH if he wants.
269 # http://wiki.debian.org/RpathIssue
270 # http://lists.debian.org/debian-devel/2003/debian-devel-200306/msg00569.html
271 # http://fedoraproject.org/wiki/Packaging:Guidelines#Removing_Rpath
273 AC_ARG_ENABLE([rpathhack],
274         [AC_HELP_STRING([--enable-rpathhack], [patch libtool to remove RPATH])],
275         [
276 AC_MSG_RESULT([patching libtool to fix HIDEOUS BREAKAGE])
277 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
278 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
279         ],
280         [])