desktop: Modem: cleaned up pppd permissions checks, and GUI su wrapper
[barry/progweb.git] / desktop / configure.ac
blobbaa991201b7690ed5384e89b5601e3dd9b9627b5
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], [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
17 # Checks for programs.
18 AC_PROG_CC
19 AC_PROG_CXX
20 AC_PROG_MAKE_SET
21 AC_PROG_LIBTOOL
23 AC_LANG([C])
25 PKG_CHECK_MODULES([LIBGCAL], [libgcal >= 0.9.6], [],
26         [
27         LGTEMP_LDFLAGS="$LDFLAGS"
28         LDFLAGS="$LDFLAGS -lgcal"
29         AC_RUN_IFELSE(
30                 [AC_LANG_PROGRAM(
31                         [[
32 #include <stdio.h>
33 #include <string.h>
34 #include <stdlib.h>
36 int get_the_url(char *data, int length, char **url);
38 void xmlCleanupParser(void)
40         // if this gets called, the libgcal we are using is broken
41         exit(1);
43                         ]],
44                         [[
45 const char *xml = "<nothing></nothing>";
46 char *dest;
47 get_the_url(xml, strlen(xml), &dest);
48                         ]]
49                         )
50                 ],
51                 [LG_TRY_AGAIN=yes],
52                 [AC_MSG_ERROR(
54 Your copy of libgcal is older than 0.9.6, and it contains
55 this bug:
57 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597153
59 You will need to upgrade to avoid segfaults when syncing with
60 Google calendar.
62                 )],
63                 [AC_MSG_ERROR(
65 Your copy of libgcal is older than 0.9.6.  Since you are
66 cross-compiling it is not possible to easily check whether
67 the following bug exists in your copy or not:
69 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597153
71 Please upgrade and try again.
73                 )]
74                 )
75         LDFLAGS="$LGTEMP_LDFLAGS"
76         if test "$LG_TRY_AGAIN" = "yes" ; then
77                 AC_MSG_RESULT([found patched libgcal...])
78                 PKG_CHECK_MODULES([LIBGCAL], [libgcal >= 0.9.4])
79         fi
80         ]
81         )
83 AC_LANG([C++])
86 # Search for a GUI-style version of su.  If not specified, we search for
87 # gksu (for Debian), beesu (for Fedora), and kdesu (for openSUSE),
88 # searched in the above order.
90 # User can override with the option.
92 AC_ARG_WITH([guisu],
93         [AS_HELP_STRING([--with-guisu=CMD],
94         [specify GUI oriented su wrapper program @<:@default: searches for gksu, beesu, or kdesu in that order@:>@])],
95         [
96                 GUISU="$with_guisu"
97                 AC_MSG_NOTICE([Using user-specified GUI su wrapper: $GUISU])
98         ],
99         [
100                 if test -x /usr/bin/gksu ; then
101                         GUISU="gksu"
102                         AC_MSG_NOTICE([Found GUI su wrapper: gksu])
103                 elif test -x /usr/bin/beesu ; then
104                         GUISU="beesu"
105                         AC_MSG_NOTICE([Found GUI su wrapper: beesu])
106                 elif test -x /usr/bin/kdesu ; then
107                         GUISU="kdesu"
108                         AC_MSG_NOTICE([Found GUI su wrapper: kdesu])
109                 else
110                         AC_MSG_ERROR([Unable to find a GUI oriented su wrapper.
112         This is required for modem operation, in case permissions are not
113         set on pppd properly.
115         Please specify the GUI su wrapper you wish to use with the
116         --with-guisu configure option.  Note that it MUST be a GUI.
117         You cannot use the command line su.
119         ])
120                 fi
121         ])
123 AC_SUBST([GUISU])
126 # Check for Evolution data server libraries, and allow user to disable
127 # if needed.
129 AC_ARG_WITH([evolution],
130         [AS_HELP_STRING([--with-evolution],
131         [use evolution libs to help configure sync (yes,no,check) @<:@default=check@:>@])],
132         [],
133         [with_evolution=check])
135 if test "x$with_evolution" != xno ; then
136         PKG_CHECK_MODULES([EVOLUTION],
137                 [libebook-1.2 libecal-1.2 libedataserver-1.2],
138                 [
139                         AC_DEFINE([HAVE_EVOLUTION], [1],
140                                 [Define to 1 if Evolution data server libraries are available.])
141                 ],
142                 [
143                         if test "x$with_evolution" != xcheck; then
144                                 AC_MSG_FAILURE([--with-evolution was given, but test for evolution failed])
145                         fi
146                 ])
149 PKG_CHECK_MODULES([BARRY], [libbarry-0 libbarrysync-0 libbarrybackup-0])
150 PKG_CHECK_MODULES([GLIB2], [glib-2.0])
151 PKG_CHECK_MODULES([LIBXMLPP], [libxml++-2.6])
152 PKG_CHECK_MODULES([OPENSYNC22], [opensync-1.0], [], [OS22NOTFOUND=yes])
153 PKG_CHECK_MODULES([OPENSYNC40], [libopensync1], [], [OS40NOTFOUND=yes])
155 if test "$OS22NOTFOUND" = "yes" -a "$OS40NOTFOUND" = "yes" ; then
156         AC_MSG_WARN(dnl
159 *************************************************************************
160 WARNING:
161 Unable to find development libraries for either opensync 0.22 or 0.4x.
162 Barry Desktop will be built without any sync support.
163 *************************************************************************
165 If this is not desired, consider adjusting the PKG_CONFIG_PATH environment
166 variable if you installed software in a non-standard prefix.
168 Alternatively, you may set the environment variables:
170         OPENSYNC22_CFLAGS and OPENSYNC22_LIBS
172         OPENSYNC40_CFLAGS and OPENSYNC40_LIBS
174 to avoid the need to call pkg-config.
176 See the pkg-config man page for more details.
180 AM_CONDITIONAL([WITH_OPENSYNC22], [test "$OS22NOTFOUND" != "yes"])
181 AM_CONDITIONAL([WITH_OPENSYNC40], [test "$OS40NOTFOUND" != "yes"])
183 # Carry the special tree build environment variables from parent configure,
184 # just in case user is doing a complete tree build with --enable-desktop
185 AC_SUBST(TREE_BUILD_CXXFLAGS)
186 AC_SUBST(TREE_BUILD_LDFLAGS)
188 # Check for wxWidgets libraries
189 AM_OPTIONS_WXCONFIG
190 AM_PATH_WXCONFIG([2.8.0], [], [
191         AC_MSG_ERROR([
192         wxWidgets is required to build the Barry desktop,
193         but the wx-config script could not be found.
195         Please check that wx-config is in your path, that the directory
196         where wxWidgets libraries are installed (returned by the
197         'wx-config --libs' command) is in LD_LIBRARY_PATH, and that
198         wxWidgets is version 2.3.4 or above.
199         ])
200         ])
202 # Setup system directories, so src/Makefile.am can use them for the compile
203 # and for the image/data file installations. (image_DATA)
204 basedatadir="$datadir/barry/desktop/"
205 imagedir="$datadir/barry/desktop/images/"
206 xmlmap22dir="$datadir/barry/desktop/0.22/"
207 xmlmap40dir="$datadir/barry/desktop/0.40/"
208 AC_SUBST(basedatadir)
209 AC_SUBST(imagedir)
210 AC_SUBST(xmlmap22dir)
211 AC_SUBST(xmlmap40dir)
213 # Checks for libraries.
214 AC_CHECK_LIB([pthread], [main])
216 # Checks for header files.
217 AC_HEADER_DIRENT
218 AC_HEADER_STDC
219 AC_CHECK_HEADERS([assert.h stdint.h time.h])
221 # Checks for typedefs, structures, and compiler characteristics.
222 #AC_TYPE_SIZE_T
223 AC_HEADER_TIME
224 AC_STRUCT_TM
226 # Checks for library functions.
227 AC_FUNC_CLOSEDIR_VOID
228 AC_PROG_GCC_TRADITIONAL
229 AC_FUNC_MALLOC
230 AC_FUNC_MKTIME
231 AC_FUNC_REALLOC
232 AC_FUNC_SELECT_ARGTYPES
233 AC_FUNC_STAT
234 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
236 AC_CONFIG_FILES([Makefile
237                  images/Makefile
238                  src/Makefile
239                  src/0.22/Makefile
240                  src/0.40/Makefile
241                  man/Makefile])
242 AC_OUTPUT
246 # Add a special hack at the end, to let the user disable RPATH if he wants.
248 # http://wiki.debian.org/RpathIssue
249 # http://lists.debian.org/debian-devel/2003/debian-devel-200306/msg00569.html
250 # http://fedoraproject.org/wiki/Packaging:Guidelines#Removing_Rpath
252 AC_ARG_ENABLE([rpathhack],
253         [AC_HELP_STRING([--enable-rpathhack], [patch libtool to remove RPATH])],
254         [
255 AC_MSG_RESULT([patching libtool to fix HIDEOUS BREAKAGE])
256 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
257 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
258         ],
259         [])