]> sjero.net Git - linphone/blob - configure.in
79aac9ebaeb9a105360f49737aece93381619240
[linphone] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT([linphone],[3.2.99.1],[linphone-developers@nongnu.org])
4 AC_CANONICAL_SYSTEM
5
6 dnl Source packaging numbers
7
8 LINPHONE_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
9 LINPHONE_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
10 LINPHONE_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
11 LINPHONE_EXTRA_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f4)
12
13 dnl program extension
14 LINPHONE_VERSION=$LINPHONE_MAJOR_VERSION.$LINPHONE_MINOR_VERSION.${LINPHONE_MICRO_VERSION}
15 if test "$LINPHONE_EXTRA_VERSION" != "" ;then
16         LINPHONE_VERSION=$LINPHONE_VERSION.${LINPHONE_EXTRA_VERSION}
17 fi
18 LIBLINPHONE_SO_VERSION=`expr $LINPHONE_MINOR_VERSION + $LINPHONE_MAJOR_VERSION`:$LINPHONE_MICRO_VERSION:$LINPHONE_MINOR_VERSION
19
20 AC_SUBST(LIBLINPHONE_SO_VERSION, $LIBLINPHONE_SO_VERSION)
21 AC_SUBST(LINPHONE_VERSION)
22
23 AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION           A full featured audio/video sip phone.])
24 AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
25
26 AM_INIT_AUTOMAKE([tar-ustar])
27 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
28 AC_CONFIG_HEADER(config.h)
29 AC_CONFIG_MACRO_DIR([m4])
30 AC_SUBST([mkdir_p])
31 AC_ISC_POSIX
32 AC_PROG_CC
33 AC_C_INLINE
34 AM_PROG_CC_STDC
35 AC_HEADER_STDC
36 AM_PROG_CC_C_O
37
38 case $target_os in
39         *mingw32ce)
40         CFLAGS="$CFLAGS -D_WIN32_WCE -DORTP_STATIC -D_WIN32_WINNT=0x0501"
41         CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501"
42         LIBS="$LIBS -lws2 -liphlpapi"
43                 mingw_found=yes
44                 mingwce_found=yes
45                 ;;
46         *mingw*)
47                 CFLAGS="$CFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501 "
48                 CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501"
49                 LIBS="$LIBS -lws2_32"
50                 GUI_FLAGS="-mwindows"
51                 CONSOLE_FLAGS="-mconsole"
52                 mingw_found=yes
53         ;;
54         *darwin*)
55                 dnl use macport installation
56                 ACLOCAL_MACOS_FLAGS="-I /opt/local/share/aclocal"
57         ;;
58 esac
59
60 AC_SUBST(ACLOCAL_MACOS_FLAGS)
61 AC_SUBST(CONSOLE_FLAGS)
62 AC_SUBST(GUI_FLAGS)
63
64 dnl localization tools
65 ifdef([IT_PROG_INTLTOOL],[IT_PROG_INTLTOOL],[AC_PROG_INTLTOOL])
66 dnl Initialize libtool
67 AC_LIBTOOL_WIN32_DLL
68 AC_PROG_LIBTOOL
69 AM_PROG_LIBTOOL
70 AC_ENABLE_SHARED(yes)
71 AC_ENABLE_STATIC(no)
72
73
74 AC_CONFIG_COMMANDS([libtool-hacking],[
75 if test "$mingw_found" = "yes" ; then
76         echo "Hacking libtool to work with mingw..."
77         sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
78         cp -f ./libtool.tmp ./libtool
79         rm -f ./libtool.tmp
80 fi
81 ],[mingw_found=$mingw_found])
82
83 dnl Add the languages which your application supports here.
84 PKG_PROG_PKG_CONFIG
85 ALL_LINGUAS="fr it de ja es pl cs nl sv pt_BR hu ru zh_CN"
86 AC_SUBST(ALL_LINGUAS)
87 AC_DEFINE_UNQUOTED(LINPHONE_ALL_LANGS, "$ALL_LINGUAS", [All supported languages])
88
89 if test "$mingw_found" != "yes" ; then
90 dnl gettext macro does not work properly under mingw.
91 AM_GNU_GETTEXT([external])
92 LIBS="$LIBS $LIBINTL"
93 else
94         if test "$mingwce_found" != "yes" ; then 
95                 AC_DEFINE(ENABLE_NLS,1,[Tells whether localisation is possible])
96                 AC_DEFINE(HAVE_GETTEXT,1,[Tells wheter localisation is possible])
97                 LIBS="$LIBS -L/usr/lib -lintl"
98         else
99                 dnl gettext macro does not work properly under mingw.
100                 AM_GNU_GETTEXT([external])
101                 LIBS="$LIBS $LIBINTL"
102         fi
103 fi
104
105 GETTEXT_PACKAGE=linphone
106 AC_SUBST(GETTEXT_PACKAGE)
107 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",[The name of the gettext package name])
108 AC_CHECK_LIB(intl,libintl_gettext)
109
110 AC_CHECK_FUNCS([get_current_dir_name strndup stpcpy] )
111
112 dnl conditionnal build of console interface.
113 AC_ARG_ENABLE(console_ui,
114       [  --enable-console_ui=[yes/no]    Turn on or off compilation of console interface [default=yes]],
115       [case "${enableval}" in
116         yes) console_ui=true ;;
117         no)  console_ui=false ;;
118         *) AC_MSG_ERROR(bad value ${enableval} for --enable-console_ui) ;;
119       esac],[console_ui=true])
120
121 dnl conditionnal build of gtk interface.
122 AC_ARG_ENABLE(gtk_ui,
123       [  --enable-gtk_ui=[yes/no]    Turn on or off compilation of gtk interface [default=yes]],
124       [case "${enableval}" in
125         yes) gtk_ui=true ;;
126         no)  gtk_ui=false ;;
127         *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk_ui) ;;
128       esac],[gtk_ui=true])
129
130
131 if test "$gtk_ui" = "true" ; then
132         PKG_CHECK_MODULES(LIBGTK, gtk+-2.0 >= 2.4.0 gthread-2.0)
133         PKG_CHECK_MODULES(LIBGLADE, libglade-2.0 >= 2.4.0)
134         AC_SUBST(LIBGTK_CFLAGS)
135         AC_SUBST(LIBGTK_LIBS)
136         AC_SUBST(LIBGLADE_CFLAGS)
137         AC_SUBST(LIBGLADE_LIBS)
138 else
139         echo "GTK interface compilation is disabled."
140 fi
141
142
143 dnl os-specific problems not handled by existing macros.
144 case "$host_os" in
145         *freebsd*)
146                 LDFLAGS="$LDFLAGS -pthread"
147                 ;;
148 esac
149
150 case "$host_cpu" in
151         *arm*)
152                 AC_DEFINE(__ARM__,1,[Defined if we are compiling for arm processor])
153                 use_arm_toolchain=yes
154                 ;;
155 esac
156
157 AC_ARG_WITH( configdir,
158       [  --with-configdir      Set a APPDATA subdir where linphone is supposed to find its config (windows only) ],
159       [ configdir=${withval}],[ configdir="Linphone" ])
160
161 AC_DEFINE_UNQUOTED(LINPHONE_CONFIG_DIR,"$configdir",[Windows appdata subdir where linphonerc can be found])
162
163 AC_ARG_ENABLE(manual,
164       [  --disable-manual    Do not attempt to build html linphone's user documentation],
165       [case "${enableval}" in
166         yes) build_manual=yes ;;
167         no)  build_manual=false ;;
168         *) AC_MSG_ERROR(bad value ${enableval} for --enable-manual) ;;
169       esac],[build_manual=yes])
170
171 AC_ARG_ENABLE(date,
172       [  --enable-date    Use build date in internal version number],
173       [case "${enableval}" in
174         yes) use_date=yes ;;
175         no)  use_date=no ;;
176         *) AC_MSG_ERROR(bad value ${enableval} for --enable-date) ;;
177       esac],[use_date=no])
178
179 if test x$use_date =  xyes ; then
180         AC_DEFINE(USE_BUILDDATE_VERSION,1,[Tell whether date_version.h must be used])
181 fi
182
183
184 dnl enable ipv6 support
185 AC_ARG_ENABLE(ipv6,
186       [  --enable-ipv6    Turn on ipv6 support],
187       [case "${enableval}" in
188         yes)  ipv6=true;;
189         no)   ipv6=false;;
190         *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
191       esac],[ipv6=true])
192 IPV6_CFLAGS=
193 if test x$ipv6 = xtrue ; then
194         IPV6_CFLAGS=-DINET6
195 fi
196 AC_SUBST(IPV6_CFLAGS)
197
198 dnl enable truespeech codec support
199 AC_ARG_ENABLE(truespeech,
200       [  --enable-truespeech    Turn on TrueSpeech support (x86 only)],
201       [case "${enableval}" in
202         yes)  truespeech=true;;
203         no)   truespeech=false;;
204         *) AC_MSG_ERROR(bad value ${enableval} for --enable-truespeech) ;;
205       esac],[truespeech=false])
206 TRUESPEECH_CFLAGS=
207 if test x$truespeech = xtrue ; then
208         TRUESPEECH_CFLAGS=-DTRUESPEECH
209 fi
210 AC_SUBST(TRUESPEECH_CFLAGS)
211 AM_CONDITIONAL([BUILD_TRUESPEECH], [test x$truespeech = xtrue])
212
213 AC_ARG_ENABLE(nonstandard-gsm,
214       [  --enable-nonstandard-gsm    Enable GSM codec at nonstandard rates (11025hz, 16000hz)],
215       [case "${enableval}" in
216         yes) exotic_gsm=yes
217         AC_DEFINE(ENABLE_NONSTANDARD_GSM,1,[Defined when using gsm at nonstandard rates])
218          ;;
219         no)  exotic_gsm=no ;;
220         *) AC_MSG_ERROR(bad value ${enableval} for --enable-nonstandard-gsm) ;;
221       esac],[exotic_gsm=no])
222
223
224 dnl support for RSVP (by Vincent Maury)
225 AC_ARG_ENABLE(rsvp,
226 [  --enable-rsvp           enable support for QoS reservations.],
227 AC_DEFINE(VINCENT_MAURY_RSVP,1,[Tell whether RSVP support
228 should be compiled.]) )
229
230 if test "x${prefix}" = "xNONE"; then
231         package_prefix=${ac_default_prefix}
232 else
233         package_prefix=${prefix}
234 fi
235
236 if test x$mingw_found = xyes ; then
237 dnl allow binaries to install everywhere
238 package_prefix="."
239 fi
240
241 dnl Set PACKAGE_LOCALE_DIR in config.h.
242 DATADIRNAME=share
243 AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${package_prefix}/${DATADIRNAME}/locale",[Defines the place where locales can be found])
244
245 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${package_prefix}/${DATADIRNAME}",[Defines the place where data are found])
246
247 dnl Set PACKAGE_SOUND_DIR in config.h.
248 AC_DEFINE_UNQUOTED(PACKAGE_SOUND_DIR, "${package_prefix}/${DATADIRNAME}/sounds/linphone",[Defines the place where linphone sounds are found])
249
250
251 dnl check if we have the getifaddrs() sytem call
252 AC_CHECK_FUNCS(getifaddrs)
253
254 dnl check for osip2
255 LP_CHECK_OSIP2
256
257 dnl setup flags for exosip library
258 LP_SETUP_EXOSIP
259
260 if test "$console_ui" = "true" ; then
261 dnl check gnu readline
262 LP_CHECK_READLINE
263 else
264 echo "Console interface compilation is disabled."
265 fi
266
267 AC_WORDS_BIGENDIAN
268
269 dnl normaly this should only by done by mediastreamer2/configure.ac
270 dnl but to workaround bugs when cross-compiling for arm-linux,
271 dnl we need to have SPEEX_LIBS defined
272 dnl Furthermore it is good to repeat here all mediastreamer2 toggles
273 dnl since top-level configure --help will not print them.
274
275 PKG_CHECK_MODULES(SPEEX, speex >= 1.1.6, build_speex=yes)
276 AC_SUBST(SPEEX_LIBS)
277
278 dnl conditionnal build of video support
279 AC_ARG_ENABLE(video,
280                 [  --enable-video    Turn on video support compiling],
281                 [case "${enableval}" in
282                 yes) video=true ;;
283                 no)  video=false ;;
284                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;;
285                 esac],[video=true])
286                 
287 AC_ARG_WITH( ffmpeg,
288                 [  --with-ffmpeg                Sets the installation prefix of ffmpeg, needed for video support. [default=/usr] ],
289                 [ ffmpegdir=${withval}],[ ffmpegdir=/usr ])
290
291 AC_ARG_WITH( sdl,
292                 [  --with-sdl           Sets the installation prefix of libSDL, needed for video support. [default=/usr] ],
293                 [ libsdldir=${withval}],[ libsdldir=/usr ])
294
295 if test "$video" = "true"; then
296         AC_DEFINE(VIDEO_ENABLED,1,[defined if video support is available])
297 fi
298
299 AC_ARG_ENABLE(alsa,
300       [  --enable-alsa    Turn on alsa native support compiling],
301       [case "${enableval}" in
302         yes) alsa=true ;;
303         no)  alsa=false ;;
304         *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsa) ;;
305       esac],[alsa=true])
306
307 AC_ARG_ENABLE(artsc,
308       [  --enable-artsc    Turn on artsc (kde) sound input/output (auto) ],
309       [case "${enableval}" in
310         yes) artsc=true ;;
311         no)  artsc=false ;;
312         *) AC_MSG_ERROR(bad value ${enableval} for --enable-artsc) ;;
313       esac],[artsc=false])
314
315 AC_ARG_ENABLE(portaudio,
316       [  --enable-portaudio    Turn on portaudio native support compiling],
317       [case "${enableval}" in
318         yes) portaudio=true ;;
319         no)  portaudio=false ;;
320         *) AC_MSG_ERROR(bad value ${enableval} for --enable-portaudio) ;;
321       esac],[portaudio=false])
322
323 dnl build console if required
324 AM_CONDITIONAL(BUILD_CONSOLE, test x$console_ui = xtrue)
325 dnl special things for arm-linux cross compilation toolchain
326 AM_CONDITIONAL(ARMBUILD, test x$use_arm_toolchain = xyes)
327 dnl compilation of gtk-glade user interface
328 AM_CONDITIONAL(BUILD_GLADE_UI, [test x$gtk_ui = xtrue ] )
329 AM_CONDITIONAL(BUILD_WIN32, test x$mingw_found = xyes )
330
331 dnl check getenv
332 AH_TEMPLATE([HAVE_GETENV])
333 AC_CHECK_FUNC([getenv], AC_DEFINE([HAVE_GETENV], [1], [If present, the getenv function allows fim to read environment variables.]))
334
335 dnl
336 AC_MSG_CHECKING([for sighandler_t])
337 AC_TRY_COMPILE([#include <signal.h>],[sighandler_t *f;],
338 has_sighandler_t=yes,has_sighandler_t=no)
339 AC_MSG_RESULT($has_sighandler_t)
340 if test "$has_sighandler_t" = "yes" ; then
341     AC_DEFINE( HAVE_SIGHANDLER_T, 1, [Define if sighandler_t available] )
342 fi
343
344 ##################################################
345 # Stricter build options (after external packages)
346 ##################################################
347
348
349 AC_ARG_ENABLE(strict,
350         AC_HELP_STRING([--enable-strict],
351                        [Build with stricter options (gcc only) @<:@yes@:>@]),[
352         strictness="${enableval}"],[strictness=yes]
353 )
354
355 if test "$GCC$strictness" = "yesyes" ; then
356         STRICT_OPTIONS="-Wall "
357         STRICT_OPTIONS="$STRICT_OPTIONS -Werror"
358         CFLAGS="$CFLAGS -fno-strict-aliasing"
359 fi
360
361 AC_SUBST(STRICT_OPTIONS)
362
363 AC_CONFIG_SUBDIRS( mediastreamer2 )
364
365 dnl check for db2html (docbook) to generate html user manual
366 AC_CHECK_PROG(have_sgmltools,sgmltools, yes, no)
367 AM_CONDITIONAL(ENABLE_MANUAL, test x$have_sgmltools$build_manual = xyesyes )
368
369 dnl for external use of linphone libs
370 LINPHONE_CFLAGS="-I${includedir} -I${includedir}/linphone  "
371 LINPHONE_LIBS="-L${libdir}  -llinphone"
372
373 if test x$mingw_found = xyes ; then
374         LINPHONE_LIBS="$LINPHONE_LIBS $OSIP_LIBS"
375 fi
376 AC_SUBST(LINPHONE_CFLAGS)
377 AC_SUBST(LINPHONE_LIBS)
378
379
380 AC_DEFINE_UNQUOTED(LINPHONE_VERSION,"$PACKAGE_VERSION",[Linphone's version number])
381
382 AC_DEFINE_UNQUOTED(LINPHONE_PLUGINS_DIR, "${package_prefix}/lib/liblinphone/plugins" ,[path of liblinphone plugins, not mediastreamer2 plugins])
383 LINPHONE_PLUGINS_DIR="${package_prefix}/lib/liblinphone/plugins"
384 AC_SUBST(LINPHONE_PLUGINS_DIR)
385
386 AC_ARG_ENABLE(external-ortp,
387       [  --enable-external-ortp    Use external oRTP library],
388       [case "${enableval}" in
389         yes) external_ortp=true ;;
390         no)  external_ortp=false ;;
391         *) AC_MSG_ERROR(bad value ${enableval} for --enable-external-ortp) ;;
392       esac],[external_ortp=false])
393
394 if test "$external_ortp" = 'true'; then
395         LP_CHECK_ORTP
396 else
397         AC_CONFIG_SUBDIRS( oRTP )
398         ORTP_CFLAGS="-I\$(top_srcdir)/oRTP/include"
399         ORTP_LIBS="\$(top_builddir)/oRTP/src/libortp.la"
400         if test x$ac_cv_c_bigendian = xyes ; then
401                 ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN"
402         fi
403 fi
404 AC_SUBST(ORTP_CFLAGS)
405 AC_SUBST(ORTP_LIBS)
406
407 AM_CONDITIONAL(EXTERNAL_ORTP, [test "$external_ortp" = 'true'])
408
409 dnl Packaging: Pick oRTP version from ${top_srcdir}/oRTP/configure.ac
410 dnl Feel free to propose an alternative & cleaner version...
411 top_srcdir=`dirname $0`
412 changequote(, )dnl
413 ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
414 MS2_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/mediastreamer2/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
415 changequote([, ])dnl
416 AC_SUBST([ORTP_VERSION])
417 AC_SUBST([MS2_VERSION])
418
419 dnl ##################################################
420 dnl # Check for doxygen
421 dnl ##################################################
422
423 AC_PATH_PROG(DOXYGEN,doxygen,false)
424 AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
425
426
427 AC_OUTPUT([ 
428 Makefile 
429 m4/Makefile
430 po/Makefile.in 
431 pixmaps/Makefile
432 coreapi/Makefile
433 coreapi/help/Makefile
434 coreapi/help/Doxyfile
435 coreapi/help/doxygen.dox
436 gtk-glade/Makefile
437 console/Makefile
438 share/Makefile
439 share/C/Makefile
440 share/fr/Makefile
441 share/it/Makefile
442 share/ja/Makefile
443 share/cs/Makefile
444 share/linphone.pc
445 scripts/Makefile
446 linphone.spec
447 linphone.iss
448 ])
449
450 echo "Linphone build configuration ended."
451
452 if test x$gtk_ui = xtrue ; then
453         echo "* GTK interface will be compiled."
454 fi
455 if test x$console_ui = xtrue ; then
456         echo "* Console interface will be compiled."
457 fi
458
459 echo "Now type 'make' to compile, and then 'make install' as root to install it."