]> sjero.net Git - linphone/blob - configure.ac
Aac-eld add missing header according to RFC3640 3.3.6
[linphone] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT([linphone],[3.5.99.0],[linphone-developers@nongnu.org])
4 AC_CANONICAL_SYSTEM
5 AC_CONFIG_SRCDIR([coreapi/linphonecore.c])
6
7 dnl Source packaging numbers
8
9 LINPHONE_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
10 LINPHONE_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
11 LINPHONE_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
12 LINPHONE_EXTRA_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f4)
13
14 dnl program extension
15 LINPHONE_VERSION=$LINPHONE_MAJOR_VERSION.$LINPHONE_MINOR_VERSION.${LINPHONE_MICRO_VERSION}
16 if test "$LINPHONE_EXTRA_VERSION" != "" ;then
17         LINPHONE_VERSION=$LINPHONE_VERSION.${LINPHONE_EXTRA_VERSION}
18 fi
19
20 LIBLINPHONE_SO_CURRENT=5 dnl increment this number when you add/change/remove an interface
21 LIBLINPHONE_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
22 LIBLINPHONE_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface
23
24 LIBLINPHONE_SO_VERSION=$LIBLINPHONE_SO_CURRENT:$LIBLINPHONE_SO_REVISION:$LIBLINPHONE_SO_AGE
25
26 AC_SUBST(LIBLINPHONE_SO_VERSION, $LIBLINPHONE_SO_VERSION)
27 AC_SUBST(LINPHONE_VERSION)
28
29 AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION           A full featured audio/video sip phone.])
30 AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
31
32 AM_INIT_AUTOMAKE
33 AC_SUBST([LIBTOOL_DEPS])
34 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
35 AC_SUBST([docdir], [${datadir}/doc])
36 AC_CONFIG_HEADERS(config.h)
37 AC_CONFIG_MACRO_DIR([m4])
38 AC_ISC_POSIX
39 AC_PROG_CC
40 AC_PROG_CXX
41 AC_C_INLINE
42 AC_HEADER_STDC
43 AM_PROG_CC_C_O
44 AC_CHECK_PROGS(MD5SUM,[md5sum md5])
45 AM_CONDITIONAL(HAVE_MD5SUM,test -n $MD5SUM)
46
47 case $target in
48         *mingw32ce)
49                 CFLAGS="$CFLAGS -D_WIN32_WCE -DORTP_STATIC -D_WIN32_WINNT=0x0501"
50                 CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501"
51                 LIBS="$LIBS -lws2 -liphlpapi"
52                 mingw_found=yes
53                 mingwce_found=yes
54         ;;
55         *mingw*)
56                 CFLAGS="$CFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501 "
57                 CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501"
58                 LIBS="$LIBS -lws2_32"
59                 GUI_FLAGS="-mwindows"
60                 CONSOLE_FLAGS="-mconsole"
61                 mingw_found=yes
62         ;;
63         armv6-apple-darwin|armv7-apple-darwin|i386-apple-darwin|armv7s-apple-darwin)
64                 CFLAGS="$CFLAGS -DTARGET_OS_IPHONE "
65                 build_tests=no
66                 ios_found=yes
67         ;;
68         x86_64-apple-darwin*|i686-apple-darwin*)
69                 MSPLUGINS_CFLAGS=""
70                 dnl use macport installation
71                 ACLOCAL_MACOS_FLAGS="-I /opt/local/share/aclocal"
72                 build_macos=yes
73         ;;
74
75 esac
76
77 AC_SUBST(ACLOCAL_MACOS_FLAGS)
78 AC_SUBST(CONSOLE_FLAGS)
79 AC_SUBST(GUI_FLAGS)
80
81 dnl localization tools
82 IT_PROG_INTLTOOL([0.40], [no-xml])
83
84 AM_CONDITIONAL(BUILD_TESTS,test x$build_tests != xno)
85
86 dnl Initialize libtool
87 LT_INIT([win32-dll shared disable-static])
88
89 dnl Enable library dependencies linking
90 AC_ARG_ENABLE(deplibs-link,
91         [AS_HELP_STRING([--disable-deplibs-link ], [Disable library dependencies linking (might break builds)])],
92         [enable_deplibs_linking="$enableval"],
93         [enable_deplibs_linking="yes"]
94 )
95 AC_MSG_NOTICE([Enable library dependencies linking: $enable_interlib_deps])
96 if test "${enable_deplibs_linking}" == "yes"; then
97         link_all_deplibs=yes
98         link_all_deplibs_CXX=yes
99 else
100         link_all_deplibs=no
101         link_all_deplibs_CXX=no
102 fi
103
104 AC_CONFIG_COMMANDS([libtool-hacking],
105         [if test "$mingw_found" = "yes" ; then
106                 echo "Hacking libtool to work with mingw..."
107                 sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
108                 cp -f ./libtool.tmp ./libtool
109                 rm -f ./libtool.tmp
110         fi],
111         [mingw_found=$mingw_found]
112 )
113
114 dnl Add the languages which your application supports here.
115 PKG_PROG_PKG_CONFIG
116 ALL_LINGUAS="fr it de ja es pl cs nl sv pt_BR hu ru zh_CN nb_NO zh_TW he sr"
117 AC_SUBST(ALL_LINGUAS)
118 AC_DEFINE_UNQUOTED(LINPHONE_ALL_LANGS, "$ALL_LINGUAS", [All supported languages])
119
120 if test "$mingw_found" != "yes" ; then
121         dnl gettext macro does not work properly under mingw. And we want to use the one provided by GTK.
122         
123         dnl AM_GNU_GETTEXT pollutes CPPFLAGS: workaround this.
124         CPPFLAGS_save=$CPPFLAGS
125         AM_GNU_GETTEXT([external])
126         AC_SUBST(INTLLIBS)
127         CPPFLAGS=$CPPFLAGS_save
128         LIBS="$LIBS $LIBINTL"
129 else
130         AC_DEFINE(ENABLE_NLS,1,[Tells whether localisation is possible])
131         AC_DEFINE(HAVE_GETTEXT,1,[Tells wheter localisation is possible])
132         LIBS="$LIBS -lintl"
133 fi
134
135 GETTEXT_PACKAGE=linphone
136 AC_SUBST(GETTEXT_PACKAGE)
137 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext package name])
138 dnl AC_CHECK_LIB(intl,libintl_gettext)
139
140 AC_CHECK_FUNCS([get_current_dir_name strndup stpcpy] )
141
142 AC_ARG_ENABLE(x11,
143         [AS_HELP_STRING([--disable-x11], [Disable X11 support (default=no)])],
144         [case "${enableval}" in
145                 yes)    enable_x11=true ;;
146                 no)     enable_x11=false ;;
147                 *)      AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;;
148         esac],
149         [enable_x11=true]
150 )
151
152 dnl conditionnal build of console interface.
153 AC_ARG_ENABLE(console_ui,
154         [AS_HELP_STRING([--enable-console_ui=[yes/no]], [Turn on or off compilation of console interface (default=yes)])],
155         [case "${enableval}" in
156                 yes)    console_ui=true ;;
157                 no)     console_ui=false ;;
158                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-console_ui) ;;
159         esac],
160         [console_ui=true]
161 )
162
163 dnl conditionnal build of tools.
164 AC_ARG_ENABLE(tools,
165         [AS_HELP_STRING([--enable-tools=[yes/no]], [Turn on or off compilation of console interface (default=yes)])],
166         [case "${enableval}" in
167                 yes)    build_tools=true ;;
168                 no)     build_tools=false ;;
169                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;;
170         esac],
171         [build_tools=check]
172 )
173
174 dnl check for installed version of libupnp
175 AC_ARG_ENABLE(upnp,
176         [AS_HELP_STRING([--disable-upnp], [Disable uPnP support])],
177         [case "${enableval}" in
178                 yes)    build_upnp=true ;;
179                 no)     build_upnp=false ;;
180                 *)      AC_MSG_ERROR(bad value ${enableval} for --disable-upnp) ;;
181         esac],
182         [build_upnp=auto]
183 )
184
185 if test "$build_upnp" != "false" ; then
186         PKG_CHECK_MODULES([LIBUPNP], [libupnp], 
187                 [if  pkg-config --atleast-version=1.6 "libupnp < 1.7"; then
188                         build_upnp=true
189                 else
190                         AC_MSG_ERROR([libupnp >= 1.6 < 1.5 required.])
191                 fi],
192                 [if test "$build_upnp" == "true" ; then
193                         AC_MSG_ERROR([libupnp not found.])
194                 else
195                         build_upnp=false
196                 fi]
197         )
198
199 fi
200
201 AM_CONDITIONAL(BUILD_UPNP, test x$build_upnp != xfalse)
202 if test "$build_upnp" != "false" ; then
203         AC_DEFINE(BUILD_UPNP, 1, [Define if upnp enabled])
204 fi
205
206 dnl check libxml2 (needed for tools)
207 if test "$build_tools" != "false" ; then
208         PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],[],
209                 [if test "$build_tools" = "true" ; then
210                         AC_MSG_ERROR([Could not found libxml2, tools cannot be compiled.])
211                 else
212                         build_tools=false
213                 fi]
214         )
215 fi
216
217 AM_CONDITIONAL(BUILD_TOOLS, test x$build_tools != xfalse)
218 if test "$build_tools" != "false" ; then
219         build_tools=true
220         AC_DEFINE(BUILD_TOOLS, 1, [Define if tools enabled] ) 
221 fi
222
223 dnl conditionnal build of gtk interface.
224 AC_ARG_ENABLE(gtk_ui,
225         [AS_HELP_STRING([--enable-gtk_ui=[yes/no]], [Turn on or off compilation of gtk interface (default=yes)])],
226         [case "${enableval}" in
227                 yes)    gtk_ui=true ;;
228                 no)     gtk_ui=false ;;
229                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-gtk_ui) ;;
230         esac],
231         [gtk_ui=true]
232 )
233
234 if test "$gtk_ui" = "true" ; then
235         PKG_CHECK_MODULES(LIBGTK, gtk+-2.0 >= 2.18.0 gthread-2.0)
236         if test "$enable_x11" = "false" ; then
237                 PKG_CHECK_MODULES(LIBGTKMAC,[gtk-mac-integration >= 2.0.1])
238                 AC_DEFINE([HAVE_GTK_OSX],[1],[Defined when gtk osx is used])
239         fi
240 else
241         echo "GTK interface compilation is disabled."
242 fi
243
244 AC_ARG_ENABLE(notify,
245         [AS_HELP_STRING([--enable-notify=[yes/no]], [Enable libnotify support (default=yes)])],
246         [case "${enableval}" in
247                 yes)    notify=true ;;
248                 no)     notify=false ;;
249                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-notify) ;;
250         esac],
251         [notify=true]
252 )
253
254 dnl conditionnal build of the notify library
255 if test "$gtk_ui" = "true" ; then
256         if test "$notify" = "true"; then
257                 PKG_CHECK_MODULES([NOTIFY4], [libnotify >= 0.7.0 ], [found_notify4=yes], foo=bar)
258                 case "$found_notify4" in
259                         yes)
260                                 AC_SUBST(NOTIFY4_CFLAGS)
261                                 AC_SUBST(NOTIFY4_LIBS)
262                                 AC_DEFINE([HAVE_NOTIFY4],[1],[NOTIFY4 support])
263                 esac
264
265                 PKG_CHECK_MODULES([NOTIFY1], [libnotify < 0.7.0], [found_notify1=yes], foo=bar)
266                 case "$found_notify1" in
267                         yes)
268                                 AC_SUBST(NOTIFY1_CFLAGS)
269                                 AC_SUBST(NOTIFY1_LIBS)
270                                 AC_DEFINE([HAVE_NOTIFY1],[1],[NOTIFY1 support])
271                 esac
272         else
273                 NotifyNotification *n;
274                 echo "Libnotify support is disabled."
275         fi
276 fi
277
278 dnl os-specific problems not handled by existing macros.
279 case "$host_os" in
280         *freebsd*)
281                 LDFLAGS="$LDFLAGS -pthread"
282         ;;
283 esac
284
285 case "$host_cpu" in
286         *arm*)
287                 AC_DEFINE(__ARM__,1,[Defined if we are compiling for arm processor])
288                 use_arm_toolchain=yes
289         ;;
290 esac
291
292 AC_ARG_WITH(configdir,
293         [AS_HELP_STRING([--with-configdir], [Set a APPDATA subdir where linphone is supposed to find its config (windows only)])],
294         [ configdir=${withval}],[ configdir="Linphone" ])
295
296 AC_DEFINE_UNQUOTED(LINPHONE_CONFIG_DIR,"$configdir",[Windows appdata subdir where linphonerc can be found])
297
298 AC_ARG_ENABLE(relativeprefix,
299         [AS_HELP_STRING([--enable-relativeprefix], [Build a linphone that finds its resources relatively to the directory where it is installed])],
300         [case "${enableval}" in
301                 yes)    relativeprefix=yes ;;
302                 no)     relativeprefix=no ;;
303                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-relativeprefix) ;;
304         esac],
305         [relativeprefix=guess]
306 )
307
308 AC_ARG_ENABLE(date,
309         [AS_HELP_STRING([--enable-date], [Use build date in internal version number])],
310         [case "${enableval}" in
311                 yes)    use_date=yes ;;
312                 no)     use_date=no ;;
313                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-date) ;;
314         esac],
315         [use_date=no]
316 )
317
318 if test x$use_date =  xyes ; then
319         AC_DEFINE(USE_BUILDDATE_VERSION,1,[Tell whether date_version.h must be used])
320 fi
321
322
323 dnl enable ipv6 support
324 AC_ARG_ENABLE(ipv6,
325         [AS_HELP_STRING([--enable-ipv6], [Turn on ipv6 support])],
326         [case "${enableval}" in
327                 yes)    ipv6=true;;
328                 no)     ipv6=false;;
329                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
330         esac],
331         [ipv6=true]
332 )
333 IPV6_CFLAGS=
334 if test x$ipv6 = xtrue ; then
335         IPV6_CFLAGS=-DINET6
336 fi
337 AC_SUBST(IPV6_CFLAGS)
338
339 dnl enable timestamp support
340 AC_ARG_ENABLE(ntp-timestamp,
341         [AS_HELP_STRING([--enable-ntp-timestamp], [Turn on NTP timestamping on received packet])],
342         [case "${enableval}" in
343                 yes)    ntptimestamp=true;;
344                 no)     ntptimestamp=false;;
345                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-ntp-timestamp) ;;
346         esac],
347         [ntptimestamp=false]
348 )
349
350 AC_ARG_ENABLE(debug,
351         [AS_HELP_STRING([--enable-debug=[yes/no]], [Enables the display of traces showing the execution of the library. (default=yes)])],
352         [case "${enableval}" in
353                 yes)    debug_enabled=yes;;
354                 no)     debug_enabled=no;;
355                 *)      AC_MSG_ERROR("Bad value for --enable-debug");;
356         esac],
357         [debug_enabled=no]
358 )
359
360 dnl enable truespeech codec support
361 AC_ARG_ENABLE(truespeech,
362         [AS_HELP_STRING([--enable-truespeech], [Turn on TrueSpeech support (x86 only)])],
363         [case "${enableval}" in
364                 yes)    truespeech=true;;
365                 no)     truespeech=false;;
366                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-truespeech) ;;
367         esac],
368         [truespeech=false]
369 )
370 TRUESPEECH_CFLAGS=
371 if test x$truespeech = xtrue ; then
372         TRUESPEECH_CFLAGS=-DTRUESPEECH
373 fi
374 AC_SUBST(TRUESPEECH_CFLAGS)
375 AM_CONDITIONAL([BUILD_TRUESPEECH], [test x$truespeech = xtrue])
376
377 AC_ARG_ENABLE(nonstandard-gsm,
378         [AS_HELP_STRING([--enable-nonstandard-gsm], [Enable GSM codec at nonstandard rates (11025hz, 16000hz)])],
379         [case "${enableval}" in
380                 yes)
381                         exotic_gsm=yes
382                         AC_DEFINE(ENABLE_NONSTANDARD_GSM,1,[Defined when using gsm at nonstandard rates])
383                 ;;
384                 no)     exotic_gsm=no ;;
385                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-nonstandard-gsm) ;;
386         esac],
387         [exotic_gsm=no]
388 )
389
390
391 dnl support for RSVP (by Vincent Maury)
392 AC_ARG_ENABLE(rsvp,
393         [AS_HELP_STRING([--enable-rsvp], [Enable support for QoS reservations.])],
394         AC_DEFINE(VINCENT_MAURY_RSVP,1,[Tell whether RSVP support should be compiled.])
395 )
396
397 if test "x${prefix}" = "xNONE"; then
398         package_prefix=${ac_default_prefix}
399 else
400         package_prefix=${prefix}
401 fi
402
403 if test "$relativeprefix" = "guess" ; then
404         if test "$mingw_found" = "yes" ; then
405                 relativeprefix="yes"
406         fi
407 fi
408
409 if test "$relativeprefix" = "yes" ; then
410         dnl allow binaries to install everywhere
411         package_prefix="."
412 fi
413
414 dnl Set PACKAGE_LOCALE_DIR in config.h.
415 DATADIRNAME=share
416 AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${package_prefix}/${DATADIRNAME}/locale",[Defines the place where locales can be found])
417
418 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${package_prefix}/${DATADIRNAME}",[Defines the place where data are found])
419
420 dnl Set PACKAGE_SOUND_DIR in config.h.
421 AC_DEFINE_UNQUOTED(PACKAGE_SOUND_DIR, "${package_prefix}/${DATADIRNAME}/sounds/linphone",[Defines the place where linphone sounds are found])
422
423
424 dnl check if we have the getifaddrs() sytem call
425 AC_CHECK_FUNCS(getifaddrs)
426
427 dnl check for osip2
428 LP_CHECK_OSIP2
429
430 dnl conditionnal build for ssl
431 AC_ARG_ENABLE(ssl,
432         [AS_HELP_STRING([--enable-ssl], [Turn on ssl support compiling. Required for sip tls. (default=false)])],
433         [case "${enableval}" in
434                 yes)    build_ssl=true ;;
435                 no)     build_ssl=false ;;
436                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-ssl) ;;
437         esac],
438         [build_ssl=false]
439 )
440
441 if test "$build_ssl" = "true"; then
442         PKG_CHECK_MODULES(OPENSSL, libssl >= 0.9.8)
443 fi
444 dnl setup flags for exosip library
445 LP_SETUP_EXOSIP
446
447 if test "$console_ui" = "true" ; then
448         dnl check gnu readline
449         LP_CHECK_READLINE
450 else
451         echo "Console interface compilation is disabled."
452 fi
453
454 AC_WORDS_BIGENDIAN
455
456 AC_ARG_ENABLE([speex],
457         AS_HELP_STRING([--disable-speex], [Disable speex support]),
458         [],
459         [enable_speex=yes]
460 )
461 if test "x$enable_speex" = "xyes"; then
462         dnl normaly this should only by done by mediastreamer2/configure.ac
463         dnl but to workaround bugs when cross-compiling for arm-linux,
464         dnl we need to have SPEEX_LIBS defined
465         dnl Furthermore it is good to repeat here all mediastreamer2 toggles
466         dnl since top-level configure --help will not print them.
467         PKG_CHECK_MODULES(SPEEX, speex >= 1.1.6, build_speex=yes)
468 fi
469
470 dnl conditionnal build of video support
471 AC_ARG_ENABLE(video,
472         [AS_HELP_STRING([--enable-video], [Turn on video support compiling])],
473         [case "${enableval}" in
474                 yes)    video=true ;;
475                 no)     video=false ;;
476                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;;
477         esac],
478         [video=true]
479 )
480
481 AC_ARG_WITH(ffmpeg,
482         [AS_HELP_STRING([--with-ffmpeg], [Sets the installation prefix of ffmpeg, needed for video support. (default=/usr)])],
483         [ ffmpegdir=${withval}],
484         [ ffmpegdir=/usr ]
485 )
486
487 if test "$video" = "true"; then
488         
489         if test "$enable_x11" = "true"; then
490                 AC_CHECK_HEADERS(X11/Xlib.h)
491                 if test "$build_macos" = "yes"; then 
492                         X11_LIBS="-L/usr/X11/lib -lX11"
493                 else
494                         AC_CHECK_LIB(X11,XUnmapWindow, X11_LIBS="-lX11")
495                 fi
496                 AC_SUBST(X11_LIBS)
497         fi
498         AC_DEFINE(VIDEO_ENABLED,1,[defined if video support is available])
499 fi
500
501 AC_ARG_ENABLE(alsa,
502         [AS_HELP_STRING([--enable-alsa], [Turn on alsa native support compiling])],
503         [case "${enableval}" in
504                 yes)    alsa=true ;;
505                 no)     alsa=false ;;
506                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-alsa) ;;
507         esac],
508         [alsa=true]
509 )
510
511 AC_ARG_ENABLE(zrtp,
512         [AS_HELP_STRING([--enable-zrtp], [Turn on zrtp support])],
513         [case "${enableval}" in
514                 yes)    zrtp=true ;;
515                 no)     zrtp=false ;;
516                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-zrtp) ;;
517         esac],
518         [zrtp=false]
519 )
520
521
522 AC_ARG_ENABLE(portaudio,
523         [AS_HELP_STRING([--enable-portaudio], [Turn on portaudio native support compiling])],
524         [case "${enableval}" in
525                 yes)    portaudio=true ;;
526                 no)     portaudio=false ;;
527                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-portaudio) ;;
528         esac],
529         [portaudio=false]
530 )
531
532 dnl build console if required
533 AM_CONDITIONAL(BUILD_CONSOLE, test x$console_ui = xtrue)
534
535 dnl special things for arm-linux cross compilation toolchain
536 AM_CONDITIONAL(ARMBUILD, test x$use_arm_toolchain = xyes)
537
538 dnl compilation of gtk user interface
539 AM_CONDITIONAL(BUILD_GTK_UI, [test x$gtk_ui = xtrue ] )
540 AM_CONDITIONAL(BUILD_WIN32, test x$mingw_found = xyes )
541 AM_CONDITIONAL(BUILD_ZRTP, test x$zrtp = xtrue)
542
543 dnl check getenv
544 AH_TEMPLATE([HAVE_GETENV])
545 AC_CHECK_FUNC([getenv], AC_DEFINE([HAVE_GETENV], [1], [If present, the getenv function allows fim to read environment variables.]))
546
547 dnl
548 AC_MSG_CHECKING([for sighandler_t])
549 AC_TRY_COMPILE([#include <signal.h>],[sighandler_t *f;],
550 has_sighandler_t=yes,has_sighandler_t=no)
551 AC_MSG_RESULT($has_sighandler_t)
552 if test "$has_sighandler_t" = "yes" ; then
553         AC_DEFINE( HAVE_SIGHANDLER_T, 1, [Define if sighandler_t available] )
554 fi
555
556 AC_ARG_ENABLE(assistant,
557         [AS_HELP_STRING([--enable-assistant], [Turn on assistant compiling])],
558         [case "${enableval}" in
559                 yes)    build_wizard=true ;;
560                 no)     build_wizard=false ;;
561                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-assistant) ;;
562         esac],
563         [build_wizard=check]
564 )
565
566 dnl check libsoup (needed for wizard)
567 if test "$build_wizard" != "false" ; then
568         PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26],[],
569                 [if test "$build_wizard" = "true" ; then
570                         AC_MSG_ERROR([Could not found libsoup, assistant cannot be compiled.])
571                 else
572                         build_wizard=false
573                 fi]
574         )
575 fi
576 if test "$build_wizard" != "false" ; then
577         PKG_CHECK_MODULES(LIBGTKWIZARD, [gtk+-2.0 >= 2.22.0],[],
578                 [if test "$build_wizard" = "true" ; then
579                         AC_MSG_ERROR([gtk+-2.0 < 2.22.0, assistant cannot be compiled.])
580                 else
581                         build_wizard=false
582                 fi]
583         )
584 fi
585 AC_SUBST(LIBSOUP_CFLAGS)
586 AC_SUBST(LIBSOUP_LIBS)
587 AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard != xfalse)
588 if test "$build_wizard" != "false" ; then
589         build_wizard=true
590          AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] ) 
591 fi
592
593 AC_CHECK_HEADERS(libudev.h)
594 AC_CHECK_LIB(udev,udev_new)
595
596 ##################################################
597 # Stricter build options (after external packages)
598 ##################################################
599
600
601 AC_ARG_ENABLE(strict,
602         AC_HELP_STRING([--enable-strict], [Build with stricter options (gcc only) @<:@yes@:>@]),
603         [strictness="${enableval}"],
604         [strictness=yes]
605 )
606
607 STRICT_OPTIONS="-Wall "
608
609 if test "$strictness" = "yes" ; then
610         STRICT_OPTIONS="$STRICT_OPTIONS -Werror"
611         CFLAGS="$CFLAGS -fno-strict-aliasing"
612 fi
613
614 AC_SUBST(STRICT_OPTIONS)
615
616 top_srcdir=`dirname $0`
617
618 AC_ARG_ENABLE([external-mediastreamer],
619         [AS_HELP_STRING([--enable-external-mediastreamer],[Use external mediastreamer library])],,
620         [enable_external_mediastreamer=no]
621 )
622
623 AS_CASE($enable_external_mediastreamer,
624         [yes],
625         [PKG_CHECK_MODULES([MEDIASTREAMER], [mediastreamer])
626         MS2_VERSION=`$PKG_CONFIG --modversion mediastreamer`],
627         [no],
628         [AC_CONFIG_SUBDIRS( mediastreamer2 )
629         MEDIASTREAMER_DIR=${top_srcdir}/mediastreamer2
630         MEDIASTREAMER_CFLAGS="-I\$(top_srcdir)/mediastreamer2/include"
631         MEDIASTREAMER_LIBS="\$(top_builddir)/mediastreamer2/src/libmediastreamer_base.la \$(top_builddir)/mediastreamer2/src/libmediastreamer_voip.la"
632 dnl need to temporary change quotes to allow square brackets
633         changequote(<<, >>)
634         MS2_VERSION=`grep -e '^.C_INIT(' $MEDIASTREAMER_DIR/configure.ac | sed -e 's:\([^(]\+\)(\[mediastreamer\],\[\(.*\)\]):\2:g'`
635         changequote([, ])
636         MS2_DIR=mediastreamer2],
637         [AC_MSG_ERROR([bad value '${enable_external_mediastreamer}' for --enable-external-mediastreamer])]
638 )
639
640 AC_SUBST(MEDIASTREAMER_CFLAGS)
641 AC_SUBST(MEDIASTREAMER_LIBS)
642 AC_SUBST([MS2_VERSION])
643 AC_SUBST([MS2_DIR])
644
645
646
647 AC_ARG_ENABLE(tunnel,
648         [AS_HELP_STRING([--enable-tunnel=[yes/no]], [Turn on compilation of tunnel support (default=no)])],
649         [case "${enableval}" in
650                 yes)    enable_tunnel=true ;;
651                 no)     enable_tunnel=false ;;
652                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-tunnel) ;;
653         esac],
654         [enable_tunnel=false]
655 )
656 AM_CONDITIONAL(BUILD_TUNNEL, test x$enable_tunnel = xtrue)
657 if test x$enable_tunnel = xtrue; then
658         PKG_CHECK_MODULES(TUNNEL, tunnel >= 0.3.3)
659         TUNNEL_CFLAGS+="-DTUNNEL_ENABLED"
660         AC_SUBST(TUNNEL_CFLAGS)
661         AC_SUBST(TUNNEL_LIBS)
662 fi
663
664 AC_ARG_ENABLE(msg-storage,
665         [AS_HELP_STRING([--enable-msg-storage=[yes/no]], [Turn on compilation of message storage (default=auto)])],
666         [case "${enableval}" in
667                 yes)    enable_msg_storage=true ;;
668                 no)     enable_msg_storage=false ;;
669                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-msg-storage) ;;
670         esac],
671         [enable_msg_storage=auto]
672 )
673
674
675 AM_CONDITIONAL(BUILD_MSG_STORAGE, test x$enable_msg_storage = xtrue)
676 if test x$enable_msg_storage != xfalse; then
677         PKG_CHECK_MODULES(SQLITE3,[ sqlite3 >= 3.7.0],[
678                 SQLITE3_CFLAGS+="-DMSG_STORAGE_ENABLED"
679                 AC_SUBST(SQLITE3_CFLAGS)
680                 AC_SUBST(SQLITE3_LIBS)
681                 enable_msg_storage=true
682                 ],[
683                 if test x$enable_msg_storage = xtrue; then 
684                         AC_MSG_ERROR([sqlite3 required for message storage not found.])
685                 fi
686                 enable_msg_storage=false
687                 ] )
688         
689 fi
690
691
692 dnl check for db2html (docbook) to generate html user manual
693 AC_CHECK_PROG(have_sgmltools, sgmltools, yes, no)
694 AM_CONDITIONAL(ENABLE_MANUAL, test x$have_sgmltools$build_manual = xyesyes )
695
696 dnl for external use of linphone libs
697 LINPHONE_CFLAGS="-I${includedir} -I${includedir}/linphone"
698 LINPHONE_LIBS="-L${libdir} -llinphone"
699
700 if test x$mingw_found = xyes ; then
701         LINPHONE_LIBS="$LINPHONE_LIBS $OSIP_LIBS"
702 fi
703 AC_SUBST(LINPHONE_CFLAGS)
704 AC_SUBST(LINPHONE_LIBS)
705
706 AC_DEFINE_UNQUOTED(LINPHONE_VERSION, "$PACKAGE_VERSION", [Linphone\'s version number])
707
708 AC_DEFINE_UNQUOTED(LINPHONE_PLUGINS_DIR, "${package_prefix}/lib/liblinphone/plugins" ,[path of liblinphone plugins, not mediastreamer2 plugins])
709 LINPHONE_PLUGINS_DIR="${package_prefix}/lib/liblinphone/plugins"
710 AC_SUBST(LINPHONE_PLUGINS_DIR)
711
712 AC_ARG_ENABLE(external-ortp,
713         [AS_HELP_STRING([--enable-external-ortp], [Use external oRTP library])],
714         [case "${enableval}" in
715                 yes)    external_ortp=true ;;
716                 no)     external_ortp=false ;;
717                 *)      AC_MSG_ERROR(bad value ${enableval} for --enable-external-ortp) ;;
718         esac],
719         [external_ortp=false]
720 )
721
722 if test "$external_ortp" = 'true'; then
723         PKG_CHECK_MODULES([ORTP], [ortp])
724         ORTP_VERSION=`$PKG_CONFIG --modversion ortp`
725 else
726         AC_CONFIG_SUBDIRS( oRTP )
727         ORTP_CFLAGS="-I\$(top_srcdir)/oRTP/include"
728         ORTP_LIBS="\$(top_builddir)/oRTP/src/libortp.la"
729         if test x$ac_cv_c_bigendian = xyes ; then
730                 ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN"
731         fi
732         if test x$ntptimestamp = xtrue ; then
733                 ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_TIMESTAMP"
734         fi
735         ORTP_DIR=oRTP
736         changequote(<<, >>)
737         ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
738         changequote([, ])
739 fi
740 AC_SUBST(ORTP_CFLAGS)
741 AC_SUBST(ORTP_LIBS)
742 AC_SUBST([ORTP_VERSION])
743 AC_SUBST([ORTP_DIR])
744
745 AC_ARG_ENABLE(tests_enabled,
746         [AS_HELP_STRING([--disable-tests], [Disable compilation of tests])],
747         [case "${enableval}" in
748                 yes)    tests_enabled=true ;;
749                 no)     tests_enabled=false ;;
750                 *)      AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
751         esac],
752         [tests_enabled=false]
753 )
754 AM_CONDITIONAL(ENABLE_TESTS, test x$tests_enabled = xyes)
755
756
757
758 dnl ##################################################
759 dnl # Check for doxygen
760 dnl ##################################################
761
762 AC_PATH_PROG(DOXYGEN,doxygen,false)
763 AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
764
765
766 AC_CONFIG_FILES([ 
767         Makefile
768         build/Makefile
769         build/macos/Makefile
770         build/macos/Info-linphone.plist
771         m4/Makefile
772         po/Makefile.in
773         pixmaps/Makefile
774         coreapi/Makefile
775         coreapi/help/Makefile
776         coreapi/help/Doxyfile
777         gtk/Makefile
778         console/Makefile
779         share/Makefile
780         share/C/Makefile
781         share/fr/Makefile
782         share/it/Makefile
783         share/ja/Makefile
784         share/cs/Makefile
785         share/xml/Makefile
786         share/linphone.pc
787         share/linphone.desktop
788         scripts/Makefile
789         tools/Makefile
790         linphone.spec
791         linphone.iss
792 ])
793
794 AC_OUTPUT
795
796 echo "Linphone build configuration ended."
797 echo "Summary of build options:"
798 printf "* %-30s %s\n" "Video support"           $video
799 printf "* %-30s %s\n" "GTK interface"           $gtk_ui
800 printf "* %-30s %s\n" "Account assistant"       $build_wizard
801 printf "* %-30s %s\n" "Console interface"       $console_ui
802 printf "* %-30s %s\n" "Tools"                   $build_tools
803 printf "* %-30s %s\n" "Message storage"         $enable_msg_storage
804 printf "* %-30s %s\n" "zRTP encryption (GPLv3)" $zrtp
805 printf "* %-30s %s\n" "uPnP support"            $build_upnp
806
807 if test "$enable_tunnel" = "true" ; then
808         printf "* Tunnel support\t\ttrue\n"
809 fi
810
811 echo "Now type 'make' to compile, and then 'make install' as root to install it."