lib: added Pin::valid()
[barry.git] / configure.ac
blobfd4101aae83bd58ad14b181c77ff46aaa748657f
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 pkgconfigdir=${libdir}/pkgconfig
146 AC_SUBST(pkgconfigdir)
148 AC_SUBST(LIBUSB_CFLAGS)
149 AC_SUBST(LIBUSB_LIBS)
151 AM_CONDITIONAL([WITH_FUSE], [test "$FUSE_FOUND" = "1"])
153 #AC_CHECK_LIB([IOKit], [main])
154 #AC_CHECK_LIB([libusb], [libusb_init])
155 AC_CHECK_LIB([pthread], [main])
157 AC_ARG_WITH(zlib,
158         AC_HELP_STRING(--with-zlib, [force usage of zlib, and halt if not available]),
159         force_zlib=$withval, force_zlib=no )
161 AC_CHECK_LIB([z], [crc32],
162         [
163                 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
164                 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
165                 ZLIB_LIBS="-lz"
166         ],
167         [
168                 echo "*****************************************************************"
169                 echo "WARNING: zlib not found... packed .cod files will fail crc checks"
170                 echo "*****************************************************************"
171                 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
172                 ZLIB_LIBS=""
173                 if test "x$force_zlib" != xno ; then
174                         AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
175                 fi
176         ]
177         )
179 AM_ICONV
183 # Checks for header files.
185 AC_HEADER_DIRENT
186 AC_HEADER_STDC
187 AC_CHECK_HEADERS([assert.h stdint.h time.h])
190 # Checks for typedefs, structures, and compiler characteristics.
192 #AC_TYPE_SIZE_T
193 AC_HEADER_TIME
194 AC_STRUCT_TM
197 # Checks for library functions.
200 # checks that are buggy and need a C compiler only
201 AC_LANG([C])
202 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
203 AC_FUNC_STRNLEN
204 if test $ac_cv_func_strnlen_working = yes ; then
205         AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
206                 [Define to 1 if a working strnlen exists.])
208 if test $ac_cv_func_strnlen_working = no ; then
209         AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
210                 [Define to 1 if a working strnlen exists, 0 if not.])
213 # checks that work with C++
214 AC_LANG([C++])
215 AC_FUNC_CLOSEDIR_VOID
216 AC_PROG_GCC_TRADITIONAL
217 #AC_FUNC_MALLOC
218 #AC_FUNC_MKTIME
219 #AC_FUNC_REALLOC
220 AC_FUNC_SELECT_ARGTYPES
221 #AC_FUNC_STAT
223 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
224 AC_C_BIGENDIAN
226 AC_CONFIG_FILES([Makefile po/Makefile.in
227                  src/Makefile
228                  tools/Makefile
229                  examples/Makefile
230                  man/Makefile
231                  libbarry-0.pc
232                  libbarrydp-0.pc
233                  libbarryjdwp-0.pc])
236 # nested packages
238 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
239 if test "$enable_gui" = yes; then
240         AC_CONFIG_SUBDIRS([gui])
242 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
243 if test "$enable_opensync_plugin" = yes; then
244         AC_CONFIG_SUBDIRS([opensync-plugin])
246 AC_ARG_ENABLE([opensync-plugin-4x], [AC_HELP_STRING([--enable-opensync-plugin-4x], [build the opensync 0.4x plugin])])
247 if test "$enable_opensync_plugin_4x" = yes; then
248         AC_CONFIG_SUBDIRS([opensync-plugin-0.4x])
250 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes || test "$enable_opensync_plugin_4x" = yes; then
251         export TREE_BUILD_CXXFLAGS="-I`pwd`"
252         export TREE_BUILD_LDFLAGS="-L`pwd`/src"
253         export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
256 AC_OUTPUT