lib: added Backup parser and Restore builder classes
[barry.git] / configure.ac
blob3aa468edc388a0695712f6ceea521aff229e36c6
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 AM_ICONV
221 # Checks for header files.
223 AC_HEADER_DIRENT
224 AC_HEADER_STDC
225 AC_CHECK_HEADERS([assert.h stdint.h time.h])
228 # Checks for typedefs, structures, and compiler characteristics.
230 #AC_TYPE_SIZE_T
231 AC_HEADER_TIME
232 AC_STRUCT_TM
235 # Checks for library functions.
238 # checks that are buggy and need a C compiler only
239 AC_LANG([C])
240 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
241 AC_FUNC_STRNLEN
242 if test $ac_cv_func_strnlen_working = yes ; then
243         AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
244                 [Define to 1 if a working strnlen exists.])
246 if test $ac_cv_func_strnlen_working = no ; then
247         AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
248                 [Define to 1 if a working strnlen exists, 0 if not.])
251 # checks that work with C++
252 AC_LANG([C++])
253 AC_FUNC_CLOSEDIR_VOID
254 AC_PROG_GCC_TRADITIONAL
255 #AC_FUNC_MALLOC
256 #AC_FUNC_MKTIME
257 #AC_FUNC_REALLOC
258 AC_FUNC_SELECT_ARGTYPES
259 #AC_FUNC_STAT
261 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
262 AC_C_BIGENDIAN
264 AC_CONFIG_FILES([Makefile po/Makefile.in
265                  src/Makefile
266                  tools/Makefile
267                  examples/Makefile
268                  man/Makefile
269                  libbarry-0.pc
270                  libbarrydp-0.pc
271                  libbarryjdwp-0.pc
272                  libbarrysync-0.pc
273                  libbarrybackup-0.pc])
276 # nested packages
278 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
279 if test "$enable_gui" = yes; then
280         AC_CONFIG_SUBDIRS([gui])
282 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
283 if test "$enable_opensync_plugin" = yes; then
284         AC_CONFIG_SUBDIRS([opensync-plugin])
286 AC_ARG_ENABLE([opensync-plugin-4x], [AC_HELP_STRING([--enable-opensync-plugin-4x], [build the opensync 0.4x plugin])])
287 if test "$enable_opensync_plugin_4x" = yes; then
288         AC_CONFIG_SUBDIRS([opensync-plugin-0.4x])
290 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes || test "$enable_opensync_plugin_4x" = yes; then
291         export TREE_BUILD_CXXFLAGS="-I`pwd`"
292         export TREE_BUILD_LDFLAGS="-L`pwd`/src"
293         export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
296 AC_OUTPUT