configure.ac 7.97 KB
Newer Older
1 2 3
dnl SFLPhone - configure.ac for automake 1.9 and autoconf 2.59
dnl
dnl Process this file with autoconf to produce a configure script.
4
AC_PREREQ(2.59)
5
AC_INIT([SFLPhone],[0.7],[sflphoneteam@savoirfairelinux.com],[sflphone])
6
AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2007]])
7 8 9 10
AC_REVISION([$Revision$])

dnl Compute canonical system name
AC_CANONICAL_TARGET
11

12 13
dnl Rewrite name of programs to be installed
AC_ARG_PROGRAM
jpbl's avatar
jpbl committed
14

15 16 17 18 19 20 21 22 23 24 25
dnl Automake options
AM_INIT_AUTOMAKE([-Wall -Wno-portability])

dnl Improve make variable MAKE
AC_PROG_MAKE_SET

dnl Where to find configure files
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_MACRO_DIR([m4])

dnl What to generate
yanmorin's avatar
yanmorin committed
26
dnl AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
27 28 29 30 31 32 33
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([libs/Makefile \
  libs/taxidermy/Makefile \
  libs/stund/Makefile \
  libs/utilspp/Makefile \
  libs/utilspp/functor/Makefile \
  libs/utilspp/singleton/Makefile])
34
  
35 36 37 38 39
AC_CONFIG_FILES([src/Makefile \
  src/sflphone \
  src/audio/Makefile \
  src/audio/gsm/Makefile \
  src/config/Makefile \
40
  src/dbus/Makefile \
41
  src/zeroconf/Makefile])
42
  
43 44 45 46
AC_CONFIG_FILES([skins/Makefile \
  skins/metal/Makefile \
  skins/gmetal/Makefile \
  ringtones/Makefile])
47 48 49 50 51 52
  
AC_CONFIG_FILES([platform/debian/changelog \
  platform/rpm/sflphone.spec \
  platform/fedora/sflphone.spec \
  platform/fedora/sflphone-fc6.spec])
  
yanmorin's avatar
yanmorin committed
53 54
dnl the file stamp-h.in should be there before (instead of AC_CONFIG_HEADERS(config.h))
AM_CONFIG_HEADER(config.h)
55 56

dnl Get project version
jpbl's avatar
jpbl committed
57 58
VERSION=`sed -ne 's/^#define SFLPHONED_VERSION "\(.*\)"/\1/p' ${srcdir}/src/global.h`

59
dnl Get rid of release number
jpbl's avatar
jpbl committed
60
RPM_VERSION=`echo $VERSION | cut -d- -f1`
61
AC_SUBST(RPM_VERSION)
jpbl's avatar
jpbl committed
62
RPM_RELEASE=`echo $VERSION | sed -ne 's/.*-\(.*\)/\1/p' `
63
AC_SUBST(RPM_RELEASE)
jpbl's avatar
jpbl committed
64
VERSION=`echo $VERSION | cut -d- -f1`
65
AC_SUBST(VERSION)
jpbl's avatar
jpbl committed
66

67
dnl Settings need Standard C++ Library
jpbl's avatar
jpbl committed
68 69 70
LIBS="$LIBS -lstdc++"

dnl Solaris pkgadd support definitions
71
PKGADD_PKG="SFLPhone"
jpbl's avatar
jpbl committed
72 73 74 75 76 77
PKGADD_NAME="SFLPhone - a SIP client and daemon"
PKGADD_VENDOR="http://www.sflphone.org/"
AC_SUBST(PKGADD_PKG)
AC_SUBST(PKGADD_NAME)
AC_SUBST(PKGADD_VENDOR)

78 79
dnl Check for programs
AC_PROG_CC
yanmorin's avatar
yanmorin committed
80
SFL_CXX_WITH_DEBUG
81 82 83 84 85
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
yanmorin's avatar
yanmorin committed
86
dnl will have to remove this
jpbl's avatar
jpbl committed
87 88
AC_PROG_LIBTOOL

89 90
dnl Define C++ as default language
AC_LANG(C++)
91

92 93
dnl Setup C++ compiler flags
CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS $USER_INCLUDES"
jpbl's avatar
jpbl committed
94

95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
dnl Check for header files
AC_FUNC_ALLOCA
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h malloc.h \
  memory.h netdb.h netinet/in.h stdlib.h string.h strings.h \
  sys/ioctl.h sys/socket.h sys/time.h unistd.h utime.h ostream])

dnl Check for typedefs, structures, and compiler characteristics
AC_HEADER_STAT
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_C_VOLATILE
AC_CHECK_TYPES([ptrdiff_t])

dnl Check for library functions
AC_FUNC_CHOWN
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([bzero floor gethostbyname gethrtime gettimeofday \
  inet_ntoa memset mkdir pathconf pow regcomp select setlocale socket \
  strchr strdup strerror strrchr strstr strtol utime])

dnl Check for portaudio
131
dnl PORTAUDIO_SETUP
132

133
dnl Check for exosip2
yanmorin's avatar
yanmorin committed
134
LP_CHECK_EXOSIP2
135
SFLPHONE_LIBS="$SFLPHONE_LIBS $EXOSIP_LIBS"
yanmorin's avatar
yanmorin committed
136

137

yanmorin's avatar
yanmorin committed
138
dnl Check for samplerate
139 140 141 142 143
dnl AC_CHECK_HEADER([samplerate.h], [
dnl  AC_CHECK_LIB(samplerate, src_simple, [with_samplerate=yes], [with_samplerate=no]) 
dnl  ], [ with_samplerate=no ]
dnl )
dnl AM_CONDITIONAL(USE_SAMPLERATE, test x$with_samplerate = xyes)
jpbl's avatar
jpbl committed
144

145 146
dnl Check for GNU ccRTP
PKG_PROG_PKG_CONFIG
147

148 149 150 151 152 153
LIBOSIP2_OSIPLISTNOPOINTER_MIN_VERSION=3.0.0
PKG_CHECK_MODULES([libosip2], [libosip2 >= ${LIBOSIP2_OSIPLISTNOPOINTER_MIN_VERSION}],
	[LIBOSIP2_CFLAGS=""], [LIBOSIP2_CFLAGS="-DLIBOSIP2_WITHPOINTER"])
SIP_CFLAGS="$SIP_CFLAGS $LIBOSIP2_CFLAGS";
AC_SUBST(SIP_CFLAGS)

yanmorin's avatar
yanmorin committed
154
LIBSAMPLERATE_MIN_VERSION=0.1.1
155 156 157 158
PKG_CHECK_MODULES(samplerate, samplerate >= ${LIBSAMPLERATE_MIN_VERSION})
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $samplerate_CFLAGS"
SFLPHONE_LIBS="$SFLPHONE_LIBS $samplerate_LIBS"

jpbl's avatar
jpbl committed
159 160
LIBCCGNU2_MIN_VERSION=1.3.1
PKG_CHECK_MODULES(libccgnu2, libccgnu2 >= ${LIBCCGNU2_MIN_VERSION})
161
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libccgnu2_CFLAGS"
jpbl's avatar
jpbl committed
162 163 164 165
SFLPHONE_LIBS="$SFLPHONE_LIBS $libccgnu2_LIBS"

LIBCCEXT2_MIN_VERSION=1.3.1
PKG_CHECK_MODULES(libccext2, libccext2 >= ${LIBCCEXT2_MIN_VERSION})
166
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libccext2_CFLAGS"
jpbl's avatar
jpbl committed
167 168 169 170
SFLPHONE_LIBS="$SFLPHONE_LIBS $libccext2_LIBS"

LIBCCRT_MIN_VERSION=1.3.0
PKG_CHECK_MODULES(libccrtp1, libccrtp1 >= ${LIBCCRT_MIN_VERSION})
171
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libccrtp1_CFLAGS"
jpbl's avatar
jpbl committed
172 173
SFLPHONE_LIBS="$SFLPHONE_LIBS $libccrtp1_LIBS"

174 175 176 177 178 179 180 181 182 183
LIBPORTAUDIO_MIN_VERSION=19
PKG_CHECK_MODULES(libportaudio, portaudio-2.0 >= ${LIBPORTAUDIO_MIN_VERSION})
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libportaudio_CFLAGS"
SFLPHONE_LIBS="$SFLPHONE_LIBS $libportaudio_LIBS"

LIBPORTAUDIOCPP_MIN_VERSION=12
PKG_CHECK_MODULES(libportaudiocpp, portaudiocpp >= ${LIBPORTAUDIOCPP_MIN_VERSION})
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libportaudiocpp_CFLAGS"
SFLPHONE_LIBS="$SFLPHONE_LIBS $libportaudiocpp_LIBS"

184 185 186 187 188
LIBDBUSCPP_MIN_VERSION=0.5
PKG_CHECK_MODULES(libdbuscpp, dbus-c++-1 >= ${LIBDBUSCPP_MIN_VERSION})
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libdbuscpp_CFLAGS"
SFLPHONE_LIBS="$SFLPHONE_LIBS $libdbuscpp_LIBS"

189
dnl Check for speex
190
AC_ARG_ENABLE(speex, 
191
  AS_HELP_STRING(
192 193 194 195 196 197
    [--enable-speex],
    [compile with speex codec @<:@default=no@:>@]
  ), 
  [with_speex=$enableval], 
  [with_speex=no]
)
jpbl's avatar
jpbl committed
198 199 200 201 202 203 204 205 206 207 208 209

if test "x$with_speex" = "xyes" ; then
  AC_CHECK_HEADER([speex/speex.h], [
    AC_CHECK_LIB(speex, speex_decode_int, 
     [
      with_speex=yes
     ], [ with_speex=no ]
    ) 
   ], [ with_speex=no ]
  )
fi
AM_CONDITIONAL(USE_SPEEX, test "x$with_speex" = "xyes" )
yanmorin's avatar
yanmorin committed
210

211
dnl Check for IAX
212
AC_ARG_ENABLE(iax2,
213
 AS_HELP_STRING(
214 215
   [--disable-iax2],
   [disable iax2 library support @<:@default=no@:>@]
216 217
 ),
 [with_iax2=$enableval],
218
 [with_iax2=yes]
219 220
)
AM_CONDITIONAL(USE_IAX, test x$with_iax2 = xyes)
jpbl's avatar
jpbl committed
221

222
dnl Check for readline
jpbl's avatar
jpbl committed
223
GNUPG_CHECK_READLINE
224

225
dnl Check for zeroconf (from apple)
226
AC_ARG_ENABLE(zeroconf, 
227
  AS_HELP_STRING(
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
    [--disable-zeroconf],
    [disables libdns_sd (browsing and publishing DNS-SD services will not be possible) @<:@default=no@:>@]
  ),  
  [without_zeroconf=$enableval], 
  [without_zeroconf="no"]
)
if test "x$without_zeroconf" = "xno"; then
  AC_MSG_CHECKING(for DNS-SD support)
  save_dnssdtest_LIBS="$LIBS"
  save_dnssdtest_LDFLAGS="$LDFLAGS"
  save_dnssdtest_CPPFLAGS="$CPPFLAGS"
  LDFLAGS="$all_libraries $LDFLAGS"
  CPPFLAGS="$CPPFLAGS $all_includes"
  case $host_os in
    darwin*) LIBS="" ;;
    *) LIBS="-ldns_sd" ;;
  esac
  have_libdns_sd="no"
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
  AC_LINK_IFELSE(
    [AC_LANG_SOURCE([[
        #include <dns_sd.h>
      ]], [[
        DNSServiceRefDeallocate( (DNSServiceRef) 0);
        TXTRecordDeallocate( (TXTRecordRef*) 0);
      ]])
    ],[
      AC_DEFINE(HAVE_DNSSD, 1, [Define if dns-sd is available])
      case $host_os in
        darwin*) LIB_DNSSD="" ;;
        *) LIB_DNSSD="-ldns_sd" ;;
      esac
      have_libdns_sd="yes"
      AC_MSG_RESULT(yes)
    ],[
      AC_MSG_RESULT(no)
      LIB_DNSSD=""
    ])
265 266 267
  CPPFLAGS=$save_dnssdtest_CPPFLAGS
  LDFLAGS=$save_dnssdtest_LDFLAGS
  LIBS=$save_dnssdtest_LIBS
jpbl's avatar
jpbl committed
268
fi
269 270
AC_SUBST(LIB_DNSSD)
AM_CONDITIONAL(USE_ZEROCONF, test "$have_libdns_sd" = "yes")	
jpbl's avatar
jpbl committed
271

272
dnl Datadir directory
jpbl's avatar
jpbl committed
273 274 275
sflphone_datadir=$datadir/sflphone
AC_SUBST(sflphone_datadir)

276
dnl QT interface
yanmorin's avatar
yanmorin committed
277 278
AC_MSG_CHECKING([whether to enable sflphoneqt])
AC_ARG_ENABLE(sflphoneqt,
279
   AS_HELP_STRING(
yanmorin's avatar
yanmorin committed
280 281 282 283 284 285 286 287 288 289 290 291
     [--disable-sflphoneqt],
     [disable sflphone-qt compilation @<:@default=no@:>@]
   ),
   [with_sflphoneqt=$enableval],
   [with_sflphoneqt=yes]
)
AM_CONDITIONAL(WITH_QT, test "x$with_sflphoneqt" = "xyes")
AM_CONDITIONAL(include_x11, test x$with_sflphoneqt = "xyes")
if test "x$with_sflphoneqt" = "xno"; then
  AC_MSG_RESULT(no)
else
  AC_MSG_RESULT(yes)
292
  gw_CHECK_QT
yanmorin's avatar
yanmorin committed
293
fi
jpbl's avatar
jpbl committed
294

295 296 297 298 299
# Go!
AC_SUBST(SFLPHONE_CFLAGS)
AC_SUBST(SFLPHONE_LIBS)
AC_OUTPUT
AC_MSG_NOTICE([[Configuration done! Run `make' to build the software.]])