os4x: removed redundant vformat code, and use libbarrysync
[barry.git] / configure.ac
blob58259725713d719484d7d16b6701c8152ee0e4cb
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])
17 # Checks for programs.
19 AC_PROG_CC
20 AC_PROG_CXX
21 AC_PROG_MAKE_SET
22 AC_PROG_LIBTOOL
24 AX_C_CHECK_FLAG([-fvisibility=hidden], [], [],
25         [HAVE_C_GCCVISIBILITY=1],
26         [HAVE_C_GCCVISIBILITY=0])
27 AX_CXX_CHECK_FLAG([-fvisibility=hidden], [], [],
28         [HAVE_CXX_GCCVISIBILITY=1],
29         [HAVE_CXX_GCCVISIBILITY=0])
30 AM_CONDITIONAL([WITH_GCCVISIBILITY], [test "$HAVE_C_GCCVISIBILITY" = "1" -a "$HAVE_CXX_GCCVISIBILITY" = "1"])
32 AC_LANG([C++])
35 # Checks for libraries.
38 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
39 PKG_CHECK_MODULES([LIBUSB], [libusb],
40         [],
41         [echo "ERROR: Libusb not found automatically... build may fail if you don't specify --with-libusb";LIBUSB_CFLAGS="-I/usr/include" LIBUSB_LIBS="-lusb"])
43 AC_ARG_WITH(libusb,
44         [  --with-libusb=<path>    root path of libusb installation],
45         [LIBUSB_CFLAGS="-I$with_libusb/include"
46          LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
47         [])
50 # Boost library configuration
52 # Ok, the requirements:
54 #    - let the user enable/disable Boost support from configure
55 #         - default to disabled
56 #         - if enabled, and not available, error
58 #    - let user specify include path, and lib path, separately,
59 #      since some Boost installations have an additional boost-1.34.1
60 #      style directory in them
61 #         - default to using no path overrides, assuming everything
62 #           that is needed is in default distro locations
64 #    - let user specify the name of the serialization library, since
65 #      the name of the library can change whether you're building
66 #      from source or not
67 #         - default to searching for boost_serialization or
68 #           boost_serialization-mt, and error if not found
70 # Therefore:
72 #    --enable-boost                   Handles enable/disable
73 #    --with-boost-include=path        Override the include path
74 #    --with-boost-lib=path            Override the lib path
75 #    --with-boost-serialization=name  Override the name of serialization
76 #                                     library to link with
79 AC_ARG_ENABLE([boost],
80         AC_HELP_STRING([--enable-boost], [enable Boost support]),
81         [
82         if test x"$enableval" = "xno" ; then
83                 BOOST_ENABLED=no
84         else
85                 BOOST_ENABLED=yes
86         fi
87         ],
88         [BOOST_ENABLED=no])
90 AC_ARG_WITH([boost-include],
91         AC_HELP_STRING(--with-boost-include=path,
92                 [path to Boost include directory in order to make include <boost/something.hpp> valid (defaults to system paths)]),
93         BOOST_INC_PATH="-I$withval",  BOOST_INC_PATH="" )
95 AC_ARG_WITH([boost-lib],
96         AC_HELP_STRING(--with-boost-lib=path,
97                 [path to Boost library directory (defaults to system paths)]),
98         BOOST_LIB_PATH="-L$withval",  BOOST_LIB_PATH="" )
100 AC_ARG_WITH(boost-serialization,
101         AC_HELP_STRING(--with-boost-serialization=name,
102                 [name of serialization library to use with compiler's -l option (defaults to boost_serialization or boost_serialization-mt.)]),
103         boost_serialization_name=$withval, boost_serialization_name="boost_serialization")
105 AC_MSG_NOTICE([using BOOST library... $BOOST_ENABLED])
106 if test x"$BOOST_INC_PATH$BOOST_LIB_PATH" != x ; then
107         AC_MSG_NOTICE([BOOST include options: $BOOST_INC_PATH])
108         AC_MSG_NOTICE([BOOST library options: $BOOST_LIB_PATH])
111 if test x"$BOOST_ENABLED" = "xyes" ; then
112         # Only $BOOST_LIB_PATH is given for this check, since no
113         # headers are included in the autoconf main() test snippet.
114         AC_CHECK_LIB($boost_serialization_name, main,
115                 [BOOST_LDADD="-l$boost_serialization_name"],
116                 [
117                         AC_CHECK_LIB(boost_serialization-mt, main,
118                                 [BOOST_LDADD="-lboost_serialization-mt"],
119                                 [AC_MSG_ERROR(boost_serialization not found)],
120                                 [$BOOST_LIB_PATH]
121                                 )
122                 ],
123                 [$BOOST_LIB_PATH])
125         if test x"$BOOST_LDADD" != x ; then
126                 AC_MSG_NOTICE([BOOST library name: $BOOST_LDADD])
127         else
128                 AC_MSG_ERROR([boost_serialization library not found])
129         fi
132 AC_SUBST(BOOST_LIB_PATH)
133 AC_SUBST(BOOST_INC_PATH)
134 AC_SUBST(BOOST_LDADD)
135 AM_CONDITIONAL([WITH_BOOST], [test "$BOOST_ENABLED" = "yes"])
138 #PKG_CHECK_MODULES([OPENSSL], [openssl])
140 PKG_CHECK_MODULES([FUSE], [fuse >= 2.5],
141         [FUSE_FOUND=1],
142         [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
143         )
145 PKG_CHECK_MODULES([GLIB2], [glib-2.0],
146         [GLIB2_FOUND=1],
147         [echo "GLIB 2.0 not found, skipping sync library."; GLIB2_FOUND=0]
148         )
150 pkgconfigdir=${libdir}/pkgconfig
151 AC_SUBST(pkgconfigdir)
153 AC_SUBST(LIBUSB_CFLAGS)
154 AC_SUBST(LIBUSB_LIBS)
156 AM_CONDITIONAL([WITH_FUSE], [test "$FUSE_FOUND" = "1"])
157 AM_CONDITIONAL([WITH_SYNC], [test "$GLIB2_FOUND" = "1"])
159 #AC_CHECK_LIB([IOKit], [main])
160 #AC_CHECK_LIB([libusb], [libusb_init])
161 AC_CHECK_LIB([pthread], [main])
163 AC_ARG_WITH(zlib,
164         AC_HELP_STRING(--with-zlib, [force usage of zlib, and halt if not available]),
165         force_zlib=$withval, force_zlib=no )
167 AC_CHECK_LIB([z], [crc32],
168         [
169                 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
170                 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
171                 ZLIB_LIBS="-lz"
172         ],
173         [
174                 echo "*****************************************************************"
175                 echo "WARNING: zlib not found... packed .cod files will fail crc checks"
176                 echo "*****************************************************************"
177                 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
178                 ZLIB_LIBS=""
179                 if test "x$force_zlib" != xno ; then
180                         AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
181                 fi
182         ]
183         )
185 AM_ICONV
189 # Checks for header files.
191 AC_HEADER_DIRENT
192 AC_HEADER_STDC
193 AC_CHECK_HEADERS([assert.h stdint.h time.h])
196 # Checks for typedefs, structures, and compiler characteristics.
198 #AC_TYPE_SIZE_T
199 AC_HEADER_TIME
200 AC_STRUCT_TM
203 # Checks for library functions.
206 # checks that are buggy and need a C compiler only
207 AC_LANG([C])
208 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
209 AC_FUNC_STRNLEN
210 if test $ac_cv_func_strnlen_working = yes ; then
211         AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
212                 [Define to 1 if a working strnlen exists.])
214 if test $ac_cv_func_strnlen_working = no ; then
215         AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
216                 [Define to 1 if a working strnlen exists, 0 if not.])
219 # checks that work with C++
220 AC_LANG([C++])
221 AC_FUNC_CLOSEDIR_VOID
222 AC_PROG_GCC_TRADITIONAL
223 #AC_FUNC_MALLOC
224 #AC_FUNC_MKTIME
225 #AC_FUNC_REALLOC
226 AC_FUNC_SELECT_ARGTYPES
227 #AC_FUNC_STAT
229 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
230 AC_C_BIGENDIAN
232 AC_CONFIG_FILES([Makefile po/Makefile.in
233                  src/Makefile
234                  tools/Makefile
235                  examples/Makefile
236                  man/Makefile
237                  libbarry-0.pc
238                  libbarrydp-0.pc
239                  libbarryjdwp-0.pc
240                  libbarrysync-0.pc])
243 # nested packages
245 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
246 if test "$enable_gui" = yes; then
247         AC_CONFIG_SUBDIRS([gui])
249 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
250 if test "$enable_opensync_plugin" = yes; then
251         AC_CONFIG_SUBDIRS([opensync-plugin])
253 AC_ARG_ENABLE([opensync-plugin-4x], [AC_HELP_STRING([--enable-opensync-plugin-4x], [build the opensync 0.4x plugin])])
254 if test "$enable_opensync_plugin_4x" = yes; then
255         AC_CONFIG_SUBDIRS([opensync-plugin-0.4x])
257 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes || test "$enable_opensync_plugin_4x" = yes; then
258         export TREE_BUILD_CXXFLAGS="-I`pwd`"
259         export TREE_BUILD_LDFLAGS="-L`pwd`/src"
260         export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
263 AC_OUTPUT