Added pkgconfig files for libbarrydp and libbarryjdwp
[barry.git] / configure.ac
blobb176c0ad7a1523f062486ef0ef6d9f4e98690c2e
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.61)
5 AC_INIT([barry], [0.16], [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.
17 AC_PROG_CC
18 AC_PROG_CXX
19 AC_PROG_MAKE_SET
20 AC_PROG_LIBTOOL
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"])
30 AC_LANG([C++])
33 # Checks for libraries.
36 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
37 PKG_CHECK_MODULES([LIBUSB], [libusb],
38         [],
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"])
41 AC_ARG_WITH(libusb,
42         [  --with-libusb=<path>    root path of libusb installation],
43         [LIBUSB_CFLAGS="-I$with_libusb/include"
44          LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
45         [])
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
64 #      from source or not
65 #         - default to searching for boost_serialization or
66 #           boost_serialization-mt, and error if not found
68 # Therefore:
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]),
79         [
80         if test x"$enableval" = "xno" ; then
81                 BOOST_ENABLED=no
82         else
83                 BOOST_ENABLED=yes
84         fi
85         ],
86         [BOOST_ENABLED=no])
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"],
114                 [
115                         AC_CHECK_LIB(boost_serialization-mt, main,
116                                 [BOOST_LDADD="-lboost_serialization-mt"],
117                                 [AC_MSG_ERROR(boost_serialization not found)],
118                                 [$BOOST_LIB_PATH]
119                                 )
120                 ],
121                 [$BOOST_LIB_PATH])
123         if test x"$BOOST_LDADD" != x ; then
124                 AC_MSG_NOTICE([BOOST library name: $BOOST_LDADD])
125         else
126                 AC_MSG_ERROR([boost_serialization library not found])
127         fi
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],
139         [FUSE_FOUND=1],
140         [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
141         )
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])
155 AC_ARG_WITH(zlib,
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],
160         [
161                 AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])
162                 AC_ARG_VAR([ZLIB_LIBS], [Linker options for zlib])
163                 ZLIB_LIBS="-lz"
164         ],
165         [
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])
170                 ZLIB_LIBS=""
171                 if test "x$force_zlib" != xno ; then
172                         AC_MSG_FAILURE([--with-zlib specified, but zlib not found])
173                 fi
174         ]
175         )
177 AM_ICONV
181 # Checks for header files.
183 AC_HEADER_DIRENT
184 AC_HEADER_STDC
185 AC_CHECK_HEADERS([assert.h stdint.h time.h])
188 # Checks for typedefs, structures, and compiler characteristics.
190 #AC_TYPE_SIZE_T
191 AC_HEADER_TIME
192 AC_STRUCT_TM
195 # Checks for library functions.
198 # checks that are buggy and need a C compiler only
199 AC_LANG([C])
200 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
201 AC_FUNC_STRNLEN
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++
212 AC_LANG([C++])
213 AC_FUNC_CLOSEDIR_VOID
214 AC_PROG_GCC_TRADITIONAL
215 #AC_FUNC_MALLOC
216 #AC_FUNC_MKTIME
217 #AC_FUNC_REALLOC
218 AC_FUNC_SELECT_ARGTYPES
219 #AC_FUNC_STAT
221 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
222 AC_C_BIGENDIAN
224 AC_CONFIG_FILES([Makefile
225                  src/Makefile
226                  tools/Makefile
227                  examples/Makefile
228                  man/Makefile
229                  libbarry-0.pc
230                  libbarrydp-0.pc
231                  libbarryjdwp-0.pc])
234 # nested packages
236 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
237 if test "$enable_gui" = yes; then
238         AC_CONFIG_SUBDIRS([gui])
240 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
241 if test "$enable_opensync_plugin" = yes; then
242         AC_CONFIG_SUBDIRS([opensync-plugin])
244 AC_ARG_ENABLE([opensync-plugin-4x], [AC_HELP_STRING([--enable-opensync-plugin-4x], [build the opensync 0.4x plugin])])
245 if test "$enable_opensync_plugin_4x" = yes; then
246         AC_CONFIG_SUBDIRS([opensync-plugin-0.4x])
248 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes || test "$enable_opensync_plugin_4x" = yes; then
249         export TREE_BUILD_CXXFLAGS="-I`pwd`"
250         export TREE_BUILD_LDFLAGS="-L`pwd`/src"
251         export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
254 AC_OUTPUT