Convert UI ops to PurpleBuddyListClass methods.
[pidgin-git.git] / meson.build
blob9f7148b787c781e0a4f29c1eae0f776c77c8b8aa
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.10.0')
306         webkit = dependency('webkitgtk-3.0', version : '>= 1.3.7')
308         talkatu_dep = dependency('talkatu', version: '>=0.1.0', required : false)
309         if talkatu_dep.found()
310                 talkatu_gir = 'Talkatu-0.0'
311                 talkatu_include_directories = include_directories(
312                     join_paths(talkatu_dep.get_pkgconfig_variable('prefix'),
313                                'share/gir-1.0'))
314         else
315                 talkatu_proj = subproject('talkatu',
316                     default_options : [
317                         'doc=' + get_option('doc').to_string(),
318                         'gobject-introspection=' + get_option('introspection').to_string(),
319                         'nls=' + get_option('nls').to_string(),
320                     ]
321                 )
322                 talkatu_dep = talkatu_proj.get_variable('talkatu_dep')
323                 talkatu_gir = talkatu_proj.get_variable('talkatu_gir')[0]
324                 talkatu_include_directories = []
325         endif
327         #######################################################################
328         # Check if we should compile with enchant support
329         #######################################################################
330         # We need enchant for spell checking dictionary enumeration,
331         # because webkit1 doesn't have this.
332         enable_enchant = get_option('enchant')
333         if enable_enchant
334                 enchant = dependency('enchant', required : force_deps)
335                 enable_enchant = enchant.found()
336                 conf.set('USE_ENCHANT', enable_enchant)
337         else
338                 enchant = []
339         endif
340 else    # GTK
341         enable_enchant = false
342 endif   # GTK
344 ENABLE_GTK = get_option('gtkui')
347 #######################################################################
348 # Check if we should compile with X support
349 #######################################################################
350 with_x = get_option('x') and not IS_WIN32
352 if with_x
353         x11 = dependency('x11')
354         if x11.found()
355                 conf.set('HAVE_X11', true)
356         else
357                 with_x = false
358                 if force_deps
359                         error('''
360 X11 development headers not found.
361 Use -Dx=false if you do not need X11 support.
362 ''')
363                 endif
364         endif
365 else
366         x11 = []
367 endif
368 if not get_option('gtkui') or not with_x
369         enable_gestures = false
370 endif
372 #######################################################################
373 # Check for LibXML2 (required)
374 #######################################################################
375 libxml = dependency('libxml-2.0', version : '>= 2.6.0')
376 if libxml.version().version_compare('<2.6.18')
377         message('Versions of libxml2 < 2.6.18 may contain bugs that could cause XMPP messages to be discarded.')
378 endif
380 #######################################################################
381 # Check for JSON-GLib (required)
382 #######################################################################
384 json = dependency('json-glib-1.0', version : '>= 0.14.0')
386 #######################################################################
387 # Check for GStreamer
388 #######################################################################
390 enable_gst = get_option('gstreamer')
391 if enable_gst
392         gstreamer = dependency('gstreamer-1.0', required : force_deps)
393         if gstreamer.found()
394                 conf.set('USE_GSTREAMER', true)
395         else
396                 enable_gst = false
397         endif
398 else
399         gstreamer = []
400 endif
402 #######################################################################
403 # Check for GStreamer Video
404 #######################################################################
405 enable_gstvideo = enable_gst and get_option('gstreamer-video')
406 if enable_gstvideo
407         gstreamer_video = dependency('gstreamer-video-1.0',
408                                      required : false)
409         if gstreamer_video.found()
410                 conf.set('USE_GSTVIDEO', true)
411         else
412                 enable_gstvideo = false
413         endif
414 else
415         gstreamer_video = []
416 endif
418 #######################################################################
419 # Check for Farstream
420 #######################################################################
421 if get_option('farstream')
422         farstream = dependency('farstream-0.2', version : '>= 0.2.7',
423                                required : false)
424         enable_farstream = farstream.found()
425 else
426         farstream = []
427         enable_farstream = false
428 endif
430 #######################################################################
431 # Check for Voice and Video support
432 #######################################################################
433 if get_option('vv')
434         if enable_gst and enable_gstvideo and enable_farstream
435                 conf.set('USE_VV', true)
436                 enable_vv = true
437         else
438                 if force_deps
439                         error('''
440 Dependencies for voice/video were not met.
441 Install the necessary gstreamer and farstream packages first.
442 Or use -Dvv=false if you do not need voice/video support.
443                         ''')
444                 endif
445                 enable_vv = false
446         endif
447 else
448         enable_vv = false
449 endif
451 #######################################################################
452 # Check for Raw data streams support in Farstream
453 #######################################################################
454 if enable_vv
455         gstreamer_app = dependency('gstreamer-app-1.0',
456                                    required : false)
457         if gstreamer_app.found()
458                 conf.set('USE_GSTAPP', true)
459                 conf.set('HAVE_MEDIA_APPLICATION', true)
460         endif
461 else
462         gstreamer_app = []
463 endif
465 #######################################################################
466 # Check for Meanwhile headers (for Sametime)
467 #######################################################################
468 if get_option('meanwhile')
469         meanwhile = dependency('meanwhile', version : ['>= 1.0.0', '< 2.0.0'], required : force_deps)
470         gmime = dependency('gmime-3.0', version : '>= 3.0.0', required : force_deps)
471         enable_meanwhile = meanwhile.found() and gmime.found()
472 else
473         enable_meanwhile = false
474         meanwhile = []
475 endif
477 #######################################################################
478 # Check for Native Avahi headers (for Bonjour)
479 #######################################################################
481 enable_avahi = get_option('avahi')
482 avahi = []
483 if enable_avahi and IS_WIN32
484         # Just keep enabled.
485 elif enable_avahi
486         # Attempt to autodetect Avahi
487         avahi_client = dependency('avahi-client', required : false)
488         avahi_glib = dependency('avahi-glib', required : false)
489         if avahi_client.found() and avahi_glib.found()
490                 avahi = [avahi_client, avahi_glib]
491         else
492                 enable_avahi = false
493                 if force_deps
494                         error('''
495 avahi development package not found.
496 Use -Davahi=false if you do not need avahi (Bonjour) support.
497 ''')
498                 endif
499         endif
500 endif
503 #######################################################################
504 # Check for SILC client includes and libraries
505 #######################################################################
506 have_silc = false
507 if get_option('silc')
508         silc = dependency('silcclient', version : '>= 1.1', required : false)
509         if silc.found()
510                 have_silc = true
511                 # SILC Toolkit >= 1.0.1 has a new MIME API
512                 conf.set('HAVE_SILCMIME_H', true)
513         else
514                 if force_deps
515                         error('''
516 SILC development package not found.
517 Use -Dsilc=false if you do not need SILC support.
518 ''')
519                 endif
520         endif
521 endif
523 #######################################################################
524 # Check for Gadu-Gadu protocol library (libgadu)
525 #######################################################################
527 enable_libgadu = get_option('libgadu')
528 if enable_libgadu
529         libgadu = dependency('libgadu', version : '>= 1.12.0', required : false)
530         have_libgadu = libgadu.found()
532         if have_libgadu
533                 if not compiler.has_function('gg_is_gpl_compliant', dependencies : libgadu)
534                         have_libgadu = false
535                         message('''
536 libgadu is not compatible with the GPL when compiled with OpenSSL support.
538 To link against libgadu, please recompile it using:
539 ./configure --with-openssl=no
540 Then rerun this Meson build
541                         ''')
542                 endif
543         endif
545         if not have_libgadu and force_deps
546                 error('''
547 Libgadu development headers not found.
548 Use -Dlibgadu=false if you do not need GG (GaduGadu) support.
549 ''')
550         endif
551 else
552         have_libgadu = false
553 endif
556 DEFAULT_PRPLS = ['bonjour', 'facebook', 'gg', 'irc', 'jabber', 'novell',
557                  'oscar', 'sametime', 'silc', 'simple', 'zephyr']
558 ALL_PRPLS = DEFAULT_PRPLS + ['null']
560 dynamic_list = get_option('dynamic-prpls').split(',')
561 if dynamic_list == ['all']
562         dynamic_list = DEFAULT_PRPLS
563 endif
564 DYNAMIC_PRPLS = []
565 foreach prpl : dynamic_list
566         if prpl == ''
567                 # The list was empty; do nothing.
568         elif prpl == 'sametime' and not enable_meanwhile
569                 # Do nothing.
570         elif prpl == 'bonjour' and not enable_avahi
571                 # Do nothing.
572         elif prpl == 'silc' and not have_silc
573                 # Do nothing.
574         elif prpl == 'gg' and not have_libgadu
575                 # Do nothing.
576         elif prpl == 'zephyr' and IS_WIN32
577                 # Do nothing.
578         else
579                 DYNAMIC_PRPLS += [prpl]
580         endif
581 endforeach
583 DYNAMIC_BONJOUR = DYNAMIC_PRPLS.contains('bonjour')
584 DYNAMIC_FACEBOOK = DYNAMIC_PRPLS.contains('facebook')
585 DYNAMIC_GG  = DYNAMIC_PRPLS.contains('gg')
586 DYNAMIC_IRC = DYNAMIC_PRPLS.contains('irc')
587 DYNAMIC_JABBER = DYNAMIC_PRPLS.contains('jabber')
588 DYNAMIC_NOVELL = DYNAMIC_PRPLS.contains('novell')
589 DYNAMIC_NULL = DYNAMIC_PRPLS.contains('null')
590 DYNAMIC_OSCAR = DYNAMIC_PRPLS.contains('oscar') or DYNAMIC_PRPLS.contains('aim') or DYNAMIC_PRPLS.contains('icq')
591 DYNAMIC_SAMETIME = DYNAMIC_PRPLS.contains('sametime')
592 DYNAMIC_SILC = DYNAMIC_PRPLS.contains('silc')
593 DYNAMIC_SIMPLE = DYNAMIC_PRPLS.contains('simple')
594 DYNAMIC_ZEPHYR = DYNAMIC_PRPLS.contains('zephyr')
596 conf.set('HAVE_SYS_UTSNAME_H',
597     compiler.has_header('sys/utsname.h'))
598 conf.set('HAVE_UNAME',
599     compiler.has_function('uname'))
602 add_project_arguments(
603     '-DPURPLE_DISABLE_DEPRECATED',
604     '-DPIDGIN_DISABLE_DEPRECATED',
605     '-DFINCH_DISABLE_DEPRECATED',
606     '-DGNT_DISABLE_DEPRECATED',
607     language : 'c')
608 if get_option('buildtype') != 'plain' and compiler.get_id() == 'gcc'
609         # We enable -Wall later.
610         # If it's set after the warning CFLAGS in the compiler invocation, it counteracts the -Wno... flags.
611         # This leads to warnings we don't want.
612 #       CFLAGS=`echo $CFLAGS |$sedpath 's/-Wall//'`
614         # ENABLE WARNINGS SUPPORTED BY THE VERSION OF GCC IN USE
615         #
616         # Future Possibilities
617         #
618         # Consider adding -Wbad-function-cast.
619         #       This leads to spurious warnings using GPOINTER_TO_INT(), et al. directly on a function call.
620         #               We'd need an intermediate variable.
621         #
622         foreach newflag : [
623                         '-Waggregate-return',
624                         '-Wcast-align',
625                         '-Wdeclaration-after-statement',
626                         '-Wendif-labels',
627                         '-Werror-implicit-function-declaration',
628                         '-Wextra -Wno-unused-parameter',
629                         '-Wformat',
630                         '-Wformat-security',
631                         '-Werror=format-security',
632                         '-Winit-self',
633                         '-Wmissing-declarations',
634                         '-Wmissing-noreturn',
635                         '-Wmissing-prototypes',
636                         '-Wpointer-arith',
637                         '-Wfloat-equal',
638                         '-Wundef']
639                 if compiler.has_argument(newflag)
640                         add_project_arguments(newflag, language : 'c')
641                 endif
642         endforeach
644         if get_option('fortify')
645 #               AC_MSG_CHECKING(for FORTIFY_SOURCE support)
646 #               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <features.h>]], [[
647 #                       #if !(__GNUC_PREREQ (4, 1) \
648 #                               || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0)) \
649 #                               || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (3, 4) \
650 #                                       && __GNUC_MINOR__ == 4 \
651 #                                       && (__GNUC_PATCHLEVEL__ > 2 \
652 #                                               || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ >= 8))))
653 #                       #error No FORTIFY_SOURCE support
654 #                       #endif
655 #                               return 0;
656 #               ]])], [
657 #                       AC_MSG_RESULT(yes)
658 #                       DEBUG_CFLAGS='$DEBUG_CFLAGS -Wp,-D_FORTIFY_SOURCE=2'
659 #               ], [
660 #                       AC_MSG_RESULT(no)
661 #               ])
662         endif
663 endif
664 if get_option('buildtype') != 'plain' and SUNCC
665         add_project_arguments('-features=extensions', language : 'c')
666 endif
668 pidginpath = find_program('pidgin', required : false)
670 if get_option('glib-errors-trace')
671         if compiler.get_id() == 'clang'
672                 error('--enable-glib-errors-trace doesn\'t work with clang')
673         endif
674         conf.set('ENABLE_GLIBTRACE', true)
675         add_project_arguments('-rdynamic', language : 'c')
676 endif
678 #######################################################################
679 # Check for Unity and Messaging Menu
680 # Remove when Ubuntu 16.04 is EOL
681 #######################################################################
682 enable_unity = get_option('unity-integration')
683 if enable_unity
684         UNITY = [
685                 dependency('unity', version : '>= 6.8'),
686                 dependency('messaging-menu', version : '>= 12.10')
687         ]
688         conf.set('USES_MM_CHAT_SECTION', 'X-MessagingMenu-UsesChatSection=true')
689 else
690         conf.set('USES_MM_CHAT_SECTION', '')
691 endif
693 #######################################################################
694 # Check for Secret Service headers
695 #######################################################################
697 enable_secret_service = get_option('secret-service') and not IS_WIN32
698 if enable_secret_service
699         secretservice = dependency('libsecret-1', required : force_deps)
700         if secretservice.found()
701         else
702                 enable_secret_service = false
703         endif
704 endif
706 #######################################################################
707 # Check for KWallet headers
708 #######################################################################
710 enable_kwallet = get_option('kwallet') and not IS_WIN32
711 enable_kwallet = false
713 if enable_kwallet
714         # Ensure C++ compiler works
715         add_languages('cpp')
716         cxx_compiler = meson.get_compiler('cpp')
718         qt4 = dependency('qt4', modules : 'Core', required : force_deps)
719         enable_kwallet = qt4.found()
720 endif
722 if enable_kwallet
723 #       AC_MSG_CHECKING([for metaobject compiler])
724 #       MOC=`$PKG_CONFIG --variable=moc_location QtCore`
725 #       AC_SUBST(MOC)
726 #       AC_MSG_RESULT([$MOC])
728 #       KWALLET_CXXFLAGS=''
729 #       KWALLET_LIBS=''
730 #       if test -z '$with_kwallet_includes' || test -z '$with_kwallet_libs'; then
731 #               AC_CHECK_PROG(KDE4_CONFIG, kde4-config, kde4-config, no)
732 #               if test 'x$KDE4_CONFIG' = 'xno'; then
733 #                       enable_kwallet = false
734 #                       if test 'x$force_deps' = 'xyes'; then
735 #                               AC_MSG_ERROR([
736 #kde4-config not found. $KDE4_CONFIG
737 #Use -Dkwallet=false if you do not need KWallet support.
739 #                       fi
740 #               fi
741 #       fi
742 endif
744 if enable_kwallet
745 #       if test 'x$KDE4_CONFIG' != 'xno'; then
746 #               KWALLET_CXXFLAGS='$QT4_CFLAGS -I`$KDE4_CONFIG --path include`'
747 #       fi
748 #       CPPFLAGS='$CPPFLAGS $KWALLET_CXXFLAGS'
749 #       AC_CHECK_HEADER([kwallet.h], , [
750 #               enable_kwallet = false
751 #               if test 'x$force_deps' = 'xyes'; then
752 #                       AC_MSG_ERROR([
753 #KWallet development headers not found.
754 #Use -Dkwallet=false if you do not need KWallet support.
756 #               fi
758 endif
760 if enable_kwallet
761 #       AC_MSG_CHECKING([for KWallet libraries])
762 #       if test 'x$KDE4_CONFIG' != 'xno'; then
763 #               KWALLET_LIBS='-L`$KDE4_CONFIG --install lib`/kde4/devel -lkdeui'
764 #       else
765 #               KWALLET_LIBS='-lkdeui'
766 #       fi
767 #       KWALLET_LIBS='$KWALLET_LIBS'
768 #       LIBS='$LIBS $KWALLET_LIBS $QT4_LIBS'
769 #       AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <kwallet.h>],
770 #               [KWallet::Wallet::LocalWallet();])], [AC_MSG_RESULT([yes])],
771 #               [
772 #                       AC_MSG_RESULT(no)
773 #                       enable_kwallet = false
774 #                       if test 'x$force_deps' = 'xyes'; then
775 #                               AC_MSG_ERROR([
776 #KWallet development libraries not found.
777 #Use -Dkwallet=false if you do not need KWallet support.
779 #                       fi
780 #               ])
781 endif
783 #######################################################################
784 # Check for GPlugin 0.28.0
785 #######################################################################
786 gplugin_dep = dependency('gplugin', version : '>= 0.28.0', required : false)
787 if gplugin_dep.found()
788         gplugin_gir = 'GPlugin-0.0'
789         gplugin_include_directories = include_directories(
790             join_paths(gplugin_dep.get_pkgconfig_variable('prefix'),
791                        'share/gir-1.0'))
792 else
793         gplugin_proj = subproject('gplugin',
794             default_options : [
795                 'doc=' + get_option('doc').to_string(),
796                 'gobject-introspection=' + get_option('introspection').to_string(),
797                 'nls=' + get_option('nls').to_string(),
798             ]
799         )
800         gplugin_dep = gplugin_proj.get_variable('gplugin_dep')
801         gplugin_gir = gplugin_proj.get_variable('gplugin_gir')[0]
802         gplugin_include_directories = []
803 endif
805 #######################################################################
806 # Check for GObject Introspection
807 #######################################################################
809 enable_introspection = get_option('introspection')
810 if enable_introspection
811         if dependency('gobject-introspection-1.0', version : '>= 1.30.0',
812                       required : force_deps).found()
813                 conf.set('ENABLE_INTROSPECTION', true)
814         else
815                 enable_introspection = false
816         endif
817 endif
819 if get_option('plugins')
820         PLUGINS = true
821 else
822         PLUGINS = false
823 endif
825 #######################################################################
826 # Check for Nettle (Crypto Library)
827 #######################################################################
829 enable_nettle = get_option('nettle')
831 if enable_nettle
832         nettle = dependency('nettle', version : '>= 3.0', required : false)
833         enable_nettle = nettle.found()
834         conf.set('HAVE_NETTLE', enable_nettle)
836         if not enable_nettle and force_deps
837                 error('''
838 Nettle development headers not found
839 Use -Dnettle=false if you do not need it.
840 ''')
841         endif
842 else
843         nettle = []
844 endif
846 #######################################################################
847 # Check for Cyrus-SASL (for xmpp/irc)
848 #######################################################################
849 foreach func : ['snprintf', 'connect']
850         conf.set('HAVE_' + func.to_upper(),
851             compiler.has_function(func))
852 endforeach
853 enable_cyrus_sasl = get_option('cyrus-sasl')
854 if enable_cyrus_sasl
855         sasl = dependency('libsasl2', version : '>= 2.0', required : false)
856         enable_cyrus_sasl = sasl.found()
857         conf.set('HAVE_CYRUS_SASL', enable_cyrus_sasl)
859         if not enable_cyrus_sasl and force_deps
860                 error('''
861 Cyrus SASL library not found
862 Use -Dcyrus-sasl=false if you do not need it.
863 ''')
864         endif
865 else
866         enable_cyrus_sasl = false
867         sasl = []
868 endif
870 #######################################################################
871 # Check for Kerberos (for Zephyr)
872 #######################################################################
873 conf.set('ZEPHYR_INT32', 'long')
874 #AC_SUBST(KRB4_CFLAGS)
875 #AC_SUBST(KRB4_LDFLAGS)
876 #AC_SUBST(KRB4_LIBS)
877 kerberos = get_option('krb4')
878 if kerberos
879         if kerberos != 'yes'
880 #               KRB4_CFLAGS='-I${kerberos}/include'
881 #               if test -d '$kerberos/include/kerberosIV' ; then
882 #                       KRB4_CFLAGS='$KRB4_CFLAGS -I${kerberos}/include/kerberosIV'
883 #               fi
884 #               KRB4_LDFLAGS='-L${kerberos}/lib'
885         elif run_command('test', '-d', '/usr/local/include/kerberosIV').returncode() == 0
886 #               KRB4_CFLAGS='-I/usr/local/include/kerberosIV'
887         elif run_command('test', '-d', '/usr/include/kerberosIV').returncode() == 0
888 #               KRB4_CFLAGS='-I/usr/include/kerberosIV'
889         endif
890         conf.set('ZEPHYR_USES_KERBEROS', true)
892 #       AC_CHECK_LIB(krb4, krb_rd_req,
893 #                       [KRB4_LIBS='-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err'],
894 #                       [AC_CHECK_LIB(krb, krb_rd_req,
895 #                               [KRB4_LIBS='-lkrb -ldes'],
896 #                               [AC_MSG_ERROR([Kerberos 4 libraries not found])],
897 #                               -ldes)],
898 #                       -ldes425 -lkrb5 -lk5crypto -lcom_err)
899 #       AC_CHECK_FUNCS(krb_set_key krb_rd_req krb_get_lrealm)
900 #       AC_CHECK_FUNCS(krb_get_err_text krb_log)
901         krb4 = []
902 endif
903 if not kerberos
904         krb4 = []
905 endif
907 #######################################################################
908 # Check for external libzephyr
909 #######################################################################
910 zephyr = get_option('zephyr')
911 if zephyr
912         ext_zephyr = dependency('zephyr', required : force_deps)
913         zephyr = ext_zephyr.found()
914 else
915         ext_zephyr = []
916 endif
917 EXTERNAL_LIBZEPHYR = zephyr
918 conf.set('LIBZEPHYR_EXT', EXTERNAL_LIBZEPHYR)
920 #AC_MSG_CHECKING(for me pot o' gold)
921 #AC_MSG_RESULT(no)
922 foreach func : ['gethostid', 'timegm']
923         conf.set('HAVE_' + func.to_upper(),
924             compiler.has_function(func))
925 endforeach
926 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()
927         conf.set('HAVE_' + header.to_upper().underscorify(),
928             compiler.has_header(header))
929 endforeach
931 # sys/sysctl.h on OpenBSD 4.2 requires sys/param.h
932 # sys/sysctl.h on FreeBSD requires sys/types.h
933 have_sys_param_h = compiler.has_header('sys/param.h')
934 conf.set('HAVE_SYS_PARAM_H', have_sys_param_h)
935 prefix = '''
936 #include <sys/types.h>
938 if have_sys_param_h
939         prefix += '''
940 #include <sys/param.h>
942 endif
943 conf.set('HAVE_SYS_SYSCTL_H',
944     compiler.has_header('sys/sysctl.h', prefix : prefix))
945 conf.set('HAVE_SYS_SOCKET_H',
946     compiler.has_header('sys/socket.h'))
947 #AC_VAR_TIMEZONE_EXTERNALS
949 #######################################################################
950 # Disable pixmap installation
951 #######################################################################
952 INSTALL_PIXMAPS = get_option('pixmaps-install')
954 # check for gtk-doc
955 ENABLE_DOC = get_option('doc')
956 if ENABLE_DOC
957         if meson.version().version_compare('<0.41.2')
958                 if force_deps
959                         error('Meson 0.41.2 or newer is required to build documentation.')
960                 endif
961                 ENABLE_DOC = false
962         endif
963 endif
965 enable_debug = get_option('console-logging')
966 conf.set('DEBUG', enable_debug)
968 # So that config.h may be found.
969 toplevel_inc = include_directories('.')
971 subdir('libpurple')
972 subdir('share/sounds')
973 subdir('finch')
974 subdir('pidgin')
975 subdir('doc')
977 configure_file(output : 'config.h',
978     configuration : conf)
980 message('')
981 message('pidgin ' + meson.project_version())
983 message('')
984 message('Build GTK+ UI................. : ' + get_option('gtkui').to_string())
985 message('Build console UI.............. : ' + enable_consoleui.to_string())
986 message('Build for X11................. : ' + with_x.to_string())
987 message('')
988 message('Enable Gestures............... : ' + enable_gestures.to_string())
989 message('Protocols to build dynamically : @0@'.format(DYNAMIC_PRPLS))
990 message('')
991 message('Build with GStreamer support.. : ' + enable_gst.to_string())
992 message('Build with voice and video.... : ' + enable_vv.to_string())
993 message('Build with GNU Libidn......... : ' + get_option('idn').to_string())
994 message('Build with Nettle support..... : ' + enable_nettle.to_string())
995 message('Build with Cyrus SASL support. : ' + enable_cyrus_sasl.to_string())
996 message('Use kerberos 4 with zephyr.... : ' + kerberos.to_string())
997 message('Use external libzephyr........ : ' + zephyr.to_string())
998 message('Install pixmaps............... : ' + INSTALL_PIXMAPS.to_string())
999 message('Install translations.......... : ' + INSTALL_I18N.to_string())
1000 message('Has you....................... : yes')
1001 message('')
1002 message('Build with Enchant support.... : ' + enable_enchant.to_string())
1003 message('Build Unity integration plugin.: ' + enable_unity.to_string())
1004 message('')
1005 message('Build with KWallet............ : ' + enable_kwallet.to_string())
1006 message('Build with Secret Service..... : ' + enable_secret_service.to_string())
1007 message('')
1008 message('Build plugins................. : ' + PLUGINS.to_string())
1009 message('Enable Introspection...........: ' + enable_introspection.to_string())
1010 message('')
1011 message('Print debugging messages...... : ' + enable_debug.to_string())
1012 message('Generate documentation........ : ' + ENABLE_DOC.to_string())
1013 message('')
1014 bindir = join_paths(get_option('prefix'), get_option('bindir'))
1015 message('Pidgin will be installed in @0@.'.format(bindir))
1016 if pidginpath.found()
1017         message('Warning: You have an old copy of Pidgin at @0@.'.format(pidginpath.path()))
1018 endif
1019 if not INSTALL_PIXMAPS
1020         message('')
1021         message('Warning: You have disabled the installation of pixmap data, but Pidgin')
1022         message('still requires installed pixmaps.  Be sure you know what you are doing.')
1023 endif
1024 if not INSTALL_I18N
1025         message('')
1026         message('Warning: You have disabled the building and installation of translation')
1027         message('data.  This will prevent building Pidgin desktop files.')
1028         message('Be sure you know what you are doing.')
1029 endif
1030 message('')
1031 message('configure complete, now type \'ninja\'')
1032 message('')