2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([barry], [0.15], [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
15 # Checks for programs.
22 AX_C_CHECK_FLAG([-fvisibility=hidden], [], [],
23 [HAVE_C_GCCVISIBILITY=1],
24 [HAVE_C_GCCVISIBILITY=0])
25 AX_CXX_CHECK_FLAG([-fvisibility=hidden], [], [],
26 [HAVE_CXX_GCCVISIBILITY=1],
27 [HAVE_CXX_GCCVISIBILITY=0])
28 AM_CONDITIONAL([WITH_GCCVISIBILITY], [test "$HAVE_C_GCCVISIBILITY" = "1" -a "$HAVE_CXX_GCCVISIBILITY" = "1"])
33 # Checks for libraries.
36 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
37 PKG_CHECK_MODULES([LIBUSB], [libusb],
39 [echo "ERROR: Libusb not found automatically... build may fail if you don't specify --with-libusb";LIBUSB_CFLAGS="-I/usr/include" LIBUSB_LIBS="-lusb"])
42 [ --with-libusb=<path> root path of libusb installation],
43 [LIBUSB_CFLAGS="-I$with_libusb/include"
44 LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
48 # Boost library configuration
50 # Ok, the requirements:
52 # - let the user enable/disable Boost support from configure
53 # - default to disabled
54 # - if enabled, and not available, error
56 # - let user specify include path, and lib path, separately,
57 # since some Boost installations have an additional boost-1.34.1
58 # style directory in them
59 # - default to using no path overrides, assuming everything
60 # that is needed is in default distro locations
62 # - let user specify the name of the serialization library, since
63 # the name of the library can change whether you're building
65 # - default to searching for boost_serialization or
66 # boost_serialization-mt, and error if not found
70 # --enable-boost Handles enable/disable
71 # --with-boost-include=path Override the include path
72 # --with-boost-lib=path Override the lib path
73 # --with-boost-serialization=name Override the name of serialization
74 # library to link with
77 AC_ARG_ENABLE([boost],
78 AC_HELP_STRING([--enable-boost], [enable Boost support]),
80 if test x"$enableval" = "xno" ; then
88 AC_ARG_WITH([boost-include],
89 AC_HELP_STRING(--with-boost-include=path,
90 [path to Boost include directory in order to make include <boost/something.hpp> valid (defaults to system paths)]),
91 BOOST_INC_PATH="-I$withval", BOOST_INC_PATH="" )
93 AC_ARG_WITH([boost-lib],
94 AC_HELP_STRING(--with-boost-lib=path,
95 [path to Boost library directory (defaults to system paths)]),
96 BOOST_LIB_PATH="-L$withval", BOOST_LIB_PATH="" )
98 AC_ARG_WITH(boost-serialization,
99 AC_HELP_STRING(--with-boost-serialization=name,
100 [name of serialization library to use with compiler's -l option (defaults to boost_serialization or boost_serialization-mt.)]),
101 boost_serialization_name=$withval, boost_serialization_name="boost_serialization")
103 AC_MSG_NOTICE([using BOOST library... $BOOST_ENABLED])
104 if test x"$BOOST_INC_PATH$BOOST_LIB_PATH" != x ; then
105 AC_MSG_NOTICE([BOOST include options: $BOOST_INC_PATH])
106 AC_MSG_NOTICE([BOOST library options: $BOOST_LIB_PATH])
109 if test x"$BOOST_ENABLED" = "xyes" ; then
110 # Only $BOOST_LIB_PATH is given for this check, since no
111 # headers are included in the autoconf main() test snippet.
112 AC_CHECK_LIB($boost_serialization_name, main,
113 [BOOST_LDADD="-l$boost_serialization_name"],
115 AC_CHECK_LIB(boost_serialization-mt, main,
116 [BOOST_LDADD="-lboost_serialization-mt"],
117 [AC_MSG_ERROR(boost_serialization not found)],
123 if test x"$BOOST_LDADD" != x ; then
124 AC_MSG_NOTICE([BOOST library name: $BOOST_LDADD])
126 AC_MSG_ERROR([boost_serialization library not found])
130 AC_SUBST(BOOST_LIB_PATH)
131 AC_SUBST(BOOST_INC_PATH)
132 AC_SUBST(BOOST_LDADD)
133 AM_CONDITIONAL([WITH_BOOST], [test "$BOOST_ENABLED" = "yes"])
136 #PKG_CHECK_MODULES([OPENSSL], [openssl])
138 PKG_CHECK_MODULES([FUSE], [fuse >= 2.5],
140 [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
143 pkgconfigdir=${libdir}/pkgconfig
144 AC_SUBST(pkgconfigdir)
146 AC_SUBST(LIBUSB_CFLAGS)
147 AC_SUBST(LIBUSB_LIBS)
149 AM_CONDITIONAL([WITH_FUSE], [test "$FUSE_FOUND" = "1"])
151 #AC_CHECK_LIB([IOKit], [main])
152 #AC_CHECK_LIB([libusb], [libusb_init])
153 AC_CHECK_LIB([pthread], [main])
156 AC_HELP_STRING(--with-zlib, [force usage of zlib, and halt if not available]),
157 force_zlib=$withval, force_zlib=no )
159 AC_CHECK_LIB([z], [crc32],
161 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
162 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
166 echo "*****************************************************************"
167 echo "WARNING: zlib not found... packed .cod files will fail crc checks"
168 echo "*****************************************************************"
169 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
171 if test "x$force_zlib" != xno ; then
172 AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
181 # Checks for header files.
185 AC_CHECK_HEADERS([assert.h stdint.h time.h])
188 # Checks for typedefs, structures, and compiler characteristics.
195 # Checks for library functions.
198 # checks that are buggy and need a C compiler only
200 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
202 if test $ac_cv_func_strnlen_working = yes ; then
203 AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
204 [Define to 1 if a working strnlen exists.])
206 if test $ac_cv_func_strnlen_working = no ; then
207 AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
208 [Define to 1 if a working strnlen exists, 0 if not.])
211 # checks that work with C++
213 AC_FUNC_CLOSEDIR_VOID
214 AC_PROG_GCC_TRADITIONAL
218 AC_FUNC_SELECT_ARGTYPES
221 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
224 AC_CONFIG_FILES([Makefile
234 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
235 if test "$enable_gui" = yes; then
236 AC_CONFIG_SUBDIRS([gui])
238 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
239 if test "$enable_opensync_plugin" = yes; then
240 AC_CONFIG_SUBDIRS([opensync-plugin])
242 AC_ARG_ENABLE([opensync-plugin-4x], [AC_HELP_STRING([--enable-opensync-plugin-4x], [build the opensync 0.4x plugin])])
243 if test "$enable_opensync_plugin_4x" = yes; then
244 AC_CONFIG_SUBDIRS([opensync-plugin-0.4x])
246 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes || test "$enable_opensync_plugin_4x" = yes; then
247 export TREE_BUILD_CXXFLAGS="-I`pwd`"
248 export TREE_BUILD_LDFLAGS="-L`pwd`/src"
249 export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"