configure.ac 3.24 KB
Newer Older
1 2 3 4 5 6 7 8 9
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.61])
AC_INIT([belle-sip], [0.0.1], [jehan.monnier@linphone.org])
AC_CONFIG_SRCDIR([src/belle_sip_utils.c])

AC_CONFIG_HEADERS([config.h])

Simon Morlat's avatar
Simon Morlat committed
10 11
AC_CANONICAL_SYSTEM

12
AM_INIT_AUTOMAKE
Simon Morlat's avatar
Simon Morlat committed
13
AM_SILENT_RULES(yes)
14 15 16

# Checks for programs.
AC_PROG_CC
jehan's avatar
jehan committed
17
AM_PROG_CC_C_O
18 19 20 21 22 23 24 25
LT_INIT(disable-static win32-dll)

if test -f /etc/debian_version ; then
	use_deb=true;
else
	use_rpm=true;
fi

Simon Morlat's avatar
Simon Morlat committed
26 27 28 29 30 31 32 33 34 35 36 37 38
AC_ARG_ENABLE(debug,
		[  --enable-debug    Turn on debug mode (default=yes)],
		[case "${enableval}" in
		yes) debug=true ;;
		no)  debug=false ;;
		*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
		esac],[debug=true])

if test "$debug" = "no" ; then
	CFLAGS="-g -O2"
else
	CFLAGS="-g"
fi
39

jehan's avatar
jehan committed
40
STRICT_OPTIONS=" -Wall -Werror"
41
dnl because of antlr3 we must accept a few warnings...
jehan's avatar
jehan committed
42 43 44 45
       LESS_STRICT_OPTIONS= #more portable
#       LESS_STRICT_OPTIONS="$STRICT_OPTIONS -Wno-error=unused-function \
#        -Wno-error=uninitialized -Wno-error=unused-variable \
#        -Wno-error=unused-but-set-variable "
46 47 48 49 50 51 52

AC_SUBST(STRICT_OPTIONS)
AC_SUBST(LESS_STRICT_OPTIONS)

# Checks for libraries.

# Checks for header files.
jehan's avatar
jehan committed
53 54 55
AC_ARG_WITH( antlr,
      [  --with-antlr      Set prefix where libantlr can be found or "none" to disable (ex:/usr or /usr/local)[default=/usr] ],
      [ antlr_prefix=${withval}],[ antlr_prefix=/usr ])
56 57

found_antlr3=no
jehan's avatar
jehan committed
58 59 60 61 62 63
ANTLR_CFLAGS="-I${antlr_prefix}/include"
ANTLR_LIBS="-L${antlr_prefix}/lib -lantlr3c"

dnl check antlr headers
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $ANTLR_CFLAGS"
64
AC_CHECK_HEADERS([antlr3.h], [found_antlr3=yes])
jehan's avatar
jehan committed
65
CPPFLAGS=$CPPFLAGS_save
66

jehan's avatar
jehan committed
67
if test "$found_antlr3" != "yes" ; then
68
	AC_MSG_ERROR([Could not find antlr3 development files. Please install antlr3 (libantlr3c-dev on debian/ubuntu systems)])
jehan's avatar
jehan committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
	ANTLR_CFLAGS=
	ANTLR_LIBS=
fi
AC_PATH_PROG([ANTLR],[antlr3],[no],[$antlr_prefix/bin])

if test $ANTLR = "no" ; then
antlr_java_prefixes="$antlr_prefix/share/java /usr/local/share/java /usr/share/java /opt/local/share/java"

	for antlr_java_prefix in $antlr_java_prefixes
	do
		antlr_jar=$antlr_java_prefix/antlr.jar
		AC_CHECK_FILE([$antlr_jar],[break],[antlr_jar=no])
	done
	if test $antlr_jar = "no" ; then
		AC_MSG_ERROR([Could not find antlr.jar. Please install antlr3 ])
	fi
	AC_PATH_PROG([JAVA],[java])
	if test $JAVA = "no" ; then
		AC_MSG_ERROR([Could not find java prog. Please install java ])
	else	
		ANTLR="$JAVA -jar $antlr_jar"
	fi
91
fi
jehan's avatar
jehan committed
92 93 94 95
AC_SUBST(ANTLR_CFLAGS)
AC_SUBST(ANTLR_LIBS)

PKG_CHECK_MODULES(CUNIT, cunit, [found_cunit=yes],[found_cunit=no])
96 97 98 99 100 101 102 103
if test "$found_cunit" = "no" ; then
	AC_CHECK_HEADERS(CUnit/CUnit.h,
		[
			found_cunit=yes
			CUNIT_LIBS="-lcunit"
		])
fi

Simon Morlat's avatar
Simon Morlat committed
104 105 106 107 108 109 110 111
case "$target_os" in
	*darwin*)
		#hack for macport
		CUNIT_LIBS+=" -lncurses"
	;;
esac


jehan's avatar
jehan committed
112 113
AC_SUBST(CUNIT_CFLAGS)
AC_SUBST(CUNIT_LIBS)
114

115
if test "$found_cunit" = "no" ; then
116 117 118
	AC_MSG_WARN([Could not find cunit framework, tests are not compiled.])
fi

jehan's avatar
jehan committed
119
AM_CONDITIONAL(BUILD_TESTS,test x$found_cunit = xyes)
120 121 122 123
# Checks for typedefs, structures, and compiler characteristics.


# Checks for library functions.
124
AC_CHECK_LIB(rt, clock_gettime)
Simon Morlat's avatar
Simon Morlat committed
125
AC_CHECK_LIB(dl, dlopen)
126 127 128 129 130 131 132 133 134 135 136


AC_CONFIG_FILES(
[
Makefile
include/Makefile
include/belle-sip/Makefile
src/Makefile
tester/Makefile
])
AC_OUTPUT