Fixed unlikely buffer overflow in m_javaloader.cc
[barry.git] / configure.ac
blob00e32f4a0dc9a5bcb40ceea06c05d5d883ebf1bc
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.61)
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 AM_INIT_AUTOMAKE([dist-bzip2])
11 AC_USE_SYSTEM_EXTENSIONS
14 # Checks for programs.
16 AC_PROG_CC
17 AC_PROG_CXX
18 AC_PROG_MAKE_SET
19 AC_PROG_LIBTOOL
21 AX_C_CHECK_FLAG([-fvisibility=hidden], [], [],
22         [HAVE_C_GCCVISIBILITY=1],
23         [HAVE_C_GCCVISIBILITY=0])
24 AX_CXX_CHECK_FLAG([-fvisibility=hidden], [], [],
25         [HAVE_CXX_GCCVISIBILITY=1],
26         [HAVE_CXX_GCCVISIBILITY=0])
27 AM_CONDITIONAL([WITH_GCCVISIBILITY], [test "$HAVE_C_GCCVISIBILITY" = "1" -a "$HAVE_CXX_GCCVISIBILITY" = "1"])
29 AC_LANG([C++])
32 # Checks for libraries.
35 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
36 PKG_CHECK_MODULES([LIBUSB], [libusb],
37         [],
38         [echo "ERROR: Libusb not found automatically... build may fail if you don't specify --with-libusb";LIBUSB_CFLAGS="-I/usr/include" LIBUSB_LIBS="-lusb"])
40 AC_ARG_WITH(libusb,
41         [  --with-libusb=<path>    root path of libusb installation],
42         [LIBUSB_CFLAGS="-I$with_libusb/include"
43          LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
44         [])
46 AC_ARG_WITH(boost,
47         AC_HELP_STRING(--with-boost[=path],
48                 [root path of boost installation (no arg defaults to 'yes' and uses system paths)]),
49         use_boost=$withval,  use_boost=no )
51 if test x"$use_boost" != "xyes" ; then
52         if test x"$use_boost" != "xno" ; then
53                 BOOST_LIB_PATH=$use_boost/lib
54                 BOOST_INC_PATH=$use_boost/include
55                 BOOST_ENABLED="true"
56         fi
57 else
58         BOOST_LIB_PATH=""
59         BOOST_INC_PATH=""
60         BOOST_ENABLED="true"
63 #PKG_CHECK_MODULES([OPENSSL], [openssl])
65 PKG_CHECK_MODULES([FUSE], [fuse >= 2.5],
66         [FUSE_FOUND=1],
67         [echo "FUSE library not found, skipping fuse module."; FUSE_FOUND=0]
68         )
70 PKG_CHECK_MODULES([ZLIB], [zlib],
71         [AC_DEFINE([HAVE_ZLIB], [1], [Use crc32 when generating packed .cod files])],
72         [echo "*****************************************************************"
73         echo "WARNING: zlib not found... packed .cod files will fail crc checks"]
74         echo "*****************************************************************"
75         )
77 pkgconfigdir=${libdir}/pkgconfig
78 AC_SUBST(pkgconfigdir)
80 AC_SUBST(BOOST_LIB_PATH)
81 AC_SUBST(BOOST_INC_PATH)
82 AC_SUBST(LIBUSB_CFLAGS)
83 AC_SUBST(LIBUSB_LIBS)
85 AM_CONDITIONAL([WITH_BOOST], [test "$BOOST_ENABLED" = "true"])
86 AM_CONDITIONAL([WITH_BOOST_PATHS], [test -n "$BOOST_LIB_PATH"])
87 AM_CONDITIONAL([WITH_FUSE], [test "$FUSE_FOUND" = "1"])
89 #AC_CHECK_LIB([IOKit], [main])
90 AC_CHECK_LIB([pthread], [main])
91 #AC_CHECK_LIB([libusb], [libusb_init])
93 AM_ICONV
97 # Checks for header files.
99 AC_HEADER_DIRENT
100 AC_HEADER_STDC
101 AC_CHECK_HEADERS([assert.h stdint.h time.h])
104 # Checks for typedefs, structures, and compiler characteristics.
106 #AC_TYPE_SIZE_T
107 AC_HEADER_TIME
108 AC_STRUCT_TM
111 # Checks for library functions.
114 # checks that are buggy and need a C compiler only
115 AC_LANG([C])
116 # AC_FUNC_STRNLEN changes linker options for us, and depends on a src/strnlen.c
117 AC_FUNC_STRNLEN
118 if test $ac_cv_func_strnlen_working = yes ; then
119         AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
120                 [Define to 1 if a working strnlen exists.])
122 if test $ac_cv_func_strnlen_working = no ; then
123         AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
124                 [Define to 1 if a working strnlen exists, 0 if not.])
127 # checks that work with C++
128 AC_LANG([C++])
129 AC_FUNC_CLOSEDIR_VOID
130 AC_PROG_GCC_TRADITIONAL
131 #AC_FUNC_MALLOC
132 #AC_FUNC_MKTIME
133 #AC_FUNC_REALLOC
134 AC_FUNC_SELECT_ARGTYPES
135 #AC_FUNC_STAT
137 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
138 AC_C_BIGENDIAN
140 AC_CONFIG_FILES([Makefile
141                  src/Makefile
142                  tools/Makefile
143                  examples/Makefile
144                  man/Makefile
145                  libbarry-0.pc])
148 # nested packages
150 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
151 if test "$enable_gui" = yes; then
152         AC_CONFIG_SUBDIRS([gui])
154 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
155 if test "$enable_opensync_plugin" = yes; then
156         AC_CONFIG_SUBDIRS([opensync-plugin])
158 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes; then
159         export TREE_BUILD_CXXFLAGS="-I`pwd`"
160         export TREE_BUILD_LDFLAGS="-L`pwd`/src"
161         export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
164 AC_OUTPUT