move kwallet to it's own directory and namespace the files
[pidgin-git.git] / meson.build
blobf219b46bbb5ec87d9513ba40cf7dc167c2fcce2f
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
694 if enable_kwallet
695         # Ensure C++ compiler works
696         add_languages('cpp')
697         cxx_compiler = meson.get_compiler('cpp')
698         add_project_arguments('-DHAVE_CONFIG_H=1', language : 'cpp')
700         qt5 = import('qt5')
702         qt5_dep = dependency('qt5', modules: ['Core'])
704         kwallet = dependency('KF5Wallet')
705 endif
707 #######################################################################
708 # Check for GPlugin 0.28.0
709 #######################################################################
710 gplugin_dep = dependency('gplugin', version : '>= 0.28.0', required : false)
711 if gplugin_dep.found()
712         gplugin_gir = 'GPlugin-0.0'
713         gplugin_include_directories = include_directories(
714             join_paths(gplugin_dep.get_pkgconfig_variable('prefix'),
715                        'share/gir-1.0'))
716 else
717         gplugin_proj = subproject('gplugin',
718             default_options : [
719                 'doc=' + get_option('doc').to_string(),
720                 'gobject-introspection=' + get_option('introspection').to_string(),
721                 'nls=' + get_option('nls').to_string(),
722             ]
723         )
724         gplugin_dep = gplugin_proj.get_variable('gplugin_dep')
725         gplugin_gir = gplugin_proj.get_variable('gplugin_gir')[0]
726         gplugin_include_directories = []
727 endif
729 #######################################################################
730 # Check for GObject Introspection
731 #######################################################################
733 enable_introspection = get_option('introspection')
734 if enable_introspection
735         if dependency('gobject-introspection-1.0', version : '>= 1.30.0',
736                       required : force_deps).found()
737                 conf.set('ENABLE_INTROSPECTION', true)
738         else
739                 enable_introspection = false
740         endif
741 endif
743 if get_option('plugins')
744         PLUGINS = true
745 else
746         PLUGINS = false
747 endif
749 #######################################################################
750 # Check for Nettle (Crypto Library)
751 #######################################################################
753 enable_nettle = get_option('nettle')
755 if enable_nettle
756         nettle = dependency('nettle', version : '>= 3.0', required : false)
757         enable_nettle = nettle.found()
758         conf.set('HAVE_NETTLE', enable_nettle)
760         if not enable_nettle and force_deps
761                 error('''
762 Nettle development headers not found
763 Use -Dnettle=false if you do not need it.
764 ''')
765         endif
766 else
767         nettle = []
768 endif
770 #######################################################################
771 # Check for Cyrus-SASL (for xmpp/irc)
772 #######################################################################
773 foreach func : ['snprintf', 'connect']
774         conf.set('HAVE_' + func.to_upper(),
775             compiler.has_function(func))
776 endforeach
777 enable_cyrus_sasl = get_option('cyrus-sasl')
778 if enable_cyrus_sasl
779         sasl = dependency('libsasl2', version : '>= 2.0', required : false)
780         enable_cyrus_sasl = sasl.found()
781         conf.set('HAVE_CYRUS_SASL', enable_cyrus_sasl)
783         if not enable_cyrus_sasl and force_deps
784                 error('''
785 Cyrus SASL library not found
786 Use -Dcyrus-sasl=false if you do not need it.
787 ''')
788         endif
789 else
790         enable_cyrus_sasl = false
791         sasl = []
792 endif
794 #######################################################################
795 # Check for Kerberos (for Zephyr)
796 #######################################################################
797 conf.set('ZEPHYR_INT32', 'long')
798 #AC_SUBST(KRB4_CFLAGS)
799 #AC_SUBST(KRB4_LDFLAGS)
800 #AC_SUBST(KRB4_LIBS)
801 kerberos = get_option('krb4')
802 if kerberos
803         if kerberos != 'yes'
804 #               KRB4_CFLAGS='-I${kerberos}/include'
805 #               if test -d '$kerberos/include/kerberosIV' ; then
806 #                       KRB4_CFLAGS='$KRB4_CFLAGS -I${kerberos}/include/kerberosIV'
807 #               fi
808 #               KRB4_LDFLAGS='-L${kerberos}/lib'
809         elif run_command('test', '-d', '/usr/local/include/kerberosIV').returncode() == 0
810 #               KRB4_CFLAGS='-I/usr/local/include/kerberosIV'
811         elif run_command('test', '-d', '/usr/include/kerberosIV').returncode() == 0
812 #               KRB4_CFLAGS='-I/usr/include/kerberosIV'
813         endif
814         conf.set('ZEPHYR_USES_KERBEROS', true)
816 #       AC_CHECK_LIB(krb4, krb_rd_req,
817 #                       [KRB4_LIBS='-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err'],
818 #                       [AC_CHECK_LIB(krb, krb_rd_req,
819 #                               [KRB4_LIBS='-lkrb -ldes'],
820 #                               [AC_MSG_ERROR([Kerberos 4 libraries not found])],
821 #                               -ldes)],
822 #                       -ldes425 -lkrb5 -lk5crypto -lcom_err)
823 #       AC_CHECK_FUNCS(krb_set_key krb_rd_req krb_get_lrealm)
824 #       AC_CHECK_FUNCS(krb_get_err_text krb_log)
825         krb4 = []
826 endif
827 if not kerberos
828         krb4 = []
829 endif
831 #######################################################################
832 # Check for external libzephyr
833 #######################################################################
834 zephyr = get_option('zephyr')
835 if zephyr
836         ext_zephyr = dependency('zephyr', required : force_deps)
837         zephyr = ext_zephyr.found()
838 else
839         ext_zephyr = []
840 endif
841 EXTERNAL_LIBZEPHYR = zephyr
842 conf.set('LIBZEPHYR_EXT', EXTERNAL_LIBZEPHYR)
844 #AC_MSG_CHECKING(for me pot o' gold)
845 #AC_MSG_RESULT(no)
846 foreach func : ['timegm']
847         conf.set('HAVE_' + func.to_upper(),
848             compiler.has_function(func))
849 endforeach
850 foreach header : 'sgtty.h sys/cdefs.h sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h sys/select.h sys/wait.h termios.h'.split()
851         conf.set('HAVE_' + header.to_upper().underscorify(),
852             compiler.has_header(header))
853 endforeach
855 # sys/sysctl.h on OpenBSD 4.2 requires sys/param.h
856 # sys/sysctl.h on FreeBSD requires sys/types.h
857 have_sys_param_h = compiler.has_header('sys/param.h')
858 conf.set('HAVE_SYS_PARAM_H', have_sys_param_h)
859 prefix = '''
860 #include <sys/types.h>
862 if have_sys_param_h
863         prefix += '''
864 #include <sys/param.h>
866 endif
867 conf.set('HAVE_SYS_SYSCTL_H',
868     compiler.has_header('sys/sysctl.h', prefix : prefix))
869 conf.set('HAVE_SYS_SOCKET_H',
870     compiler.has_header('sys/socket.h'))
871 #AC_VAR_TIMEZONE_EXTERNALS
873 #######################################################################
874 # Disable pixmap installation
875 #######################################################################
876 INSTALL_PIXMAPS = get_option('pixmaps-install')
878 # check for gtk-doc
879 ENABLE_DOC = get_option('doc')
880 if ENABLE_DOC
881         if meson.version().version_compare('<0.41.2')
882                 if force_deps
883                         error('Meson 0.41.2 or newer is required to build documentation.')
884                 endif
885                 ENABLE_DOC = false
886         endif
887 endif
889 enable_debug = get_option('console-logging')
890 conf.set('DEBUG', enable_debug)
892 # So that config.h may be found.
893 toplevel_inc = include_directories('.')
895 subdir('libpurple')
896 subdir('share/sounds')
897 subdir('finch')
898 subdir('pidgin')
899 subdir('doc')
901 configure_file(output : 'config.h',
902     configuration : conf)
904 message('')
905 message('pidgin ' + meson.project_version())
907 message('')
908 message('Build GTK+ UI................. : ' + get_option('gtkui').to_string())
909 message('Build console UI.............. : ' + enable_consoleui.to_string())
910 message('Build for X11................. : ' + with_x.to_string())
911 message('')
912 message('Enable Gestures............... : ' + enable_gestures.to_string())
913 message('Protocols to build dynamically : @0@'.format(DYNAMIC_PRPLS))
914 message('')
915 message('Build with GStreamer support.. : ' + enable_gst.to_string())
916 message('Build with voice and video.... : ' + enable_vv.to_string())
917 message('Build with GNU Libidn......... : ' + get_option('idn').to_string())
918 message('Build with Nettle support..... : ' + enable_nettle.to_string())
919 message('Build with Cyrus SASL support. : ' + enable_cyrus_sasl.to_string())
920 message('Use kerberos 4 with zephyr.... : ' + kerberos.to_string())
921 message('Use external libzephyr........ : ' + zephyr.to_string())
922 message('Install pixmaps............... : ' + INSTALL_PIXMAPS.to_string())
923 message('Install translations.......... : ' + INSTALL_I18N.to_string())
924 message('Has you....................... : yes')
925 message('')
926 message('Build Unity integration plugin.: ' + enable_unity.to_string())
927 message('')
928 message('Build with KWallet............ : ' + enable_kwallet.to_string())
929 message('Build with Secret Service..... : ' + enable_secret_service.to_string())
930 message('')
931 message('Build plugins................. : ' + PLUGINS.to_string())
932 message('Enable Introspection...........: ' + enable_introspection.to_string())
933 message('')
934 message('Print debugging messages...... : ' + enable_debug.to_string())
935 message('Generate documentation........ : ' + ENABLE_DOC.to_string())
936 message('')
937 bindir = join_paths(get_option('prefix'), get_option('bindir'))
938 message('Pidgin will be installed in @0@.'.format(bindir))
939 if pidginpath.found()
940         message('Warning: You have an old copy of Pidgin at @0@.'.format(pidginpath.path()))
941 endif
942 if not INSTALL_PIXMAPS
943         message('')
944         message('Warning: You have disabled the installation of pixmap data, but Pidgin')
945         message('still requires installed pixmaps.  Be sure you know what you are doing.')
946 endif
947 if not INSTALL_I18N
948         message('')
949         message('Warning: You have disabled the building and installation of translation')
950         message('data.  This will prevent building Pidgin desktop files.')
951         message('Be sure you know what you are doing.')
952 endif
953 message('')
954 message('configure complete, now type \'ninja\'')
955 message('')