Add ALX parser
[barry.git] / configure.ac
blobad84375e0ebbb4e16c06fd9470f9ac02b08b0f78
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.61)
5 AC_INIT([barry], [0.17], [barry-devel@lists.sourceforge.net])
6 #AM_CONFIG_HEADER(config.h)
7 AC_CONFIG_SRCDIR([src/barry.h])
8 AC_CONFIG_HEADERS([config.h:config.h.in])
9 AC_CONFIG_MACRO_DIR([m4])
10 AM_INIT_AUTOMAKE([dist-bzip2])
12 AC_USE_SYSTEM_EXTENSIONS
14 AM_GNU_GETTEXT([external])
15 AM_GNU_GETTEXT_VERSION([0.17])
18 # Checks for programs.
20 AC_PROG_CC
21 AC_PROG_CXX
22 AC_PROG_MAKE_SET
23 AC_PROG_LIBTOOL
25 AX_C_CHECK_FLAG([-fvisibility=hidden], [], [],
26         [HAVE_C_GCCVISIBILITY=1],
27         [HAVE_C_GCCVISIBILITY=0])
28 AX_CXX_CHECK_FLAG([-fvisibility=hidden], [], [],
29         [HAVE_CXX_GCCVISIBILITY=1],
30         [HAVE_CXX_GCCVISIBILITY=0])
31 AM_CONDITIONAL([WITH_GCCVISIBILITY], [test "$HAVE_C_GCCVISIBILITY" = "1" -a "$HAVE_CXX_GCCVISIBILITY" = "1"])
33 AC_LANG([C++])
36 # Checks for libraries.
39 # libtar and libz don't have pkg-config files on many systems.
40 # libz we can assume, but libtar we need to test for
41 AC_ARG_WITH(libtar,
42         [  --with-libtar=<path>    root path of libtar install],
43         [LIBTAR_CFLAGS="-I$with_libtar/include"
44          LIBTAR_LIBS="-L$with_libtar/lib -ltar"],
45         [echo "Guessing libtar location... may not compile...";
46          LIBTAR_CFLAGS=""
47          LIBTAR_LIBS="-ltar"])
48 AC_SUBST(LIBTAR_CFLAGS)
49 AC_SUBST(LIBTAR_LIBS)
51 AC_CHECK_LIB([tar], [tar_open],
52         [LIBTAR_FOUND=1
53         AC_MSG_NOTICE([Found libtar, enabling libbarrybackup]) ],
54         [LIBTAR_FOUND=0
55         AC_MSG_NOTICE([Libtar NOT found, disabling libbarrybackup])],
56         [$LIBTAR_CFLAGS $LIBTAR_LIBS])
58 AC_ARG_WITH(libz,
59         [  --with-zlib=<path>      root path of zlib install],
60         [LIBZ_CFLAGS="-I$with_libtar/include"
61          LIBZ_LIBS="-L$with_libtar/lib -ltar"],
62         [echo "Guessing zlib location... may not compile...";
63          LIBZ_CFLAGS=""
64          LIBZ_LIBS="-lz"])
65 AC_SUBST(LIBZ_CFLAGS)
66 AC_SUBST(LIBZ_LIBS)
68 AM_CONDITIONAL([WITH_BACKUP], [test "$LIBTAR_FOUND" = "1"])
70 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
71 PKG_CHECK_MODULES([LIBUSB], [libusb],
72         [],
73         [echo "ERROR: Libusb not found automatically... build may fail if you don't specify --with-libusb";LIBUSB_CFLAGS="-I/usr/include" LIBUSB_LIBS="-lusb"])
75 AC_ARG_WITH(libusb,
76         [  --with-libusb=<path>    root path of libusb installation],
77         [LIBUSB_CFLAGS="-I$with_libusb/include"
78          LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
79         [])
82 # Boost library configuration
84 # Ok, the requirements:
86 #    - let the user enable/disable Boost support from configure
87 #         - default to disabled
88 #         - if enabled, and not available, error
90 #    - let user specify include path, and lib path, separately,
91 #      since some Boost installations have an additional boost-1.34.1
92 #      style directory in them
93 #         - default to using no path overrides, assuming everything
94 #           that is needed is in default distro locations
96 #    - let user specify the name of the serialization library, since
97 #      the name of the library can change whether you're building
98 #      from source or not
99 #         - default to searching for boost_serialization or
100 #           boost_serialization-mt, and error if not found
102 # Therefore:
104 #    --enable-boost                   Handles enable/disable
105 #    --with-boost-include=path        Override the include path
106 #    --with-boost-lib=path            Override the lib path
107 #    --with-boost-serialization=name  Override the name of serialization
108 #                                     library to link with
111 AC_ARG_ENABLE([boost],
112         AC_HELP_STRING([--enable-boost], [enable Boost support]),
113         [
114         if test x"$enableval" = "xno" ; then
115                 BOOST_ENABLED=no
116         else
117                 BOOST_ENABLED=yes
118         fi
119         ],
120         [BOOST_ENABLED=no])
122 AC_ARG_WITH([boost-include],
123         AC_HELP_STRING(--with-boost-include=path,
124                 [path to Boost include directory in order to make include <boost/something.hpp> valid (defaults to system paths)]),
125         BOOST_INC_PATH="-I$withval",  BOOST_INC_PATH="" )
127 AC_ARG_WITH([boost-lib],
128         AC_HELP_STRING(--with-boost-lib=path,
129                 [path to Boost library directory (defaults to system paths)]),
130         BOOST_LIB_PATH="-L$withval",  BOOST_LIB_PATH="" )
132 AC_ARG_WITH(boost-serialization,
133         AC_HELP_STRING(--with-boost-serialization=name,
134                 [name of serialization library to use with compiler's -l option (defaults to boost_serialization or boost_serialization-mt.)]),
135         boost_serialization_name=$withval, boost_serialization_name="boost_serialization")
137 AC_MSG_NOTICE([using BOOST library... $BOOST_ENABLED])
138 if test x"$BOOST_INC_PATH$BOOST_LIB_PATH" != x ; then
139         AC_MSG_NOTICE([BOOST include options: $BOOST_INC_PATH])
140         AC_MSG_NOTICE([BOOST library options: $BOOST_LIB_PATH])
143 if test x"$BOOST_ENABLED" = "xyes" ; then
144         # Only $BOOST_LIB_PATH is given for this check, since no
145         # headers are included in the autoconf main() test snippet.
146         AC_CHECK_LIB($boost_serialization_name, main,
147                 [BOOST_LDADD="-l$boost_serialization_name"],
148                 [
149                         AC_CHECK_LIB(boost_serialization-mt, main,
150                                 [BOOST_LDADD="-lboost_serialization-mt"],
151                                 [AC_MSG_ERROR(boost_serialization not found)],
152                                 [$BOOST_LIB_PATH]
153                                 )
154                 ],
155                 [$BOOST_LIB_PATH])
157         if test x"$BOOST_LDADD" != x ; then
158                 AC_MSG_NOTICE([BOOST library name: $BOOST_LDADD])
159         else
160                 AC_MSG_ERROR([boost_serialization library not found])
161         fi
164 AC_SUBST(BOOST_LIB_PATH)
165 AC_SUBST(BOOST_INC_PATH)
166 AC_SUBST(BOOST_LDADD)
167 AM_CONDITIONAL([WITH_BOOST], [test "$BOOST_ENABLED" = "yes"])
170 #PKG_CHECK_MODULES([OPENSSL], [openssl])
172 PKG_CHECK_MODULES([FUSE], [fuse >= 2.5],
173         [FUSE_FOUND=1],
174         [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
175         )
177 PKG_CHECK_MODULES([GLIB2], [glib-2.0],
178         [GLIB2_FOUND=1],
179         [echo "GLIB 2.0 not found, skipping sync library."; GLIB2_FOUND=0]
180         )
182 pkgconfigdir=${libdir}/pkgconfig
183 AC_SUBST(pkgconfigdir)
185 AC_SUBST(LIBUSB_CFLAGS)
186 AC_SUBST(LIBUSB_LIBS)
188 AM_CONDITIONAL([WITH_FUSE], [test "$FUSE_FOUND" = "1"])
189 AM_CONDITIONAL([WITH_SYNC], [test "$GLIB2_FOUND" = "1"])
191 #AC_CHECK_LIB([IOKit], [main])
192 #AC_CHECK_LIB([libusb], [libusb_init])
193 AC_CHECK_LIB([pthread], [main])
195 AC_ARG_WITH(zlib,
196         AC_HELP_STRING(--with-zlib, [force usage of zlib, and halt if not available]),
197         force_zlib=$withval, force_zlib=no )
199 AC_CHECK_LIB([z], [crc32],
200         [
201                 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
202                 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
203                 ZLIB_LIBS="-lz"
204         ],
205         [
206                 echo "*****************************************************************"
207                 echo "WARNING: zlib not found... packed .cod files will fail crc checks"
208                 echo "*****************************************************************"
209                 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
210                 ZLIB_LIBS=""
211                 if test "x$force_zlib" != xno ; then
212                         AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
213                 fi
214         ]
215         )
217 PKG_CHECK_MODULES([LIBXMLXX], [libxml++-2.6],
218         [LIBXMLXX_FOUND=1],
219         [
220                 echo "*****************************************************************"
221                 echo "WARNING: expat not found... ALX parser will not supported"
222                 echo "*****************************************************************"
223                 LIBXMLXX_FOUND=0
224         ]
225         )
227 AM_CONDITIONAL([WITH_ALX],  [test "$LIBXMLXX_FOUND" = "1"])
230 #AC_ARG_WITH(expat,
231 #       AC_HELP_STRING(--with-expat, [force usage of expat, and halt if not available]),
232 #       force_expat=$withval, force_expat=no )
234 #AC_CHECK_LIB(expat, [open], 
235 #       [
236 #               EXPAT_FOUND=1
237 #               AC_DEFINE([HAVE_EXPAT], [1], [Use expat library])
238 #               AC_ARG_VAR([EXPAT_LIBS], [Linker options for expat])
239 #               EXPAT_LIBS="-lexpat"
240 #       ],
241 #       [
242 #               echo "*****************************************************************"
243 #               echo "WARNING: expat not found... ALX parser will not supported"
244 #               echo "*****************************************************************"
245 #               AC_ARG_VAR([EXPAT_LIBS], [Linker options for expat])
246 #               EXPAT_LIBS=""
247 #               if test "x$force_expat" != xno ; then
248 #                       AC_MSG_FAILURE([--with-expat specified, but expat not found])
249 #               fi
250 #       ]
251 #       )
252 #AC_CHECK_HEADERS([expat.h])
254 #AM_CONDITIONAL([WITH_ALX],  [test "$EXPAT_FOUND" = "1"])
257 AM_ICONV
261 # Checks for header files.
263 AC_HEADER_DIRENT
264 AC_HEADER_STDC
265 AC_CHECK_HEADERS([assert.h stdint.h time.h])
268 # Checks for typedefs, structures, and compiler characteristics.
270 #AC_TYPE_SIZE_T
271 AC_HEADER_TIME
272 AC_STRUCT_TM
275 # Checks for library functions.
278 # checks that are buggy and need a C compiler only
279 AC_LANG([C])
280 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
281 AC_FUNC_STRNLEN
282 if test $ac_cv_func_strnlen_working = yes ; then
283         AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
284                 [Define to 1 if a working strnlen exists.])
286 if test $ac_cv_func_strnlen_working = no ; then
287         AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
288                 [Define to 1 if a working strnlen exists, 0 if not.])
291 # checks that work with C++
292 AC_LANG([C++])
293 AC_FUNC_CLOSEDIR_VOID
294 AC_PROG_GCC_TRADITIONAL
295 #AC_FUNC_MALLOC
296 #AC_FUNC_MKTIME
297 #AC_FUNC_REALLOC
298 AC_FUNC_SELECT_ARGTYPES
299 #AC_FUNC_STAT
301 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
302 AC_C_BIGENDIAN
304 AC_CONFIG_FILES([Makefile po/Makefile.in
305                  src/Makefile
306                  tools/Makefile
307                  examples/Makefile
308                  man/Makefile
309                  libbarry-0.pc
310                  libbarrydp-0.pc
311                  libbarryjdwp-0.pc
312                  libbarrysync-0.pc
313                  libbarrybackup-0.pc])
315 if test "$LIBXMLXX_FOUND" = "1"; then
316 AC_CONFIG_FILES([libbarryalx-0.pc])
320 # nested packages
322 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
323 if test "$enable_gui" = yes; then
324         AC_CONFIG_SUBDIRS([gui])
326 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
327 if test "$enable_opensync_plugin" = yes; then
328         AC_CONFIG_SUBDIRS([opensync-plugin])
330 AC_ARG_ENABLE([opensync-plugin-4x], [AC_HELP_STRING([--enable-opensync-plugin-4x], [build the opensync 0.4x plugin])])
331 if test "$enable_opensync_plugin_4x" = yes; then
332         AC_CONFIG_SUBDIRS([opensync-plugin-0.4x])
334 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes || test "$enable_opensync_plugin_4x" = yes; then
335         export TREE_BUILD_CXXFLAGS="-I`pwd`"
336         export TREE_BUILD_LDFLAGS="-L`pwd`/src"
337         export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
340 AC_OUTPUT