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 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
40 PKG_CHECK_MODULES([LIBUSB], [libusb],
42 [echo "ERROR: Libusb not found automatically... build may fail if you don't specify --with-libusb";LIBUSB_CFLAGS="-I/usr/include" LIBUSB_LIBS="-lusb"])
45 [ --with-libusb=<path> root path of libusb installation],
46 [LIBUSB_CFLAGS="-I$with_libusb/include"
47 LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
51 # Boost library configuration
53 # Ok, the requirements:
55 # - let the user enable/disable Boost support from configure
56 # - default to disabled
57 # - if enabled, and not available, error
59 # - let user specify include path, and lib path, separately,
60 # since some Boost installations have an additional boost-1.34.1
61 # style directory in them
62 # - default to using no path overrides, assuming everything
63 # that is needed is in default distro locations
65 # - let user specify the name of the serialization library, since
66 # the name of the library can change whether you're building
68 # - default to searching for boost_serialization or
69 # boost_serialization-mt, and error if not found
73 # --enable-boost Handles enable/disable
74 # --with-boost-include=path Override the include path
75 # --with-boost-lib=path Override the lib path
76 # --with-boost-serialization=name Override the name of serialization
77 # library to link with
80 AC_ARG_ENABLE([boost],
81 AC_HELP_STRING([--enable-boost], [enable Boost support]),
83 if test x"$enableval" = "xno" ; then
91 AC_ARG_WITH([boost-include],
92 AC_HELP_STRING(--with-boost-include=path,
93 [path to Boost include directory in order to make include <boost/something.hpp> valid (defaults to system paths)]),
94 BOOST_INC_PATH="-I$withval", BOOST_INC_PATH="" )
96 AC_ARG_WITH([boost-lib],
97 AC_HELP_STRING(--with-boost-lib=path,
98 [path to Boost library directory (defaults to system paths)]),
99 BOOST_LIB_PATH="-L$withval", BOOST_LIB_PATH="" )
101 AC_ARG_WITH(boost-serialization,
102 AC_HELP_STRING(--with-boost-serialization=name,
103 [name of serialization library to use with compiler's -l option (defaults to boost_serialization or boost_serialization-mt.)]),
104 boost_serialization_name=$withval, boost_serialization_name="boost_serialization")
106 AC_MSG_NOTICE([using BOOST library... $BOOST_ENABLED])
107 if test x"$BOOST_INC_PATH$BOOST_LIB_PATH" != x ; then
108 AC_MSG_NOTICE([BOOST include options: $BOOST_INC_PATH])
109 AC_MSG_NOTICE([BOOST library options: $BOOST_LIB_PATH])
112 if test x"$BOOST_ENABLED" = "xyes" ; then
113 # Only $BOOST_LIB_PATH is given for this check, since no
114 # headers are included in the autoconf main() test snippet.
115 AC_CHECK_LIB($boost_serialization_name, main,
116 [BOOST_LDADD="-l$boost_serialization_name"],
118 AC_CHECK_LIB(boost_serialization-mt, main,
119 [BOOST_LDADD="-lboost_serialization-mt"],
120 [AC_MSG_ERROR(boost_serialization not found)],
126 if test x"$BOOST_LDADD" != x ; then
127 AC_MSG_NOTICE([BOOST library name: $BOOST_LDADD])
129 AC_MSG_ERROR([boost_serialization library not found])
133 AC_SUBST(BOOST_LIB_PATH)
134 AC_SUBST(BOOST_INC_PATH)
135 AC_SUBST(BOOST_LDADD)
136 AM_CONDITIONAL([WITH_BOOST], [test "$BOOST_ENABLED" = "yes"])
139 #PKG_CHECK_MODULES([OPENSSL], [openssl])
141 PKG_CHECK_MODULES([FUSE], [fuse >= 2.5],
143 [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
146 PKG_CHECK_MODULES([GLIB2], [glib-2.0],
148 [echo "GLIB 2.0 not found, skipping sync library."; GLIB2_FOUND=0]
151 pkgconfigdir=${libdir}/pkgconfig
152 AC_SUBST(pkgconfigdir)
154 AC_SUBST(LIBUSB_CFLAGS)
155 AC_SUBST(LIBUSB_LIBS)
157 AM_CONDITIONAL([WITH_FUSE], [test "$FUSE_FOUND" = "1"])
158 AM_CONDITIONAL([WITH_SYNC], [test "$GLIB2_FOUND" = "1"])
160 #AC_CHECK_LIB([IOKit], [main])
161 #AC_CHECK_LIB([libusb], [libusb_init])
162 AC_CHECK_LIB([pthread], [main])
165 AC_HELP_STRING(--with-zlib, [force usage of zlib, and halt if not available]),
166 force_zlib=$withval, force_zlib=no )
168 AC_CHECK_LIB([z], [crc32],
170 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
171 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
175 echo "*****************************************************************"
176 echo "WARNING: zlib not found... packed .cod files will fail crc checks"
177 echo "*****************************************************************"
178 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
180 if test "x$force_zlib" != xno ; then
181 AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
190 # Checks for header files.
194 AC_CHECK_HEADERS([assert.h stdint.h time.h])
197 # Checks for typedefs, structures, and compiler characteristics.
204 # Checks for library functions.
207 # checks that are buggy and need a C compiler only
209 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
211 if test $ac_cv_func_strnlen_working = yes ; then
212 AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
213 [Define to 1 if a working strnlen exists.])
215 if test $ac_cv_func_strnlen_working = no ; then
216 AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
217 [Define to 1 if a working strnlen exists, 0 if not.])
220 # checks that work with C++
222 AC_FUNC_CLOSEDIR_VOID
223 AC_PROG_GCC_TRADITIONAL
227 AC_FUNC_SELECT_ARGTYPES
230 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
233 AC_CONFIG_FILES([Makefile po/Makefile.in
246 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
247 if test "$enable_gui" = yes; then
248 AC_CONFIG_SUBDIRS([gui])
250 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
251 if test "$enable_opensync_plugin" = yes; then
252 AC_CONFIG_SUBDIRS([opensync-plugin])
254 AC_ARG_ENABLE([opensync-plugin-4x], [AC_HELP_STRING([--enable-opensync-plugin-4x], [build the opensync 0.4x plugin])])
255 if test "$enable_opensync_plugin_4x" = yes; then
256 AC_CONFIG_SUBDIRS([opensync-plugin-0.4x])
258 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes || test "$enable_opensync_plugin_4x" = yes; then
259 export TREE_BUILD_CXXFLAGS="-I`pwd`"
260 export TREE_BUILD_LDFLAGS="-L`pwd`/src"
261 export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"