lib: added BuildHeader / BuildFields member functions
[barry.git] / configure.ac
blobf2939f8bd36ba35adff9dab956848e930d8b2ed7
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.61)
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.
21 AC_PROG_CC
22 AC_PROG_CXX
23 AC_PROG_MAKE_SET
24 AC_PROG_LIBTOOL
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"])
34 AC_LANG([C++])
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
42 AC_ARG_WITH(libtar,
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...";
47          LIBTAR_CFLAGS=""
48          LIBTAR_LIBS="-ltar"])
49 AC_SUBST(LIBTAR_CFLAGS)
50 AC_SUBST(LIBTAR_LIBS)
52 AC_CHECK_LIB([tar], [tar_open],
53         [LIBTAR_FOUND=1
54         AC_MSG_NOTICE([Found libtar, enabling libbarrybackup]) ],
55         [LIBTAR_FOUND=0
56         AC_MSG_NOTICE([Libtar NOT found, disabling libbarrybackup])],
57         [$LIBTAR_CFLAGS $LIBTAR_LIBS])
59 AC_ARG_WITH(libz,
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...";
64          LIBZ_CFLAGS=""
65          LIBZ_LIBS="-lz"])
66 AC_SUBST(LIBZ_CFLAGS)
67 AC_SUBST(LIBZ_LIBS)
69 AM_CONDITIONAL([WITH_BACKUP], [test "$LIBTAR_FOUND" = "1"])
71 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
72 PKG_CHECK_MODULES([LIBUSB], [libusb],
73         [],
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"])
76 AC_ARG_WITH(libusb,
77         [  --with-libusb=<path>    root path of libusb installation],
78         [LIBUSB_CFLAGS="-I$with_libusb/include"
79          LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
80         [])
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
99 #      from source or not
100 #         - default to searching for boost_serialization or
101 #           boost_serialization-mt, and error if not found
103 # Therefore:
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]),
114         [
115         if test x"$enableval" = "xno" ; then
116                 BOOST_ENABLED=no
117         else
118                 BOOST_ENABLED=yes
119         fi
120         ],
121         [BOOST_ENABLED=no])
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"],
149                 [
150                         AC_CHECK_LIB(boost_serialization-mt, main,
151                                 [BOOST_LDADD="-lboost_serialization-mt"],
152                                 [AC_MSG_ERROR(boost_serialization not found)],
153                                 [$BOOST_LIB_PATH]
154                                 )
155                 ],
156                 [$BOOST_LIB_PATH])
158         if test x"$BOOST_LDADD" != x ; then
159                 AC_MSG_NOTICE([BOOST library name: $BOOST_LDADD])
160         else
161                 AC_MSG_ERROR([boost_serialization library not found])
162         fi
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],
174         [FUSE_FOUND=1],
175         [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
176         )
178 PKG_CHECK_MODULES([GLIB2], [glib-2.0],
179         [GLIB2_FOUND=1],
180         [echo "GLIB 2.0 not found, skipping sync library."; GLIB2_FOUND=0]
181         )
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])
196 AC_ARG_WITH(zlib,
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],
201         [
202                 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
203                 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
204                 ZLIB_LIBS="-lz"
205         ],
206         [
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])
211                 ZLIB_LIBS=""
212                 if test "x$force_zlib" != xno ; then
213                         AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
214                 fi
215         ]
216         )
218 PKG_CHECK_MODULES([LIBXMLXX], [libxml++-2.6],
219         [LIBXMLXX_FOUND=1],
220         [
221                 echo "*****************************************************************"
222                 echo "WARNING: libxml++ not found... ALX parser not included"
223                 echo "*****************************************************************"
224                 LIBXMLXX_FOUND=0
225         ]
226         )
228 AM_CONDITIONAL([WITH_ALX],  [test "$LIBXMLXX_FOUND" = "1"])
231 AM_ICONV
235 # Checks for header files.
237 AC_HEADER_DIRENT
238 AC_HEADER_STDC
239 AC_CHECK_HEADERS([assert.h stdint.h time.h])
242 # Checks for typedefs, structures, and compiler characteristics.
244 #AC_TYPE_SIZE_T
245 AC_HEADER_TIME
246 AC_STRUCT_TM
249 # Checks for library functions.
252 # checks that are buggy and need a C compiler only
253 AC_LANG([C])
254 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
255 AC_FUNC_STRNLEN
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++
266 AC_LANG([C++])
267 AC_FUNC_CLOSEDIR_VOID
268 AC_PROG_GCC_TRADITIONAL
269 #AC_FUNC_MALLOC
270 #AC_FUNC_MKTIME
271 #AC_FUNC_REALLOC
272 AC_FUNC_SELECT_ARGTYPES
273 #AC_FUNC_STAT
275 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
276 AC_C_BIGENDIAN
278 AC_CONFIG_FILES([Makefile po/Makefile.in
279                  src/Makefile
280                  tools/Makefile
281                  examples/Makefile
282                  man/Makefile
283                  libbarry-0.pc
284                  libbarrydp-0.pc
285                  libbarryjdwp-0.pc
286                  libbarrysync-0.pc
287                  libbarrybackup-0.pc
288                  libbarryalx-0.pc])
291 # nested packages
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!
318 AC_OUTPUT