- minor adjustments to r_message.h and r_timezone.h
[barry.git] / configure.ac
blob7a432b4f5515118d3104c418d7370d3efe9d0379
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.61)
5 AC_INIT([barry], [0.12], [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
13 # Checks for programs.
14 AC_PROG_CC
15 AC_PROG_CXX
16 AC_PROG_MAKE_SET
17 AC_PROG_LIBTOOL
19 AC_LANG([C++])
21 # generates LIBUSB_CFLAGS and LIBUSB_LIBS for us
22 PKG_CHECK_MODULES([LIBUSB], [libusb],
23         [],
24         [echo "ERROR: Libusb not found automatically... build may fail if you don't specify --with-libusb";LIBUSB_CFLAGS="-I/usr/include" LIBUSB_LIBS="-lusb"])
26 AC_ARG_WITH(libusb,
27         [  --with-libusb=<path>    root path of libusb installation],
28         [LIBUSB_CFLAGS="-I$with_libusb/include"
29          LIBUSB_LIBS="-L$with_libusb/lib -lusb"],
30         [])
32 AC_ARG_WITH(boost,
33         AC_HELP_STRING(--with-boost[=path],
34                 [root path of boost installation (no arg defaults to 'yes' and uses system paths)]),
35         use_boost=$withval,  use_boost=no ) 
37 if test x"$use_boost" != "xyes" ; then
38         if test x"$use_boost" != "xno" ; then
39                 BOOST_LIB_PATH=$use_boost/lib
40                 BOOST_INC_PATH=$use_boost/include
41                 BOOST_ENABLED="true"
42         fi
43 else
44         BOOST_LIB_PATH=""
45         BOOST_INC_PATH=""
46         BOOST_ENABLED="true"    
49 PKG_CHECK_MODULES([OPENSSL], [openssl])
51 pkgconfigdir=${libdir}/pkgconfig
52 AC_SUBST(pkgconfigdir)
54 AC_SUBST(BOOST_LIB_PATH)
55 AC_SUBST(BOOST_INC_PATH)
56 AC_SUBST(LIBUSB_CFLAGS)
57 AC_SUBST(LIBUSB_LIBS)
59 AM_CONDITIONAL([WITH_BOOST], [test "$BOOST_ENABLED" = "true"])
60 AM_CONDITIONAL([WITH_BOOST_PATHS], [test -n "$BOOST_LIB_PATH"])
62 # Checks for libraries.
63 #AC_CHECK_LIB([IOKit], [main])
64 AC_CHECK_LIB([pthread], [main])
65 #AC_CHECK_LIB([libusb], [libusb_init])
67 # Checks for header files.
68 AC_HEADER_DIRENT
69 AC_HEADER_STDC
70 AC_CHECK_HEADERS([assert.h stdint.h time.h])
72 # Checks for typedefs, structures, and compiler characteristics.
73 #AC_TYPE_SIZE_T
74 AC_HEADER_TIME
75 AC_STRUCT_TM
78 # Checks for library functions.
81 # checks that are buggy and need a C compiler only
82 AC_LANG([C])
83 AC_FUNC_STRNLEN
84 if test $ac_cv_func_strnlen_working = yes ; then
85         AC_DEFINE([HAVE_WORKING_STRNLEN], 1,
86                 [Define to 1 if a working strnlen exists.])
88 if test $ac_cv_func_strnlen_working = no ; then
89         AC_DEFINE([HAVE_WORKING_STRNLEN], 0,
90                 [Define to 1 if a working strnlen exists, 0 if not.])
93 # checks that work with C++
94 AC_LANG([C++])
95 AC_FUNC_CLOSEDIR_VOID
96 AC_PROG_GCC_TRADITIONAL
97 #AC_FUNC_MALLOC
98 #AC_FUNC_MKTIME
99 #AC_FUNC_REALLOC
100 AC_FUNC_SELECT_ARGTYPES
101 #AC_FUNC_STAT
103 AC_CHECK_FUNCS([bzero gettimeofday memset select strcasecmp strchr strerror strtol strtoul])
104 AC_C_BIGENDIAN
106 AC_CONFIG_FILES([Makefile
107                  src/Makefile
108                  tools/Makefile
109                  examples/Makefile
110                  man/Makefile
111                  libbarry-0.pc])
114 # nested packages
116 AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
117 if test "$enable_gui" = yes; then
118         AC_CONFIG_SUBDIRS([gui])
120 AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync-plugin], [build the opensync plugin])])
121 if test "$enable_opensync_plugin" = yes; then
122         AC_CONFIG_SUBDIRS([opensync-plugin])
124 if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes; then
125         export TREE_BUILD_CXXFLAGS="-I`pwd`"
126         export TREE_BUILD_LDFLAGS="-L`pwd`/src"
127         export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
130 AC_OUTPUT