configure.ac 3.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#                                               -*- 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])

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

# Checks for programs.
AC_PROG_CC
jehan's avatar
jehan committed
15
AM_PROG_CC_C_O
16 17 18 19 20 21 22 23
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
24 25 26 27 28 29 30 31 32 33 34 35 36
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
37 38 39 40

if test x$GCC = xyes ; then
	STRICT_OPTIONS=" -Wall -Werror"
dnl because of antlr3 we must accept a few warnings...
jehan's avatar
jehan committed
41 42 43 44
       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 "
45 46 47 48 49 50 51 52 53

fi

AC_SUBST(STRICT_OPTIONS)
AC_SUBST(LESS_STRICT_OPTIONS)

# Checks for libraries.

# Checks for header files.
jehan's avatar
jehan committed
54 55 56
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 ])
57 58

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

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

jehan's avatar
jehan committed
68
if test "$found_antlr3" != "yes" ; then
69
	AC_MSG_ERROR([Could not find antlr3 development files. Please install antlr3 (libantlr3c-dev on debian/ubuntu systems)])
jehan's avatar
jehan committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
	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
92
fi
jehan's avatar
jehan committed
93 94 95
AC_SUBST(ANTLR_CFLAGS)
AC_SUBST(ANTLR_LIBS)

96

jehan's avatar
jehan committed
97 98 99 100
PKG_CHECK_MODULES(CUNIT, cunit, [found_cunit=yes],[found_cunit=no])
AC_SUBST(CUNIT_CFLAGS)
CUNIT_LIBS+=-lncurses
AC_SUBST(CUNIT_LIBS)
101 102 103 104 105

if test x$found_cunit = xno ; then
	AC_MSG_WARN([Could not find cunit framework, tests are not compiled.])
fi

jehan's avatar
jehan committed
106
AM_CONDITIONAL(BUILD_TESTS,test x$found_cunit = xyes)
107 108 109 110
# Checks for typedefs, structures, and compiler characteristics.


# Checks for library functions.
111
AC_CHECK_LIB(rt, clock_gettime)
Simon Morlat's avatar
Simon Morlat committed
112
AC_CHECK_LIB(dl, dlopen)
113 114 115 116 117 118 119 120 121 122 123


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