Remove unused purple_protocol_override.
[pidgin-git.git] / meson.build
blob5b24393e35512356af460d417e61339114bc2c2d
1 # UPDATING VERSION NUMBERS FOR RELEASES
3 # The version number is:
4 #   <major>.<minor>.<micro><suffix>
6 # micro += 1
8 # If any functions have been added to libpurple, Pidgin, or Finch:
9 #   micro = 0
10 #   minor += 1
12 # If backwards compatibility has been broken in libpurple, Pidgin, or Finch:
13 #   micro = 0
14 #   minor = 0
15 #   major += 1
16 #   purple_soversion += 1
18 # suffix should be similar to one of the following:
19 #   For beta releases:          '-beta2'
20 #   For code under development: '-devel'
21 #   For production releases:    ''
23 project('pidgin', 'c',
24     version : '3.0.0-devel',
25     meson_version : '>=0.37.0')
26 purple_soversion = 20
28 parts = meson.project_version().split('-')
29 if parts.length() > 1
30   purple_version_suffix = parts[1]
31 else
32   purple_version_suffix = ''
33 endif
35 parts = parts[0].split('.')
36 purple_major_version = parts[0]
37 purple_minor_version = parts[1]
38 purple_micro_version = parts[2]
40 add_project_arguments('-DHAVE_CONFIG_H=1', language : 'c')
41 conf = configuration_data()
42 man_conf = configuration_data()
43 version_conf = configuration_data()
45 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
46 conf.set_quoted('PACKAGE', meson.project_name())
47 conf.set_quoted('PACKAGE_NAME', meson.project_name())
48 conf.set_quoted('VERSION', meson.project_version())
50 version_conf.set('PURPLE_MAJOR_VERSION', purple_major_version)
51 version_conf.set('PURPLE_MINOR_VERSION', purple_minor_version)
52 version_conf.set('PURPLE_MICRO_VERSION', purple_micro_version)
53 version_conf.set('PURPLE_VERSION', meson.project_version())
54 version_conf.set('PURPLE_API_VERSION', purple_soversion)
56 PURPLE_LIB_VERSION = '@0@.@1@.@2@'.format(purple_soversion,
57                                           purple_minor_version,
58                                           purple_micro_version)
60 package_revision = vcs_tag(
61     input : 'package_revision.h.in',
62     output : 'package_revision.h',
63     fallback : meson.project_version())
65 # For man pages.
66 man_conf.set('VERSION', meson.project_version())
67 man_conf.set('prefix', get_option('prefix'))
69 # Used for pkg-config files.
70 pkgconfig = import('pkgconfig')
72 sedpath = find_program('sed')
74 # Storing build arguments
75 if meson.version().version_compare('>=0.42.0')
76         meson.add_postconf_script('mkmesonconf.py')
77         conf.set('HAVE_MESON_CONFIG', true)
78 endif
80 # Checks for programs.
81 compiler = meson.get_compiler('c')
83 # Check for Sun compiler
84 SUNCC = compiler.compiles('void main() {__SUNPRO_C;};')
86 # Check for Win32
87 if host_machine.system() == 'windows'
88         windows = import('windows')
90         IS_WIN32 = true
91         ws2_32 = compiler.find_library('ws2_32')
92         dnsapi = compiler.find_library('dnsapi')
93         if build_machine.system() != 'windows'
94                 conf.set('IS_WIN32_CROSS_COMPILED', true)
95         endif
96         conf.set('WIN32_LEAN_AND_MEAN', true)
98         conf.set('LIBPIDGIN_DLL_NAMEW',
99             'L"libpidgin-@0@.dll"'.format(purple_soversion))
100 else
101         IS_WIN32 = false
102         ws2_32 = []
103         dnsapi = []
104 endif
106 # Checks for header files.
107 # AC_HEADER_SYS_WAIT:
108 conf.set('HAVE_SYS_WAIT_H', compiler.has_header('sys/wait.h'))
110 foreach h : ['fcntl.h', 'unistd.h', 'stdint.h']
111         if compiler.has_header(h)
112                 conf.set('HAVE_' + h.to_upper().underscorify(), true)
113         else
114                 error(h + ' is required.')
115         endif
116 endforeach
118 # Checks for typedefs, structures, and compiler characteristics.
119 time_t_size = compiler.sizeof('time_t',
120     prefix : '''
121 #include <stdio.h>
122 #include <time.h>
123 ''')
124 conf.set('SIZEOF_TIME_T', time_t_size)
126 conf.set('WORDS_BIGENDIAN', host_machine.endian() != 'little')
128 # Check for directories
129 if IS_WIN32
130         foreach dir : ['bin', 'lib', 'data', 'sysconf', 'locale']
131                 path = join_paths(get_option('prefix'), get_option(dir + 'dir'))
132                 conf.set_quoted('WIN32_FHS_@0@DIR'.format(dir.to_upper()), path)
133         endforeach
135         conf.set('PURPLE_LIBDIR',
136                  'wpurple_lib_dir("purple-@0@")'.format(purple_major_version))
137         conf.set('PIDGIN_LIBDIR',
138                  'wpurple_lib_dir("pidgin-@0@")'.format(purple_major_version))
139         conf.set('FINCH_LIBDIR',
140                  'wpurple_lib_dir("finch-@0@")'.format(purple_major_version))
142         conf.set('PURPLE_DATADIR', 'wpurple_data_dir()')
143         conf.set('PURPLE_SYSCONFDIR', 'wpurple_sysconf_dir()')
144         conf.set('PURPLE_LOCALEDIR', 'wpurple_locale_dir()')
145 else
146         foreach dir : ['data', 'sysconf', 'locale']
147                 path = join_paths(get_option('prefix'), get_option(dir + 'dir'))
148                 conf.set_quoted('PURPLE_@0@DIR'.format(dir.to_upper()), path)
149         endforeach
151         common_libdir = join_paths(get_option('prefix'), get_option('libdir'))
152         conf.set_quoted('PURPLE_LIBDIR',
153                         join_paths(common_libdir,
154                                    'purple-@0@'.format(purple_major_version)))
155         conf.set_quoted('PIDGIN_LIBDIR',
156                         join_paths(common_libdir,
157                                    'pidgin-@0@'.format(purple_major_version)))
158         conf.set_quoted('FINCH_LIBDIR',
159                         join_paths(common_libdir,
160                                    'finch-@0@'.format(purple_major_version)))
161 endif
163 abslibdir = join_paths(get_option('prefix'), get_option('libdir'))
164 PURPLE_PLUGINDIR = join_paths(abslibdir, 'purple-@0@'.format(purple_major_version))
165 conf.set_quoted('PURPLE_PLUGINDIR', PURPLE_PLUGINDIR)
166 PIDGIN_PLUGINDIR = join_paths(abslibdir, 'pidgin-@0@'.format(purple_major_version))
167 conf.set_quoted('PIDGIN_PLUGINDIR', PIDGIN_PLUGINDIR)
168 FINCH_PLUGINDIR = join_paths(abslibdir, 'finch-@0@'.format(purple_major_version))
169 conf.set_quoted('FINCH_PLUGINDIR', FINCH_PLUGINDIR)
171 # Check for inet_aton
172 if not IS_WIN32
173         if not compiler.has_function('inet_aton')
174                 if not compiler.has_function('inet_aton', args : '-lresolv')
175                         # FIXME: Someone needs to link with -lresolv if needed.
176                         error('inet_aton not found')
177                 endif
178         endif
179 endif
180 if compiler.has_function('gethostent', args : '-lnsl')
181         conf.set('HAVE_LIBNSL', true)
182 endif
183 if IS_WIN32
184         conf.set('HAVE_GETADDRINFO', true)
185         conf.set('HAVE_INET_NTOP', true)
186 else
187         if not compiler.has_function('socket')
188                 if not compiler.has_function('socket', args : '-lsocket')
189                         error('socket not found')
190                 endif
191         endif
192         # If all goes well, by this point the previous two checks will have
193         # pulled in -lsocket and -lnsl if we need them.
194         if compiler.has_function('getaddrinfo')
195                 conf.set('HAVE_GETADDRINFO', true)
196         else
197                 if compiler.has_function('getaddrinfo', args : '-lsocket -lnsl')
198                         conf.set('HAVE_GETADDRINFO', true)
199                         # FIXME: LIBS += declare_dependency(link_with : ['socket', 'nsl'])
200                 endif
201         endif
202         conf.set('HAVE_INET_NTOP',
203             compiler.has_function('inet_ntop'))
204 endif
205 conf.set('HAVE_GETIFADDRS',
206     compiler.has_function('getifaddrs'))
208 # Check for socklen_t (in Unix98)
209 if IS_WIN32
210         socket_header = 'ws2tcpip.h'
211 else
212         socket_header = 'sys/socket.h'
213 endif
214 if not compiler.has_header_symbol(socket_header, 'socklen_t')
215         code = '''
216 #include <sys/types.h>
217 #include <@0@>
218 int accept(int, struct sockaddr *, size_t *);
219 int main() {}
220 '''.format(socket_header)
221         if compiler.compiles(code, name : 'socklen_t is size_t')
222                 conf.set('socklen_t', 'size_t')
223         else
224                 conf.set('socklen_t', 'int')
225         endif
226 endif
228 # Some systems do not have sa_len field for struct sockaddr.
229 conf.set('HAVE_STRUCT_SOCKADDR_SA_LEN',
230     compiler.has_member('struct sockaddr', 'sa_len',
231         prefix : '#include <@0@>'.format(socket_header)))
233 # Check for v6-only sockets
234 if IS_WIN32
235         header = 'ws2tcpip.h'
236 else
237         header = 'netinet/in.h'
238 endif
239 conf.set('HAVE_IPV6_V6ONLY',
240     compiler.has_header_symbol(header, 'IPV6_V6ONLY'))
242 # Windows and Haiku do not use libm for the math functions, they are part
243 # of the C library
244 math = compiler.find_library('m')
246 # before gettexting, in case iconv matters
247 IOKIT = []
248 if host_machine.system() == 'darwin'
249         if compiler.has_header('CoreFoundation/CoreFoundation.h')
250                 if compiler.has_header('IOKit/IOKitLib.h')
251                         conf.set('HAVE_IOKIT', true)
252                         IOKIT = dependency('appleframeworks',
253                                            modules : ['IOKit', 'CoreFoundation'])
254                 endif
255         endif
257         if run_command('test', '-d', '/sw').returncode() == 0
258                 # FIXME: Not done...
259                 #CPPFLAGS="$CPPFLAGS -I/sw/include"
260                 #LDFLAGS="$LDFLAGS -L/sw/lib"
261         endif
262 endif
264 # #######################################################################
265 # # Disable creation and installation of translation files
266 # #######################################################################
268 INSTALL_I18N = get_option('nls')
270 if INSTALL_I18N
271         i18n = import('i18n')
273         subdir('po')
274 endif
276 # #######################################################################
277 # # Check for GLib 2.44 (required)
278 # #######################################################################
279 glib = dependency('glib-2.0', version : '>= 2.44.0')
280 gio = dependency('gio-2.0')
281 gobject = dependency('gobject-2.0')
282 gthread = dependency('gthread-2.0')
283 gnome = import('gnome')
285 if get_option('extraversion') != ''
286         DISPLAY_VERSION = '@0@-@1@'.format(meson.project_version(),
287                                            get_option('extraversion'))
288 else
289         DISPLAY_VERSION = meson.project_version()
290 endif
291 conf.set_quoted('DISPLAY_VERSION', DISPLAY_VERSION)
293 force_deps = not get_option('missing-dependencies')
295 # #######################################################################
296 # # Check for GTK+ 2.18 and other things used by the GTK UI
297 # #######################################################################
298 enable_gestures = get_option('gestures')
300 # #######################################################################
301 # Check Pidgin dependencies
302 # #######################################################################
303 if get_option('gtkui')
304         gtk = dependency('gtk+-3.0', version : '>= 3.18.0')
306         talkatu_dep = dependency('talkatu', version: '>=0.1.0', required : false)
307         if talkatu_dep.found()
308                 talkatu_gir = 'Talkatu-0.0'
309                 talkatu_include_directories = include_directories(
310                     join_paths(talkatu_dep.get_pkgconfig_variable('prefix'),
311                                'share/gir-1.0'))
312         else
313                 talkatu_proj = subproject('talkatu',
314                     default_options : [
315                         'doc=' + get_option('doc').to_string(),
316                         'gobject-introspection=' + get_option('introspection').to_string(),
317                         'nls=' + get_option('nls').to_string(),
318                     ]
319                 )
320                 talkatu_dep = talkatu_proj.get_variable('talkatu_dep')
321                 talkatu_gir = talkatu_proj.get_variable('talkatu_gir')[0]
322                 talkatu_include_directories = []
323         endif
324 endif   # GTK
326 ENABLE_GTK = get_option('gtkui')
329 #######################################################################
330 # Check if we should compile with X support
331 #######################################################################
332 with_x = get_option('x') and not IS_WIN32
334 if with_x
335         x11 = dependency('x11')
336         if x11.found()
337                 conf.set('HAVE_X11', true)
338         else
339                 with_x = false
340                 if force_deps
341                         error('''
342 X11 development headers not found.
343 Use -Dx=false if you do not need X11 support.
344 ''')
345                 endif
346         endif
347 else
348         x11 = []
349 endif
350 if not get_option('gtkui') or not with_x
351         enable_gestures = false
352 endif
354 #######################################################################
355 # Check for LibXML2 (required)
356 #######################################################################
357 libxml = dependency('libxml-2.0', version : '>= 2.6.0')
358 if libxml.version().version_compare('<2.6.18')
359         message('Versions of libxml2 < 2.6.18 may contain bugs that could cause XMPP messages to be discarded.')
360 endif
362 #######################################################################
363 # Check for JSON-GLib (required)
364 #######################################################################
366 json = dependency('json-glib-1.0', version : '>= 0.14.0')
368 #######################################################################
369 # Check for GStreamer
370 #######################################################################
372 enable_gst = get_option('gstreamer')
373 if enable_gst
374         gstreamer = dependency('gstreamer-1.0', required : force_deps)
375         if gstreamer.found()
376                 conf.set('USE_GSTREAMER', true)
377         else
378                 enable_gst = false
379         endif
380 else
381         gstreamer = []
382 endif
384 #######################################################################
385 # Check for GStreamer Video
386 #######################################################################
387 enable_gstvideo = enable_gst and get_option('gstreamer-video')
388 if enable_gstvideo
389         gstreamer_video = dependency('gstreamer-video-1.0',
390                                      required : false)
391         if gstreamer_video.found()
392                 conf.set('USE_GSTVIDEO', true)
393         else
394                 enable_gstvideo = false
395         endif
396 else
397         gstreamer_video = []
398 endif
400 #######################################################################
401 # Check for Farstream
402 #######################################################################
403 if get_option('farstream')
404         farstream = dependency('farstream-0.2', version : '>= 0.2.7',
405                                required : false)
406         enable_farstream = farstream.found()
407 else
408         farstream = []
409         enable_farstream = false
410 endif
412 #######################################################################
413 # Check for Voice and Video support
414 #######################################################################
415 if get_option('vv')
416         if enable_gst and enable_gstvideo and enable_farstream
417                 conf.set('USE_VV', true)
418                 enable_vv = true
419         else
420                 if force_deps
421                         error('''
422 Dependencies for voice/video were not met.
423 Install the necessary gstreamer and farstream packages first.
424 Or use -Dvv=false if you do not need voice/video support.
425                         ''')
426                 endif
427                 enable_vv = false
428         endif
429 else
430         enable_vv = false
431 endif
433 #######################################################################
434 # Check for Raw data streams support in Farstream
435 #######################################################################
436 if enable_vv
437         gstreamer_app = dependency('gstreamer-app-1.0',
438                                    required : false)
439         if gstreamer_app.found()
440                 conf.set('USE_GSTAPP', true)
441                 conf.set('HAVE_MEDIA_APPLICATION', true)
442         endif
443 else
444         gstreamer_app = []
445 endif
447 #######################################################################
448 # Check for Meanwhile headers (for Sametime)
449 #######################################################################
450 if get_option('meanwhile')
451         meanwhile = dependency('meanwhile', version : ['>= 1.0.0', '< 2.0.0'], required : force_deps)
452         gmime = dependency('gmime-3.0', version : '>= 3.0.0', required : force_deps)
453         enable_meanwhile = meanwhile.found() and gmime.found()
454 else
455         enable_meanwhile = false
456         meanwhile = []
457 endif
459 #######################################################################
460 # Check for Native Avahi headers (for Bonjour)
461 #######################################################################
463 enable_avahi = get_option('avahi')
464 avahi = []
465 if enable_avahi and IS_WIN32
466         # Just keep enabled.
467 elif enable_avahi
468         # Attempt to autodetect Avahi
469         avahi_client = dependency('avahi-client', required : false)
470         avahi_glib = dependency('avahi-glib', required : false)
471         if avahi_client.found() and avahi_glib.found()
472                 avahi = [avahi_client, avahi_glib]
473         else
474                 enable_avahi = false
475                 if force_deps
476                         error('''
477 avahi development package not found.
478 Use -Davahi=false if you do not need avahi (Bonjour) support.
479 ''')
480                 endif
481         endif
482 endif
485 #######################################################################
486 # Check for SILC client includes and libraries
487 #######################################################################
488 have_silc = false
489 if get_option('silc')
490         silc = dependency('silcclient', version : '>= 1.1', required : false)
491         if silc.found()
492                 have_silc = true
493                 # SILC Toolkit >= 1.0.1 has a new MIME API
494                 conf.set('HAVE_SILCMIME_H', true)
495         else
496                 if force_deps
497                         error('''
498 SILC development package not found.
499 Use -Dsilc=false if you do not need SILC support.
500 ''')
501                 endif
502         endif
503 endif
505 #######################################################################
506 # Check for Gadu-Gadu protocol library (libgadu)
507 #######################################################################
509 enable_libgadu = get_option('libgadu')
510 if enable_libgadu
511         libgadu = dependency('libgadu', version : '>= 1.12.0', required : false)
512         have_libgadu = libgadu.found()
514         if have_libgadu
515                 if not compiler.has_function('gg_is_gpl_compliant', dependencies : libgadu)
516                         have_libgadu = false
517                         message('''
518 libgadu is not compatible with the GPL when compiled with OpenSSL support.
520 To link against libgadu, please recompile it using:
521 ./configure --with-openssl=no
522 Then rerun this Meson build
523                         ''')
524                 endif
525         endif
527         if not have_libgadu and force_deps
528                 error('''
529 Libgadu development headers not found.
530 Use -Dlibgadu=false if you do not need GG (GaduGadu) support.
531 ''')
532         endif
533 else
534         have_libgadu = false
535 endif
538 DEFAULT_PRPLS = ['bonjour', 'facebook', 'gg', 'irc', 'jabber', 'novell',
539                  'oscar', 'sametime', 'silc', 'simple', 'zephyr']
540 ALL_PRPLS = DEFAULT_PRPLS + ['null']
542 dynamic_list = get_option('dynamic-prpls').split(',')
543 if dynamic_list == ['all']
544         dynamic_list = DEFAULT_PRPLS
545 endif
546 DYNAMIC_PRPLS = []
547 foreach prpl : dynamic_list
548         if prpl == ''
549                 # The list was empty; do nothing.
550         elif prpl == 'sametime' and not enable_meanwhile
551                 # Do nothing.
552         elif prpl == 'bonjour' and not enable_avahi
553                 # Do nothing.
554         elif prpl == 'silc' and not have_silc
555                 # Do nothing.
556         elif prpl == 'gg' and not have_libgadu
557                 # Do nothing.
558         elif prpl == 'zephyr' and IS_WIN32
559                 # Do nothing.
560         else
561                 DYNAMIC_PRPLS += [prpl]
562         endif
563 endforeach
565 DYNAMIC_BONJOUR = DYNAMIC_PRPLS.contains('bonjour')
566 DYNAMIC_FACEBOOK = DYNAMIC_PRPLS.contains('facebook')
567 DYNAMIC_GG  = DYNAMIC_PRPLS.contains('gg')
568 DYNAMIC_IRC = DYNAMIC_PRPLS.contains('irc')
569 DYNAMIC_JABBER = DYNAMIC_PRPLS.contains('jabber')
570 DYNAMIC_NOVELL = DYNAMIC_PRPLS.contains('novell')
571 DYNAMIC_NULL = DYNAMIC_PRPLS.contains('null')
572 DYNAMIC_OSCAR = DYNAMIC_PRPLS.contains('oscar') or DYNAMIC_PRPLS.contains('aim') or DYNAMIC_PRPLS.contains('icq')
573 DYNAMIC_SAMETIME = DYNAMIC_PRPLS.contains('sametime')
574 DYNAMIC_SILC = DYNAMIC_PRPLS.contains('silc')
575 DYNAMIC_SIMPLE = DYNAMIC_PRPLS.contains('simple')
576 DYNAMIC_ZEPHYR = DYNAMIC_PRPLS.contains('zephyr')
578 conf.set('HAVE_SYS_UTSNAME_H',
579     compiler.has_header('sys/utsname.h'))
580 conf.set('HAVE_UNAME',
581     compiler.has_function('uname'))
584 add_project_arguments(
585     '-DPURPLE_DISABLE_DEPRECATED',
586     '-DPIDGIN_DISABLE_DEPRECATED',
587     '-DFINCH_DISABLE_DEPRECATED',
588     '-DGNT_DISABLE_DEPRECATED',
589     language : 'c')
590 if get_option('buildtype') != 'plain' and compiler.get_id() == 'gcc'
591         # We enable -Wall later.
592         # If it's set after the warning CFLAGS in the compiler invocation, it counteracts the -Wno... flags.
593         # This leads to warnings we don't want.
594 #       CFLAGS=`echo $CFLAGS |$sedpath 's/-Wall//'`
596         # ENABLE WARNINGS SUPPORTED BY THE VERSION OF GCC IN USE
597         #
598         # Future Possibilities
599         #
600         # Consider adding -Wbad-function-cast.
601         #       This leads to spurious warnings using GPOINTER_TO_INT(), et al. directly on a function call.
602         #               We'd need an intermediate variable.
603         #
604         foreach newflag : [
605                         '-Waggregate-return',
606                         '-Wcast-align',
607                         '-Wdeclaration-after-statement',
608                         '-Wendif-labels',
609                         '-Werror-implicit-function-declaration',
610                         '-Wextra -Wno-unused-parameter',
611                         '-Wformat',
612                         '-Wformat-security',
613                         '-Werror=format-security',
614                         '-Winit-self',
615                         '-Wmissing-declarations',
616                         '-Wmissing-noreturn',
617                         '-Wmissing-prototypes',
618                         '-Wpointer-arith',
619                         '-Wfloat-equal',
620                         '-Wundef']
621                 if compiler.has_argument(newflag)
622                         add_project_arguments(newflag, language : 'c')
623                 endif
624         endforeach
626         if get_option('fortify')
627 #               AC_MSG_CHECKING(for FORTIFY_SOURCE support)
628 #               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <features.h>]], [[
629 #                       #if !(__GNUC_PREREQ (4, 1) \
630 #                               || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0)) \
631 #                               || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (3, 4) \
632 #                                       && __GNUC_MINOR__ == 4 \
633 #                                       && (__GNUC_PATCHLEVEL__ > 2 \
634 #                                               || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ >= 8))))
635 #                       #error No FORTIFY_SOURCE support
636 #                       #endif
637 #                               return 0;
638 #               ]])], [
639 #                       AC_MSG_RESULT(yes)
640 #                       DEBUG_CFLAGS='$DEBUG_CFLAGS -Wp,-D_FORTIFY_SOURCE=2'
641 #               ], [
642 #                       AC_MSG_RESULT(no)
643 #               ])
644         endif
645 endif
646 if get_option('buildtype') != 'plain' and SUNCC
647         add_project_arguments('-features=extensions', language : 'c')
648 endif
650 pidginpath = find_program('pidgin', required : false)
652 if get_option('glib-errors-trace')
653         if compiler.get_id() == 'clang'
654                 error('--enable-glib-errors-trace doesn\'t work with clang')
655         endif
656         conf.set('ENABLE_GLIBTRACE', true)
657         add_project_arguments('-rdynamic', language : 'c')
658 endif
660 #######################################################################
661 # Check for Unity and Messaging Menu
662 # Remove when Ubuntu 16.04 is EOL
663 #######################################################################
664 enable_unity = get_option('unity-integration')
665 if enable_unity
666         UNITY = [
667                 dependency('unity', version : '>= 6.8'),
668                 dependency('messaging-menu', version : '>= 12.10')
669         ]
670         conf.set('USES_MM_CHAT_SECTION', 'X-MessagingMenu-UsesChatSection=true')
671 else
672         conf.set('USES_MM_CHAT_SECTION', '')
673 endif
675 #######################################################################
676 # Check for Secret Service headers
677 #######################################################################
679 enable_secret_service = get_option('secret-service') and not IS_WIN32
680 if enable_secret_service
681         secretservice = dependency('libsecret-1', required : force_deps)
682         if secretservice.found()
683         else
684                 enable_secret_service = false
685         endif
686 endif
688 #######################################################################
689 # Check for KWallet headers
690 #######################################################################
692 enable_kwallet = get_option('kwallet') and not IS_WIN32
693 enable_kwallet = false
695 if enable_kwallet
696         # Ensure C++ compiler works
697         add_languages('cpp')
698         cxx_compiler = meson.get_compiler('cpp')
700         qt4 = dependency('qt4', modules : 'Core', required : force_deps)
701         enable_kwallet = qt4.found()
702 endif
704 if enable_kwallet
705 #       AC_MSG_CHECKING([for metaobject compiler])
706 #       MOC=`$PKG_CONFIG --variable=moc_location QtCore`
707 #       AC_SUBST(MOC)
708 #       AC_MSG_RESULT([$MOC])
710 #       KWALLET_CXXFLAGS=''
711 #       KWALLET_LIBS=''
712 #       if test -z '$with_kwallet_includes' || test -z '$with_kwallet_libs'; then
713 #               AC_CHECK_PROG(KDE4_CONFIG, kde4-config, kde4-config, no)
714 #               if test 'x$KDE4_CONFIG' = 'xno'; then
715 #                       enable_kwallet = false
716 #                       if test 'x$force_deps' = 'xyes'; then
717 #                               AC_MSG_ERROR([
718 #kde4-config not found. $KDE4_CONFIG
719 #Use -Dkwallet=false if you do not need KWallet support.
721 #                       fi
722 #               fi
723 #       fi
724 endif
726 if enable_kwallet
727 #       if test 'x$KDE4_CONFIG' != 'xno'; then
728 #               KWALLET_CXXFLAGS='$QT4_CFLAGS -I`$KDE4_CONFIG --path include`'
729 #       fi
730 #       CPPFLAGS='$CPPFLAGS $KWALLET_CXXFLAGS'
731 #       AC_CHECK_HEADER([kwallet.h], , [
732 #               enable_kwallet = false
733 #               if test 'x$force_deps' = 'xyes'; then
734 #                       AC_MSG_ERROR([
735 #KWallet development headers not found.
736 #Use -Dkwallet=false if you do not need KWallet support.
738 #               fi
740 endif
742 if enable_kwallet
743 #       AC_MSG_CHECKING([for KWallet libraries])
744 #       if test 'x$KDE4_CONFIG' != 'xno'; then
745 #               KWALLET_LIBS='-L`$KDE4_CONFIG --install lib`/kde4/devel -lkdeui'
746 #       else
747 #               KWALLET_LIBS='-lkdeui'
748 #       fi
749 #       KWALLET_LIBS='$KWALLET_LIBS'
750 #       LIBS='$LIBS $KWALLET_LIBS $QT4_LIBS'
751 #       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <kwallet.h>],
752 #               [KWallet::Wallet::LocalWallet();])], [AC_MSG_RESULT([yes])],
753 #               [
754 #                       AC_MSG_RESULT(no)
755 #                       enable_kwallet = false
756 #                       if test 'x$force_deps' = 'xyes'; then
757 #                               AC_MSG_ERROR([
758 #KWallet development libraries not found.
759 #Use -Dkwallet=false if you do not need KWallet support.
761 #                       fi
762 #               ])
763 endif
765 #######################################################################
766 # Check for GPlugin 0.28.0
767 #######################################################################
768 gplugin_dep = dependency('gplugin', version : '>= 0.28.0', required : false)
769 if gplugin_dep.found()
770         gplugin_gir = 'GPlugin-0.0'
771         gplugin_include_directories = include_directories(
772             join_paths(gplugin_dep.get_pkgconfig_variable('prefix'),
773                        'share/gir-1.0'))
774 else
775         gplugin_proj = subproject('gplugin',
776             default_options : [
777                 'doc=' + get_option('doc').to_string(),
778                 'gobject-introspection=' + get_option('introspection').to_string(),
779                 'nls=' + get_option('nls').to_string(),
780             ]
781         )
782         gplugin_dep = gplugin_proj.get_variable('gplugin_dep')
783         gplugin_gir = gplugin_proj.get_variable('gplugin_gir')[0]
784         gplugin_include_directories = []
785 endif
787 #######################################################################
788 # Check for GObject Introspection
789 #######################################################################
791 enable_introspection = get_option('introspection')
792 if enable_introspection
793         if dependency('gobject-introspection-1.0', version : '>= 1.30.0',
794                       required : force_deps).found()
795                 conf.set('ENABLE_INTROSPECTION', true)
796         else
797                 enable_introspection = false
798         endif
799 endif
801 if get_option('plugins')
802         PLUGINS = true
803 else
804         PLUGINS = false
805 endif
807 #######################################################################
808 # Check for Nettle (Crypto Library)
809 #######################################################################
811 enable_nettle = get_option('nettle')
813 if enable_nettle
814         nettle = dependency('nettle', version : '>= 3.0', required : false)
815         enable_nettle = nettle.found()
816         conf.set('HAVE_NETTLE', enable_nettle)
818         if not enable_nettle and force_deps
819                 error('''
820 Nettle development headers not found
821 Use -Dnettle=false if you do not need it.
822 ''')
823         endif
824 else
825         nettle = []
826 endif
828 #######################################################################
829 # Check for Cyrus-SASL (for xmpp/irc)
830 #######################################################################
831 foreach func : ['snprintf', 'connect']
832         conf.set('HAVE_' + func.to_upper(),
833             compiler.has_function(func))
834 endforeach
835 enable_cyrus_sasl = get_option('cyrus-sasl')
836 if enable_cyrus_sasl
837         sasl = dependency('libsasl2', version : '>= 2.0', required : false)
838         enable_cyrus_sasl = sasl.found()
839         conf.set('HAVE_CYRUS_SASL', enable_cyrus_sasl)
841         if not enable_cyrus_sasl and force_deps
842                 error('''
843 Cyrus SASL library not found
844 Use -Dcyrus-sasl=false if you do not need it.
845 ''')
846         endif
847 else
848         enable_cyrus_sasl = false
849         sasl = []
850 endif
852 #######################################################################
853 # Check for Kerberos (for Zephyr)
854 #######################################################################
855 conf.set('ZEPHYR_INT32', 'long')
856 #AC_SUBST(KRB4_CFLAGS)
857 #AC_SUBST(KRB4_LDFLAGS)
858 #AC_SUBST(KRB4_LIBS)
859 kerberos = get_option('krb4')
860 if kerberos
861         if kerberos != 'yes'
862 #               KRB4_CFLAGS='-I${kerberos}/include'
863 #               if test -d '$kerberos/include/kerberosIV' ; then
864 #                       KRB4_CFLAGS='$KRB4_CFLAGS -I${kerberos}/include/kerberosIV'
865 #               fi
866 #               KRB4_LDFLAGS='-L${kerberos}/lib'
867         elif run_command('test', '-d', '/usr/local/include/kerberosIV').returncode() == 0
868 #               KRB4_CFLAGS='-I/usr/local/include/kerberosIV'
869         elif run_command('test', '-d', '/usr/include/kerberosIV').returncode() == 0
870 #               KRB4_CFLAGS='-I/usr/include/kerberosIV'
871         endif
872         conf.set('ZEPHYR_USES_KERBEROS', true)
874 #       AC_CHECK_LIB(krb4, krb_rd_req,
875 #                       [KRB4_LIBS='-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err'],
876 #                       [AC_CHECK_LIB(krb, krb_rd_req,
877 #                               [KRB4_LIBS='-lkrb -ldes'],
878 #                               [AC_MSG_ERROR([Kerberos 4 libraries not found])],
879 #                               -ldes)],
880 #                       -ldes425 -lkrb5 -lk5crypto -lcom_err)
881 #       AC_CHECK_FUNCS(krb_set_key krb_rd_req krb_get_lrealm)
882 #       AC_CHECK_FUNCS(krb_get_err_text krb_log)
883         krb4 = []
884 endif
885 if not kerberos
886         krb4 = []
887 endif
889 #######################################################################
890 # Check for external libzephyr
891 #######################################################################
892 zephyr = get_option('zephyr')
893 if zephyr
894         ext_zephyr = dependency('zephyr', required : force_deps)
895         zephyr = ext_zephyr.found()
896 else
897         ext_zephyr = []
898 endif
899 EXTERNAL_LIBZEPHYR = zephyr
900 conf.set('LIBZEPHYR_EXT', EXTERNAL_LIBZEPHYR)
902 #AC_MSG_CHECKING(for me pot o' gold)
903 #AC_MSG_RESULT(no)
904 foreach func : ['gethostid', 'timegm']
905         conf.set('HAVE_' + func.to_upper(),
906             compiler.has_function(func))
907 endforeach
908 foreach header : 'paths.h sgtty.h sys/cdefs.h sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h sys/select.h sys/uio.h sys/utsname.h sys/wait.h termios.h'.split()
909         conf.set('HAVE_' + header.to_upper().underscorify(),
910             compiler.has_header(header))
911 endforeach
913 # sys/sysctl.h on OpenBSD 4.2 requires sys/param.h
914 # sys/sysctl.h on FreeBSD requires sys/types.h
915 have_sys_param_h = compiler.has_header('sys/param.h')
916 conf.set('HAVE_SYS_PARAM_H', have_sys_param_h)
917 prefix = '''
918 #include <sys/types.h>
920 if have_sys_param_h
921         prefix += '''
922 #include <sys/param.h>
924 endif
925 conf.set('HAVE_SYS_SYSCTL_H',
926     compiler.has_header('sys/sysctl.h', prefix : prefix))
927 conf.set('HAVE_SYS_SOCKET_H',
928     compiler.has_header('sys/socket.h'))
929 #AC_VAR_TIMEZONE_EXTERNALS
931 #######################################################################
932 # Disable pixmap installation
933 #######################################################################
934 INSTALL_PIXMAPS = get_option('pixmaps-install')
936 # check for gtk-doc
937 ENABLE_DOC = get_option('doc')
938 if ENABLE_DOC
939         if meson.version().version_compare('<0.41.2')
940                 if force_deps
941                         error('Meson 0.41.2 or newer is required to build documentation.')
942                 endif
943                 ENABLE_DOC = false
944         endif
945 endif
947 enable_debug = get_option('console-logging')
948 conf.set('DEBUG', enable_debug)
950 # So that config.h may be found.
951 toplevel_inc = include_directories('.')
953 subdir('libpurple')
954 subdir('share/sounds')
955 subdir('finch')
956 subdir('pidgin')
957 subdir('doc')
959 configure_file(output : 'config.h',
960     configuration : conf)
962 message('')
963 message('pidgin ' + meson.project_version())
965 message('')
966 message('Build GTK+ UI................. : ' + get_option('gtkui').to_string())
967 message('Build console UI.............. : ' + enable_consoleui.to_string())
968 message('Build for X11................. : ' + with_x.to_string())
969 message('')
970 message('Enable Gestures............... : ' + enable_gestures.to_string())
971 message('Protocols to build dynamically : @0@'.format(DYNAMIC_PRPLS))
972 message('')
973 message('Build with GStreamer support.. : ' + enable_gst.to_string())
974 message('Build with voice and video.... : ' + enable_vv.to_string())
975 message('Build with GNU Libidn......... : ' + get_option('idn').to_string())
976 message('Build with Nettle support..... : ' + enable_nettle.to_string())
977 message('Build with Cyrus SASL support. : ' + enable_cyrus_sasl.to_string())
978 message('Use kerberos 4 with zephyr.... : ' + kerberos.to_string())
979 message('Use external libzephyr........ : ' + zephyr.to_string())
980 message('Install pixmaps............... : ' + INSTALL_PIXMAPS.to_string())
981 message('Install translations.......... : ' + INSTALL_I18N.to_string())
982 message('Has you....................... : yes')
983 message('')
984 message('Build Unity integration plugin.: ' + enable_unity.to_string())
985 message('')
986 message('Build with KWallet............ : ' + enable_kwallet.to_string())
987 message('Build with Secret Service..... : ' + enable_secret_service.to_string())
988 message('')
989 message('Build plugins................. : ' + PLUGINS.to_string())
990 message('Enable Introspection...........: ' + enable_introspection.to_string())
991 message('')
992 message('Print debugging messages...... : ' + enable_debug.to_string())
993 message('Generate documentation........ : ' + ENABLE_DOC.to_string())
994 message('')
995 bindir = join_paths(get_option('prefix'), get_option('bindir'))
996 message('Pidgin will be installed in @0@.'.format(bindir))
997 if pidginpath.found()
998         message('Warning: You have an old copy of Pidgin at @0@.'.format(pidginpath.path()))
999 endif
1000 if not INSTALL_PIXMAPS
1001         message('')
1002         message('Warning: You have disabled the installation of pixmap data, but Pidgin')
1003         message('still requires installed pixmaps.  Be sure you know what you are doing.')
1004 endif
1005 if not INSTALL_I18N
1006         message('')
1007         message('Warning: You have disabled the building and installation of translation')
1008         message('data.  This will prevent building Pidgin desktop files.')
1009         message('Be sure you know what you are doing.')
1010 endif
1011 message('')
1012 message('configure complete, now type \'ninja\'')
1013 message('')