configure.ac 11.5 KB
Newer Older
1 2 3 4
dnl Copyright (C) 2005-2006 Nokia Corporation
dnl Contact: Pekka Pessi <pekka.pessi@nokia.com>
dnl Licensed under LGPL. See file COPYING.

5
dnl
Pekka Pessi's avatar
Pekka Pessi committed
6 7 8 9 10 11 12
dnl ref: http://www.gnu.org/software/autoconf/manual/autoconf.info.gz
dnl
AC_PREREQ(2.57)

dnl information on the package
dnl ---------------------------

13
dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
14
AC_INIT([sofia-sip], [1.13.35bc])
15
AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
16
AC_CONFIG_MACRO_DIR([m4])
17
AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.13])
18
dnl Includedir specific to this sofia version
19
AC_SUBST(include_sofiadir, '${includedir}/sofia-sip-1.13')
20
AC_SUBST(LIBVER_SOFIA_SIP_UA_CUR, [6])
21
AC_SUBST(LIBVER_SOFIA_SIP_UA_REV, [0])
22
AC_SUBST(LIBVER_SOFIA_SIP_UA_AGE, [6])
23
AC_SUBST(LIBVER_SOFIA_SIP_UA_SOVER, [0]) # CUR-AGE
24
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_CUR, [3])
25
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_REV, [0])
26
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_AGE, [0])
27
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_SOVER, [3]) # CUR-AGE
28

Pekka Pessi's avatar
Pekka Pessi committed
29
## calls AC_CANONICAL_ macros that are required by AM_INIT_AUTOMAKE
30
SAC_CANONICAL_SYSTEM_CACHE_CHECK
Pekka Pessi's avatar
Pekka Pessi committed
31 32 33

AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
34
AC_CONFIG_HEADERS([config.h])
Pekka Pessi's avatar
Pekka Pessi committed
35

36 37
### checks for programs
### -------------------
38
AC_LANG([C])
39
SAC_TOOL_CC
Pekka Pessi's avatar
Pekka Pessi committed
40
AC_GNU_SOURCE
Pekka Pessi's avatar
Pekka Pessi committed
41
AC_PROG_INSTALL
42 43 44 45

dnl -C cause file timestamp to be unchanged if file content hasn't changed.
INSTALL="$INSTALL -C"

Pekka Pessi's avatar
Pekka Pessi committed
46 47 48 49 50
AC_PROG_CPP
AC_CHECK_PROG(ETAGS, etags, etags, echo)
AC_CHECK_TOOL(AR, ar, ar)
AC_CHECK_TOOL(LD, ld, ld)
AC_PROG_LIBTOOL
Pekka Pessi's avatar
Pekka Pessi committed
51 52 53 54 55
AM_PROG_CC_C_O

SAC_CFLAGS
SAC_CHECK_COMPILATION_ENVIRONMENT
SAC_COVERAGE
Pekka Pessi's avatar
Pekka Pessi committed
56

57 58 59
SAC_ENABLE_NDEBUG
SAC_ENABLE_EXPENSIVE_CHECKS

60 61 62
dnl Add parameters for aclocal
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")

63 64
AC_ARG_WITH(doxygen,
[  --with-doxygen[[=CMD]]    use doxygen command CMD [[doxygen]]],[
65
case $with_doxygen in
66 67 68 69 70 71
yes ) doxygen=doxygen ;;
no ) doxygen=echo ;;
esac], doxygen=doxygen)

AC_CHECK_PROG([DOXYGEN], [doxygen], [$doxygen], [echo])
AM_CONDITIONAL([HAVE_DOXYGEN], [test $DOXYGEN != echo])
72

Michael Jerris's avatar
Michael Jerris committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
AC_DEFUN([AX_COMPILER_VENDOR],
[
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
 [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
  # note: don't check for gcc first since some other compilers define __GNUC__
  for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
    vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#if !($vencpp)
      thisisanerror;
#endif
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
  done
 ])
])

AX_COMPILER_VENDOR

91 92 93 94 95
SOFIA_PLAT_CFLAGS=
# openbsd seems to not define NULL as a void pointer, I blame standards by committee for this.
# This is a dirty hack, but shuts up all the warnings
case "$host" in
     *-openbsd*) SOFIA_PLAT_CFLAGS="-DNULL='((void *)0L)'";;
96
     *-darwin15*|*-darwin16*)
97 98
      LDFLAGS="$LDFLAGS -framework CoreFoundation -framework SystemConfiguration"
      SOFIA_CFLAGS="$SOFIA_CFLAGS -I/usr/local/include";;
99 100 101 102 103
     *) ;;
esac

AC_SUBST(SOFIA_PLAT_CFLAGS, $SOFIA_PLAT_CFLAGS)

Pekka Pessi's avatar
Pekka Pessi committed
104 105 106
### checks for libraries
### --------------------

Michael Jerris's avatar
Michael Jerris committed
107 108 109 110 111 112 113
#  Enable 64 bit build
AC_ARG_ENABLE(64,
[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])

if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
    if test "${enable_64}" = "yes"; then
        SOFIA_CFLAGS="$SOFIA_CFLAGS -m64"
114 115
        LDFLAGS="$LDFLAGS -m64 -Wl,-64"
        export PKG_CONFIG_PATH=/usr/lib/64/pkgconfig
Michael Jerris's avatar
Michael Jerris committed
116 117 118
    fi
fi

Pekka Pessi's avatar
Pekka Pessi committed
119 120 121 122
SAC_SOFIA_SU
SAC_OPENSSL
SAC_TPORT

123 124 125
dnl Check is used for testing
PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check="yes", have_check="no")
AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
126 127
if test x"$have_check" = "xyes"; then
   AC_DEFINE([HAVE_CHECK], 1, [Define to 1 if check library is available])
128
   SAC_NEW_TCASE_ADD_TEST
129
fi
130 131
AC_CHECK_HEADERS([fnmatch.h])

132 133 134 135 136 137
dnl dl is currently used only in testing
AC_CHECK_LIB([dl], [dlopen], [
   dnl Note: -ldl is not added to LIBS
   AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dl library is available])
])

138 139
### internal modules
### ----------------
140
AC_DEFINE([HAVE_SOFIA_SIP], 1, [Define to 1 always])
141
AC_DEFINE([HAVE_SOFIA_SRESOLV], 1, [Define to 1 if we use DNS library])
142
AC_DEFINE([HAVE_SOFIA_SMIME], 0, [Define to 1 if we use S/MIME library])
Pekka Pessi's avatar
Pekka Pessi committed
143

Pekka Pessi's avatar
Pekka Pessi committed
144
AC_ARG_ENABLE(stun,
145
[  --disable-stun          disable stun module (enabled)],
146
 , enable_stun=yes)
Pekka Pessi's avatar
Pekka Pessi committed
147 148 149 150 151

if test x$enable_stun = xno ; then
  AC_MSG_WARN([** STUN support disabled **])
elif test x${HAVE_OPENSSL} != x1 ; then
  dnl compile STUN only if OPENSSL is available
Martti Mela's avatar
Martti Mela committed
152
  AC_MSG_WARN([** TLS support for STUN disabled as OpenSSL headers and/or libraries were not found **])
153
  AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
154
else
155
  AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
156
fi
157 158 159
AM_CONDITIONAL([HAVE_STUN], [test "x$enable_stun" = xyes])

AC_ARG_ENABLE(nth,
160
[  --disable-nth           disable HTTP-related modules nth and http (enabled)],
161 162 163 164
 , enable_nth=yes)
AM_CONDITIONAL([HAVE_NTH], [test "x$enable_nth" = xyes])
if test x$enable_nth = xyes ; then
  AC_DEFINE([HAVE_SOFIA_NTH], 1, [Define to 1 if we use NTH library])
165
  AC_DEFINE([HAVE_SOFIA_HTTP], 1, [Define to 1 if we use HTTP parser library])
166
fi
167

168 169
dnl Disable NTLM support by default
AC_ARG_ENABLE(ntlm,
170
[  --enable-ntlm           enable NTLM support [[disabled]]],
171 172
 , enable_ntlm=no)

173
if test x$enable_ntlm = xyes ; then
174
  AC_DEFINE([HAVE_SOFIA_NTLM], 1, [Define to 1 if we use NTLM library])
175
fi
176
AM_CONDITIONAL([HAVE_NTLM], [test "x$enable_ntlm" = xyes])
177 178


179 180
AC_DEFINE([HAVE_SRTP], 0, [Define to 1 if we use SRTP])
AC_DEFINE([HAVE_UPNP], 0, [Define to 1 if we use UPnP])
Pekka Pessi's avatar
Pekka Pessi committed
181

182 183 184 185 186 187 188 189 190

AC_ARG_ENABLE(memleak_log,
[  --enable-memleak-log    enable logging of possible memory leaks [[disabled]]],
 , enable_memleak_log=no)

if test x$enable_memleak_log = xyes ; then
  AC_DEFINE([HAVE_MEMLEAK_LOG], 1, [Define to 1 for memory-leak-related logging])
fi

191 192 193 194 195
# Enable mdns
AC_ARG_ENABLE(mdns,
[AC_HELP_STRING([--enable-mdns],[build with mdns support])],[enable_mdns="yes"],[enable_mdns="no"])

if test x$enable_mdns = xyes ; then
196 197
  AC_SEARCH_LIBS([DNSServiceBrowse], [dns_sd], [
    AC_DEFINE([HAVE_MDNS], 1, [Define to 1 if dnssd library is available])
198 199 200
  ])
fi

201 202
### checks for header files
### -----------------------
203
AC_HEADER_STDC
Pekka Pessi's avatar
Pekka Pessi committed
204

Pekka Pessi's avatar
Pekka Pessi committed
205 206 207
### checks for declarations
### -----------------------

Pekka Pessi's avatar
Pekka Pessi committed
208 209 210 211
### checks for types
### ----------------

AC_TYPE_SIGNAL
Pekka Pessi's avatar
Pekka Pessi committed
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
AC_TYPE_LONGLONG

dnl
dnl Define HAVE_C99_FORMAT to 1 if the formatted IO functions (printf/scanf
dnl et.al.) support the C99 'size specifiers', namely ll, hh, j, z, t
dnl (representing long long int, char, intmax_t, size_t, ptrdiff_t). Some C
dnl compilers supported these specifiers prior to C99 as an extension.
dnl
AC_CACHE_CHECK([whether IO functions support C99 size specifiers],
[ac_cv_c_c99_format],[

ac_cv_c_c99_format=yes

AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[char buf[64];
 if (sprintf(buf, "%lld%hhd%jd%zd%td", (long long int)1, (char)2, (intmax_t)3, (size_t)4, (ptrdiff_t)5) != 5)
  exit(1);
 else if (strcmp(buf, "12345"))
  exit(2);]])],
 [ac_cv_c_c99_format=yes],
 [ac_cv_c_c99_format=no],
 [ac_cv_c_c99_format=yes])
])

if test $ac_cv_c_c99_format = yes; then
  AC_DEFINE([HAVE_C99_FORMAT], [1], [Define to 1 if printf supports C99 size specifiers])dnl

  AC_DEFINE([LLU], ["%llu"], [Format (%llu) for unsigned long long])dnl
  AC_DEFINE([LLI], ["%lli"], [Format (%lli) for long long])dnl
  AC_DEFINE([LLX], ["%llx"], [Format (%llx) for long long hex])dnl
  AC_DEFINE([MOD_ZD], ["%zd"], [Define printf() modifier for ssize_t])dnl
  AC_DEFINE([MOD_ZU], ["%zu"], [Define printf() modifier for size_t])dnl

else

AC_CACHE_CHECK([whether IO functions support size specifier for long long],
[ac_cv_c_ll_format],[

ac_cv_c_ll_format=yes

AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[char buf[64];
 if (sprintf(buf, "%lld", (long long int)1) != 1)
  exit(1);
 else if (strcmp(buf, "1"))
  exit(2);]])],
 [ac_cv_c_ll_format=yes],
 [ac_cv_c_ll_format=no],
 [ac_cv_c_ll_format=yes])
Pekka Pessi's avatar
Pekka Pessi committed
261
])
Pekka Pessi's avatar
Pekka Pessi committed
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289

if test $ac_cv_c_ll_format = yes; then
  AC_DEFINE([LLU], ["%llu"], [Format (%llu) for unsigned long long])dnl
  AC_DEFINE([LLI], ["%lli"], [Format (%lli) for long long])dnl
  AC_DEFINE([LLX], ["%llx"], [Format (%llx) for long long hex])dnl
else
  AC_MSG_ERROR("printf cannot handle 64-bit integers")
fi

AC_CACHE_CHECK([whether IO functions support size specifier for size_t],
[ac_cv_c_z_format],[

ac_cv_c_z_format=yes

AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[char buf[64];
 if (sprintf(buf, "%zd", (size_t)1) != 1)
  exit(1);
 else if (strcmp(buf, "1"))
  exit(2);]])],
 [ac_cv_c_z_format=yes],
 [ac_cv_c_z_format=no],
 [ac_cv_c_z_format=yes])
])

if test $ac_cv_c_z_format = yes; then
  AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
  AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
290
else
Pekka Pessi's avatar
Pekka Pessi committed
291 292 293 294
  dnl Cross fingers
  AC_MSG_WARN("printf cannot handle size_t, using long instead")
  AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
  AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
295
fi
Pekka Pessi's avatar
Pekka Pessi committed
296 297

fi
Pekka Pessi's avatar
Pekka Pessi committed
298

299 300
### checks for structures
### ---------------------
Pekka Pessi's avatar
Pekka Pessi committed
301

302 303
### checks for typedefs, structures, and compiler characteristics.
### --------------------------------------------------------------
Pekka Pessi's avatar
Pekka Pessi committed
304 305 306 307 308 309 310 311 312 313 314 315 316 317
AC_C_CONST
AC_C_INLINE
AC_C_INLINE_DEFINE
AC_C_BIGENDIAN

AC_C_VAR_FUNC
AC_C_MACRO_FUNCTION
AC_C_KEYWORD_STRUCT

AC_HEADER_TIME
AC_TYPE_SIZE_T

AC_SYS_SA_LEN

318 319
### checks for library functions
### ----------------------------
Pekka Pessi's avatar
Pekka Pessi committed
320

321 322
### checks for system services
### --------------------------
323 324

AC_DEV_URANDOM
Pekka Pessi's avatar
Pekka Pessi committed
325

326 327
### output
### ------
Pekka Pessi's avatar
Pekka Pessi committed
328 329 330

AC_CONFIG_FILES([
Makefile
Pekka Pessi's avatar
Pekka Pessi committed
331
packages/Makefile
332
packages/sofia-sip-ua.pc
333
packages/sofia-sip-ua-glib.pc
Pekka Pessi's avatar
Pekka Pessi committed
334 335
libsofia-sip-ua/Makefile
libsofia-sip-ua/bnf/Makefile
336
libsofia-sip-ua/bnf/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
337
libsofia-sip-ua/docs/Makefile
338
libsofia-sip-ua/docs/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
339 340
libsofia-sip-ua/docs/Doxyfile.version
libsofia-sip-ua/docs/sofia-footer.html
341
libsofia-sip-ua/features/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
342
libsofia-sip-ua/features/Makefile
343
libsofia-sip-ua/http/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
344
libsofia-sip-ua/http/Makefile
345
libsofia-sip-ua/ipt/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
346
libsofia-sip-ua/ipt/Makefile
347
libsofia-sip-ua/iptsec/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
348
libsofia-sip-ua/iptsec/Makefile
349
libsofia-sip-ua/msg/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
350
libsofia-sip-ua/msg/Makefile
351
libsofia-sip-ua/nea/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
352
libsofia-sip-ua/nea/Makefile
353
libsofia-sip-ua/nta/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
354
libsofia-sip-ua/nta/Makefile
355
libsofia-sip-ua/nth/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
356
libsofia-sip-ua/nth/Makefile
357
libsofia-sip-ua/nua/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
358
libsofia-sip-ua/nua/Makefile
359
libsofia-sip-ua/sdp/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
360
libsofia-sip-ua/sdp/Makefile
361
libsofia-sip-ua/sip/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
362
libsofia-sip-ua/sip/Makefile
363
libsofia-sip-ua/soa/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
364
libsofia-sip-ua/soa/Makefile
365
libsofia-sip-ua/sresolv/Doxyfile
366
libsofia-sip-ua/sresolv/Makefile
367
libsofia-sip-ua/stun/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
368
libsofia-sip-ua/stun/Makefile
369
libsofia-sip-ua/su/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
370
libsofia-sip-ua/su/Makefile
371
libsofia-sip-ua/tport/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
372
libsofia-sip-ua/tport/Makefile
373
libsofia-sip-ua/url/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
374
libsofia-sip-ua/url/Makefile
375
libsofia-sip-ua/features/sofia-sip/sofia_features.h
Pekka Pessi's avatar
Pekka Pessi committed
376
s2check/Makefile
377 378
libsofia-sip-ua-glib/Makefile
libsofia-sip-ua-glib/su-glib/Makefile
379
libsofia-sip-ua-glib/su-glib/Doxyfile
Pekka Pessi's avatar
Pekka Pessi committed
380
utils/Makefile
381
utils/Doxyfile
382
tests/Makefile
Pekka Pessi's avatar
Pekka Pessi committed
383
win32/Makefile
384
win32/config.h
385 386
open_c/Makefile
open_c/config.h
Pekka Pessi's avatar
Pekka Pessi committed
387 388
])

389 390 391
AC_CONFIG_COMMANDS([version],,[PACKAGE_VERSION=${PACKAGE_VERSION}])
AC_CONFIG_FILES([packages/sofia-sip-${PACKAGE_VERSION}.spec:packages/sofia-sip.spec.in])

Pekka Pessi's avatar
Pekka Pessi committed
392
AC_OUTPUT