b487d4e4c4f286434291dbc2463e0f0e69edd763
[platform/upstream/syncevolution.git] / src / client-api / build / autotools / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(../../src/c++/common/base/base64.cpp)
3 AC_CANONICAL_SYSTEM
4 AM_INIT_AUTOMAKE(funambol, 2.0)
5 AM_CONFIG_HEADER(config.h)
6
7 dnl Checks for programs.
8 AC_PROG_CXX
9 AC_PROG_LIBTOOL
10 dnl AM_GNU_GETTEXT - not currently used
11
12 dnl we use libcurl on all posix but Mac
13 dnl use_mac_ta="no"
14 dnl use_libcurl="no"
15 case $target in
16 *apple-darwin*)  use_mac_ta="yes" ;;
17 *) use_libcurl="yes" ;;
18 esac
19
20 dnl check for libcurl now instead of during make
21 if test "x$use_libcurl" = "xyes"; then
22     AC_MSG_CHECKING([for libcurl])
23     if CURL_LDFLAGS=`sh -c 'curl-config --libs' 2>&AS_MESSAGE_LOG_FD` && \
24        CURL_CFLAGS=`sh -c 'curl-config --cflags' 2>&AS_MESSAGE_LOG_FD`; then
25             AC_MSG_RESULT([found])
26             AC_SUBST(CURL_LDFLAGS)
27             AC_SUBST(CURL_CFLAGS)
28     else
29             AC_MSG_RESULT([missing])
30             AC_MSG_ERROR([libcurl is required, check that its development package is installed and curl-config is in your PATH])
31     fi
32 fi
33
34 if test "x$use_mac_ta" = "xyes"; then
35     CURL_LDFLAGS="-framework CoreServices"
36     AC_SUBST(CURL_LDFLAGS)
37 fi
38
39
40 dnl Check for certain headers.
41 AC_CHECK_HEADERS(time.h)
42
43 AC_ARG_ENABLE(unit-tests,
44               AS_HELP_STRING([--enable-unit-tests],
45                              [enables tests embedded in the source code of the library (changes content of the library)]),
46               enable_unit_tests="$enableval", enable_unit_tests="no")
47 AC_ARG_ENABLE(integration-tests,
48               AS_HELP_STRING([--enable-integration-tests],
49                              [enables tests outside of the library (can be used together with normal builds of the library)]),
50               enable_integration_tests="$enableval", enable_integration_tests="no")
51 AC_ARG_ENABLE(assert,
52               AS_HELP_STRING([--enable-assert],
53                              [turn on assertions]),
54               enable_assert="$enableval", enable_assert="no")
55
56 if test $enable_assert == "no"; then
57         AC_DEFINE(NDEBUG, 1, [Define to 1 if assertions should be disabled.])
58 fi
59
60 # Optionally use wchar_t for unicode strings
61 AC_ARG_ENABLE(wchar,
62               AS_HELP_STRING([--enable-wchar],
63                              [enable Unicode wchar usage]),
64               enable_wchar="$enableval", enable_wchar="no")
65
66 if test $enable_wchar == "yes"; then
67         AC_DEFINE(USE_WCHAR, 1, [Define to 1 if unicode wchar_t should be used.])
68         AC_CHECK_HEADERS(wchar.h)
69 fi
70
71 # cppunit needed?
72 if test $enable_unit_tests == "yes" || test $enable_integration_tests == yes; then
73         CPPUNIT_CXXFLAGS=`cppunit-config --cflags` || AC_MSG_ERROR("cppunit-config --cflags failed - is it installed?")
74         CPPUNIT_LDFLAGS=`cppunit-config --libs` || AC_MSG_ERROR("cppunit-config --libs failed - is it installed?")
75         CPPUNIT_TESTS=client-test
76         AC_CHECK_HEADERS(signal.h)
77 fi
78 AC_SUBST(CPPUNIT_CXXFLAGS)
79 AC_SUBST(CPPUNIT_LDFLAGS)
80 AC_SUBST(CPPUNIT_TESTS)
81
82 if test $enable_unit_tests == "yes"; then
83         AC_DEFINE(ENABLE_UNIT_TESTS, 1, [enable unit tests inside the library's source code])
84 fi
85 if test $enable_integration_tests == "yes"; then
86         AC_DEFINE(ENABLE_INTEGRATION_TESTS, 1, [enable unit tests outside of the library's source code])
87 fi
88
89
90 AC_OUTPUT(Makefile src/Makefile include/Makefile test/Makefile)