2 # Process this file with autoconf to produce a configure script.
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.
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"])
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
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...";
48 AC_SUBST(LIBTAR_CFLAGS)
51 AC_CHECK_LIB([tar], [tar_open],
53 AC_MSG_NOTICE([Found libtar, enabling libbarrybackup]) ],
55 AC_MSG_NOTICE([Libtar NOT found, disabling libbarrybackup])],
56 [$LIBTAR_CFLAGS $LIBTAR_LIBS])
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...";
68 AM_CONDITIONAL([WITH_BACKUP], [test "$LIBTAR_FOUND" = "1"])
70 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
71 PKG_CHECK_MODULES([LIBUSB], [libusb],
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"])
76 [ --with-libusb=<path> root path of libusb installation],
77 [LIBUSB_CFLAGS="-I$with_libusb/include"
78 LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
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
99 # - default to searching for boost_serialization or
100 # boost_serialization-mt, and error if not found
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]),
114 if test x"$enableval" = "xno" ; then
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"],
149 AC_CHECK_LIB(boost_serialization-mt, main,
150 [BOOST_LDADD="-lboost_serialization-mt"],
151 [AC_MSG_ERROR(boost_serialization not found)],
157 if test x"$BOOST_LDADD" != x ; then
158 AC_MSG_NOTICE([BOOST library name: $BOOST_LDADD])
160 AC_MSG_ERROR([boost_serialization library not found])
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],
174 [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
177 PKG_CHECK_MODULES([GLIB2], [glib-2.0],
179 [echo "GLIB 2.0 not found, skipping sync library."; GLIB2_FOUND=0]
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])
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],
201 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
202 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
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])
211 if test "x$force_zlib" != xno ; then
212 AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
217 PKG_CHECK_MODULES([LIBXMLXX], [libxml++-2.6],
220 echo "*****************************************************************"
221 echo "WARNING: expat not found... ALX parser will not supported"
222 echo "*****************************************************************"
227 AM_CONDITIONAL([WITH_ALX], [test "$LIBXMLXX_FOUND" = "1"])
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],
237 # AC_DEFINE([HAVE_EXPAT], [1], [Use expat library])
238 # AC_ARG_VAR([EXPAT_LIBS], [Linker options for expat])
239 # EXPAT_LIBS="-lexpat"
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])
247 # if test "x$force_expat" != xno ; then
248 # AC_MSG_FAILURE([--with-expat specified, but expat not found])
252 #AC_CHECK_HEADERS([expat.h])
254 #AM_CONDITIONAL([WITH_ALX], [test "$EXPAT_FOUND" = "1"])
261 # Checks for header files.
265 AC_CHECK_HEADERS([assert.h stdint.h time.h])
268 # Checks for typedefs, structures, and compiler characteristics.
275 # Checks for library functions.
278 # checks that are buggy and need a C compiler only
280 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
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++
293 AC_FUNC_CLOSEDIR_VOID
294 AC_PROG_GCC_TRADITIONAL
298 AC_FUNC_SELECT_ARGTYPES
301 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
304 AC_CONFIG_FILES([Makefile po/Makefile.in
313 libbarrybackup-0.pc])
315 if test "$LIBXMLXX_FOUND" = "1"; then
316 AC_CONFIG_FILES([libbarryalx-0.pc])
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"