configure.ac 2.48 KB
Newer Older
johan's avatar
johan committed
1 2 3 4 5
#   -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.



6
AC_INIT([bzrtp],[1.0.5])
johan's avatar
johan committed
7 8 9 10
AC_PREREQ(2.63)
AC_CONFIG_SRCDIR([src/bzrtp.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
11
AM_INIT_AUTOMAKE([tar-ustar --warnings=no-portability foreign])
jehan's avatar
jehan committed
12
AC_PROG_CC(["xcrun clang" gcc])
Simon Morlat's avatar
Simon Morlat committed
13
LT_INIT(win32-dll shared disable-static)
johan's avatar
johan committed
14 15 16 17 18 19 20
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_ARG_ENABLE(strict,
[  --enable-strict       Enable error on compilation warning [default=yes]],
[wall_werror=$enableval],
[wall_werror=yes]
)
21

johan's avatar
johan committed
22
# configure option to disable the tests
23 24 25
PKG_CHECK_MODULES(BCTOOLBOXTESTER, bctoolbox-tester, [found_pkg_config_bctoolboxtester=yes],[found_pkg_config_bctoolboxtester=no])
if test "$found_pkg_config_bctoolboxtester" = "no" ; then
	AC_MSG_WARN([Could not find bctoolbox-tester wrapper, tests are not compiled.])
johan's avatar
johan committed
26 27
fi

28 29 30 31
dnl check bctoolbox
PKG_CHECK_MODULES(BCTOOLBOX, [bctoolbox] ,[bctoolbox_found=yes] ,foo=bar)
if test "$bctoolbox_found" != "yes" ; then
	AC_MSG_ERROR([bctoolbox not found, aborting. ])
32 33
fi

34 35 36 37 38

dnl check for sqlite
PKG_CHECK_MODULES(SQLITE3,[sqlite3 >= 3.6.0],[found_sqlite=yes],[found_sqlite=no])
if test "$found_sqlite" != "yes" ; then
        AC_MSG_WARN([sqlite3 not found. Disabling cache.])
johan's avatar
johan committed
39
else
40
        AC_DEFINE(ZIDCACHE_ENABLED,1,[defined when libxml2 is available])
johan's avatar
johan committed
41 42
fi

Simon Morlat's avatar
Simon Morlat committed
43 44 45 46 47 48 49
dnl check libxml2
PKG_CHECK_MODULES(LIBXML2, [libxml-2.0] ,[libxml2_found=yes] ,foo=bar)
if test "$libxml2_found$found_sqlite" != "yesyes" ; then
	AC_MSG_WARN([libxml2 not found. Disabling cache.])
else
	AC_DEFINE(HAVE_LIBXML2,1,[defined when libxml2 is available])
fi
50

johan's avatar
johan committed
51 52 53 54 55 56 57 58 59
AC_ARG_ENABLE(tests,
        [AS_HELP_STRING([--disable-tests], [Disable compilation of tests])],
        [case "${enableval}" in
                yes)    tests_enabled=true ;;
                no)     tests_enabled=false ;;
                *)      AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
        esac],
        [tests_enabled=yes]
)
60
AM_CONDITIONAL(ENABLE_TESTS, test x$tests_enabled = xyes && test x$found_pkg_config_bctoolboxtester = xyes)
johan's avatar
johan committed
61

62
CFLAGS="$CFLAGS -Wall"
johan's avatar
johan committed
63

jehan's avatar
jehan committed
64 65 66 67 68 69
case $CC in
        *clang*)
                CFLAGS="$CFLAGS -Qunused-arguments"
        ;;
esac

johan's avatar
johan committed
70
if test $GCC = yes && test $wall_werror = yes;  then
71
	CFLAGS="$CFLAGS -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers "
johan's avatar
johan committed
72 73 74 75 76
fi

# Create the following files from their .in counterparts
AC_CONFIG_FILES([
  Makefile
Simon Morlat's avatar
Simon Morlat committed
77 78 79 80
  src/Makefile
  include/Makefile
  include/bzrtp/Makefile
  test/Makefile
johan's avatar
johan committed
81 82 83 84
  libbzrtp.pc
])

AC_OUTPUT