2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([barry], [0.17.0], [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 # this is the verion of gettext, not barry
16 AM_GNU_GETTEXT_VERSION([0.17])
19 # Checks for programs.
26 AX_C_CHECK_FLAG([-fvisibility=hidden], [], [],
27 [HAVE_C_GCCVISIBILITY=1],
28 [HAVE_C_GCCVISIBILITY=0])
29 AX_CXX_CHECK_FLAG([-fvisibility=hidden], [], [],
30 [HAVE_CXX_GCCVISIBILITY=1],
31 [HAVE_CXX_GCCVISIBILITY=0])
32 AM_CONDITIONAL([WITH_GCCVISIBILITY], [test "$HAVE_C_GCCVISIBILITY" = "1" -a "$HAVE_CXX_GCCVISIBILITY" = "1"])
37 # Checks for libraries.
40 # libtar and libz don't have pkg-config files on many systems.
41 # libz we can assume, but libtar we need to test for
43 [ --with-libtar=<path> root path of libtar install],
44 [LIBTAR_CFLAGS="-I$with_libtar/include"
45 LIBTAR_LIBS="-L$with_libtar/lib -ltar"],
46 [echo "Guessing libtar location... may not compile...";
49 AC_SUBST(LIBTAR_CFLAGS)
52 AC_CHECK_LIB([tar], [tar_open],
54 AC_MSG_NOTICE([Found libtar, enabling libbarrybackup]) ],
56 AC_MSG_NOTICE([Libtar NOT found, disabling libbarrybackup])],
57 [$LIBTAR_CFLAGS $LIBTAR_LIBS])
60 [ --with-zlib=<path> root path of zlib install],
61 [LIBZ_CFLAGS="-I$with_libtar/include"
62 LIBZ_LIBS="-L$with_libtar/lib -ltar"],
63 [echo "Guessing zlib location... may not compile...";
69 AM_CONDITIONAL([WITH_BACKUP], [test "$LIBTAR_FOUND" = "1"])
71 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
72 PKG_CHECK_MODULES([LIBUSB], [libusb],
74 [echo "ERROR: Libusb not found automatically... build may fail if you don't specify --with-libusb";LIBUSB_CFLAGS="-I/usr/include" LIBUSB_LIBS="-lusb"])
77 [ --with-libusb=<path> root path of libusb installation],
78 [LIBUSB_CFLAGS="-I$with_libusb/include"
79 LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
83 # Boost library configuration
85 # Ok, the requirements:
87 # - let the user enable/disable Boost support from configure
88 # - default to disabled
89 # - if enabled, and not available, error
91 # - let user specify include path, and lib path, separately,
92 # since some Boost installations have an additional boost-1.34.1
93 # style directory in them
94 # - default to using no path overrides, assuming everything
95 # that is needed is in default distro locations
97 # - let user specify the name of the serialization library, since
98 # the name of the library can change whether you're building
100 # - default to searching for boost_serialization or
101 # boost_serialization-mt, and error if not found
105 # --enable-boost Handles enable/disable
106 # --with-boost-include=path Override the include path
107 # --with-boost-lib=path Override the lib path
108 # --with-boost-serialization=name Override the name of serialization
109 # library to link with
112 AC_ARG_ENABLE([boost],
113 AC_HELP_STRING([--enable-boost], [enable Boost support]),
115 if test x"$enableval" = "xno" ; then
123 AC_ARG_WITH([boost-include],
124 AC_HELP_STRING(--with-boost-include=path,
125 [path to Boost include directory in order to make include <boost/something.hpp> valid (defaults to system paths)]),
126 BOOST_INC_PATH="-I$withval", BOOST_INC_PATH="" )
128 AC_ARG_WITH([boost-lib],
129 AC_HELP_STRING(--with-boost-lib=path,
130 [path to Boost library directory (defaults to system paths)]),
131 BOOST_LIB_PATH="-L$withval", BOOST_LIB_PATH="" )
133 AC_ARG_WITH(boost-serialization,
134 AC_HELP_STRING(--with-boost-serialization=name,
135 [name of serialization library to use with compiler's -l option (defaults to boost_serialization or boost_serialization-mt.)]),
136 boost_serialization_name=$withval, boost_serialization_name="boost_serialization")
138 AC_MSG_NOTICE([using BOOST library... $BOOST_ENABLED])
139 if test x"$BOOST_INC_PATH$BOOST_LIB_PATH" != x ; then
140 AC_MSG_NOTICE([BOOST include options: $BOOST_INC_PATH])
141 AC_MSG_NOTICE([BOOST library options: $BOOST_LIB_PATH])
144 if test x"$BOOST_ENABLED" = "xyes" ; then
145 # Only $BOOST_LIB_PATH is given for this check, since no
146 # headers are included in the autoconf main() test snippet.
147 AC_CHECK_LIB($boost_serialization_name, main,
148 [BOOST_LDADD="-l$boost_serialization_name"],
150 AC_CHECK_LIB(boost_serialization-mt, main,
151 [BOOST_LDADD="-lboost_serialization-mt"],
152 [AC_MSG_ERROR(boost_serialization not found)],
158 if test x"$BOOST_LDADD" != x ; then
159 AC_MSG_NOTICE([BOOST library name: $BOOST_LDADD])
161 AC_MSG_ERROR([boost_serialization library not found])
165 AC_SUBST(BOOST_LIB_PATH)
166 AC_SUBST(BOOST_INC_PATH)
167 AC_SUBST(BOOST_LDADD)
168 AM_CONDITIONAL([WITH_BOOST], [test "$BOOST_ENABLED" = "yes"])
171 #PKG_CHECK_MODULES([OPENSSL], [openssl])
173 PKG_CHECK_MODULES([FUSE], [fuse >= 2.5],
175 [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
178 PKG_CHECK_MODULES([GLIB2], [glib-2.0],
180 [echo "GLIB 2.0 not found, skipping sync library."; GLIB2_FOUND=0]
183 pkgconfigdir=${libdir}/pkgconfig
184 AC_SUBST(pkgconfigdir)
186 AC_SUBST(LIBUSB_CFLAGS)
187 AC_SUBST(LIBUSB_LIBS)
189 AM_CONDITIONAL([WITH_FUSE], [test "$FUSE_FOUND" = "1"])
190 AM_CONDITIONAL([WITH_SYNC], [test "$GLIB2_FOUND" = "1"])
192 #AC_CHECK_LIB([IOKit], [main])
193 #AC_CHECK_LIB([libusb], [libusb_init])
194 AC_CHECK_LIB([pthread], [main])
197 AC_HELP_STRING(--with-zlib, [force usage of zlib, and halt if not available]),
198 force_zlib=$withval, force_zlib=no )
200 AC_CHECK_LIB([z], [crc32],
202 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
203 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
207 echo "*****************************************************************"
208 echo "WARNING: zlib not found... packed .cod files will fail crc checks"
209 echo "*****************************************************************"
210 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
212 if test "x$force_zlib" != xno ; then
213 AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
218 PKG_CHECK_MODULES([LIBXMLXX], [libxml++-2.6],
221 echo "*****************************************************************"
222 echo "WARNING: libxml++ not found... ALX parser not included"
223 echo "*****************************************************************"
228 AM_CONDITIONAL([WITH_ALX], [test "$LIBXMLXX_FOUND" = "1"])
235 # Checks for header files.
239 AC_CHECK_HEADERS([assert.h stdint.h time.h])
242 # Checks for typedefs, structures, and compiler characteristics.
249 # Checks for library functions.
252 # checks that are buggy and need a C compiler only
254 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
256 if test $ac_cv_func_strnlen_working = yes ; then
257 AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
258 [Define to 1 if a working strnlen exists.])
260 if test $ac_cv_func_strnlen_working = no ; then
261 AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
262 [Define to 1 if a working strnlen exists, 0 if not.])
265 # checks that work with C++
267 AC_FUNC_CLOSEDIR_VOID
268 AC_PROG_GCC_TRADITIONAL
272 AC_FUNC_SELECT_ARGTYPES
275 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
278 AC_CONFIG_FILES([Makefile po/Makefile.in
293 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
294 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
295 AC_ARG_ENABLE([opensync-plugin-4x], [AC_HELP_STRING([--enable-opensync-plugin-4x], [build the opensync 0.4x plugin])])
297 # make sure that the environment is setup before anything else
298 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes || test "$enable_opensync_plugin_4x" = yes; then
299 export TREE_BUILD_CXXFLAGS="-I`pwd`"
300 export TREE_BUILD_LDFLAGS="-L`pwd`/src"
301 export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
304 # conditionally enable the subdirectory packages
305 if test "$enable_gui" = yes; then
306 AC_CONFIG_SUBDIRS([gui])
308 if test "$enable_opensync_plugin" = yes; then
309 AC_CONFIG_SUBDIRS([opensync-plugin])
311 if test "$enable_opensync_plugin_4x" = yes; then
312 AC_CONFIG_SUBDIRS([opensync-plugin-0.4x])
316 # Generate the scripts!