[balsa] Initial meson build sysem support



commit 633ed475358221af6807c66dbf6c8a4eb5dbfba9
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Sep 12 23:25:58 2017 -0400

    Initial meson build sysem support

 doc/meson.build               |   65 ++++
 images/16x16/meson.build      |   34 ++
 images/24x24/meson.build      |   38 ++
 images/meson.build            |   24 ++
 images/mimetypes/meson.build  |   18 +
 libbalsa/imap/meson.build     |   74 ++++
 libbalsa/meson.build          |  181 +++++++++
 libinit_balsa/meson.build     |   29 ++
 libnetclient/meson.build      |   27 ++
 libnetclient/test/meson.build |   63 ++++
 meson.build                   |  823 +++++++++++++++++++++++++++++++++++++++++
 meson_options.txt             |  119 ++++++
 po/meson.build                |   10 +
 sounds/meson.build            |   14 +
 src/meson.build               |  129 +++++++
 ui/meson.build                |   12 +
 16 files changed, 1660 insertions(+), 0 deletions(-)
---
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..c07fbca
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,65 @@
+# doc/meson.build
+
+gnome = import('gnome')
+
+HELP_ID      = 'balsa'
+
+HELP_LINGUAS = [ 'cs', 'de', 'el', 'es', 'fr', 'sl' ]
+
+HELP_FILES   = [
+               'ab-conf.page',
+               'authors.page',
+               'common-tasks.page',
+               'folder-config.page',
+               'getting-started.page',
+               'glossary.page',
+               'identities.page',
+               'index.page',
+               'introduction.page',
+               'its-not-working.page',
+               'mbox-formats.page',
+               'preferences-address-books.page',
+               'preferences-display-options.page',
+               'preferences-mail-options.page',
+               'preferences-miscellaneous.page',
+               'preferences.page',
+              'preferences-spelling.page',
+               'preferences-startup.page',
+               'toolbar-prefs.page',
+               'win-composer.page',
+               'win-filters.page',
+               'win-main.page',
+               'win-message.page',
+               'win-run-filters.page',
+               'win-search.page',
+               ]
+
+HELP_EXTRA   = 'balsa.entities'
+
+HELP_MEDIA   = [
+             'figures/address-book-ldap.png',
+             'figures/address-book-modify.png',
+             'figures/address-book.png',
+             'figures/address-book-vcard.png',
+             'figures/balsa_logo.png',
+             'figures/druid-start.png',
+             'figures/example-alias.png',
+             'figures/figuresdobaaddress-book-modify.png',
+             'figures/main-window.png',
+             'figures/main-window-toolbar.png',
+             'figures/message-window.png',
+             'figures/msg-part-select.png',
+             'figures/newmsg-window-attachments.png',
+             'figures/newmsg-window.png',
+             'figures/newmsg-window-toolbar.png',
+             'figures/preferences-window.png',
+             'figures/spell-check.png',
+              ]
+
+files = [HELP_EXTRA]
+files += HELP_FILES
+
+gnome.yelp(HELP_ID,
+           sources   : files,
+           media     : HELP_MEDIA,
+           languages : HELP_LINGUAS)
diff --git a/images/16x16/meson.build b/images/16x16/meson.build
new file mode 100644
index 0000000..c05c616
--- /dev/null
+++ b/images/16x16/meson.build
@@ -0,0 +1,34 @@
+extra_appicons_imgs = [
+  'balsa-encrypted.png',
+  'balsa-mark-all.png',
+  'balsa-mbox-draft.png',
+  'balsa-mbox-sent.png',
+  'balsa-mbox-tray-empty.png',
+  'balsa-mbox-tray-full.png',
+  'balsa-next-flagged.png',
+  'balsa-next-part.png',
+  'balsa-next.png',
+  'balsa-next-unread.png',
+  'balsa-postpone.png',
+  'balsa-previous-part.png',
+  'balsa-previous.png',
+  'balsa-reply-all.png',
+  'balsa-send-queued.png',
+  'balsa-signature-bad.png',
+  'balsa-signature-good.png',
+  'balsa-signature-notrust.png',
+  'balsa-signature-unknown.png',
+  'stock_mail-receive.png',
+  'stock_contact.png',
+  'stock_mail.png',
+  'stock_book_red.png',
+  'stock_book_open.png',
+  'mail-queue.png',
+  'mail-inbox.png',
+  'mail-outbox.png'
+  ]
+
+extra_appiconsdir = join_paths(get_option('datadir'), 'balsa', 'hicolor', '16x16', 'apps')
+foreach img : extra_appicons_imgs
+  install_data(img, install_dir : extra_appiconsdir)
+endforeach
diff --git a/images/24x24/meson.build b/images/24x24/meson.build
new file mode 100644
index 0000000..06abd71
--- /dev/null
+++ b/images/24x24/meson.build
@@ -0,0 +1,38 @@
+extra_appicons_imgs = [
+  'balsa-crypt-check.png',
+  'balsa-encrypted.png',
+  'balsa-encrypt.png',
+  'balsa-mark-all.png',
+  'balsa-marked-new.png',
+  'balsa-next-flagged.png',
+  'balsa-next-part.png',
+  'balsa-next.png',
+  'balsa-next-unread.png',
+  'balsa-postpone.png',
+  'balsa-preview.png',
+  'balsa-previous-part.png',
+  'balsa-previous.png',
+  'balsa-reply-all.png',
+  'balsa-send-queued.png',
+  'balsa-signature-bad.png',
+  'balsa-signature-good.png',
+  'balsa-signature-notrust.png',
+  'balsa-signature-unknown.png',
+  'balsa-sign.png',
+  'balsa-trash-empty.png',
+  'mail-queue.png',
+  'stock_mail-receive.png',
+  'stock_contact.png',
+  'stock_mail.png',
+  'stock_book_red.png',
+  'stock_book_yellow.png',
+  'stock_book_green.png',
+  'stock_book_blue.png',
+  'stock_book_open.png',
+  'stock_view-fields.png'
+  ]
+
+extra_appiconsdir = join_paths(get_option('datadir'), 'balsa', 'hicolor', '24x24', 'apps')
+foreach img : extra_appicons_imgs
+  install_data(img, install_dir : extra_appiconsdir)
+endforeach
diff --git a/images/meson.build b/images/meson.build
new file mode 100644
index 0000000..1c7e9c4
--- /dev/null
+++ b/images/meson.build
@@ -0,0 +1,24 @@
+# images/meson.build
+
+subdirs = ['mimetypes', '16x16', '24x24']
+foreach dir : subdirs
+  subdir(dir)
+endforeach
+
+# balsa_logo.png used by About menu (small one).
+# balsa-logo.png used by the init-druid
+balsa_imgs = [
+  'attachment.png',
+  'balsa-top.png',
+  'balsa_icon.png',
+  'balsa_logo.png'
+  ]
+
+balsabitmapsdir = join_paths(get_option('datadir'), 'pixmaps')
+install_data(balsa_imgs, install_dir : balsabitmapsdir)
+
+if gtk_update_icon_cache_program.found()
+  gtk_update_icon_cache = gtk_update_icon_cache_program.path()
+  icon_cache_dir = join_paths(get_option('prefix'), get_option('datadir'), 'balsa')
+  run_command(gtk_update_icon_cache, '--ignore-theme-index', icon_cache_dir)
+endif
diff --git a/images/mimetypes/meson.build b/images/mimetypes/meson.build
new file mode 100644
index 0000000..4471ebc
--- /dev/null
+++ b/images/mimetypes/meson.build
@@ -0,0 +1,18 @@
+extramimetypes_imgs = [
+  'application-pgp-signature.png',
+  'application-pkcs7-mime.png',
+  'application-pkcs7-signature.png',
+  'application-x-pkcs7-signature.png',
+  'message-disposition-notification.png',
+  'message-external-body.png',
+  'message.png',
+  'multipart-alternative.png',
+  'multipart-encrypted.png',
+  'multipart.png',
+  'multipart-signed.png'
+  ]
+
+extramimetypesdir = join_paths(get_option('datadir'), 'balsa', 'hicolor', '48x48', 'mimetypes')
+foreach img : extramimetypes_imgs
+  install_data(img, install_dir : extramimetypesdir)
+endforeach
diff --git a/libbalsa/imap/meson.build b/libbalsa/imap/meson.build
new file mode 100644
index 0000000..4eba35a
--- /dev/null
+++ b/libbalsa/imap/meson.build
@@ -0,0 +1,74 @@
+# libbalsa/imap/meson.build
+
+libimap_a_sources = [
+  'auth-cram.c',
+  'auth-gssapi.c',
+  'imap-auth.c',
+  'imap-auth.h',
+  'imap-commands.c',
+  'imap-commands.h',
+  'imap_compress.c',
+  'imap_compress.h',
+  'imap-handle.c',
+  'imap-handle.h',
+  'imap_search.c',
+  'imap_search.h',
+  'imap-tls.c',
+  'imap_private.h',
+  'libimap.h',
+  'siobuf.c',
+  'siobuf.h',
+  'util.c',
+  'util.h'
+  ]
+
+libimap_compile_args = ['-I' + meson.build_root(),
+                        '-I' + meson.current_build_dir(),
+                        '-I' + meson.source_root(),
+                        '-I' + join_paths(meson.source_root(), 'libbalsa'),
+                        '-I' + join_paths(meson.source_root(), 'libnetclient'),
+                        '-I' + join_paths(meson.source_root(), 'libbalsa', 'imap'),
+                        '-ansi']
+libimap_deps = declare_dependency(compile_args : libimap_compile_args,
+                                  dependencies : balsa_deps)
+
+# genmarshal
+#
+
+libimap_marshal_h = custom_target('libimap_marshal_h',
+  input   : 'libimap-marshal.list',
+  output  : 'libimap-marshal.h',
+  command : [
+    'sh', '-c',
+    glib_genmarshal +
+    ' --header' +
+    ' --prefix=libimap' +
+    ' @INPUT@' +
+    ' > libbalsa/imap/libimap-marshal.h'
+  ]
+)
+
+libimap_marshal_c = custom_target('libimap_marshal_c',
+  input   : 'libimap-marshal.list',
+  output  : 'libimap-marshal.c',
+  command : [
+    'sh', '-c',
+    'echo \'#include "libimap-marshal.h"\' > libbalsa/imap/libimap-marshal.c && ' +
+    glib_genmarshal +
+    ' --body' +
+    ' --prefix=libimap' +
+    ' @INPUT@' +
+    ' >> libbalsa/imap/libimap-marshal.c'
+  ]
+)
+
+libimap_a = static_library('imap', libimap_a_sources,
+                           libimap_marshal_c, libimap_marshal_h,
+                           dependencies : libimap_deps,
+                           install      : false)
+
+imap_tst_sources = 'imap_tst.c'
+
+imap_tst = executable('imap_tst', imap_tst_sources,
+                      link_with    : [libimap_a, libnetclient_a],
+                     dependencies : balsa_deps)
diff --git a/libbalsa/meson.build b/libbalsa/meson.build
new file mode 100644
index 0000000..ac87318
--- /dev/null
+++ b/libbalsa/meson.build
@@ -0,0 +1,181 @@
+# libbalsa/meson.build
+
+if gpgmecfg == 'yes'
+  libbalsa_gpgme_extra = [
+    'libbalsa-gpgme.h',
+    'libbalsa-gpgme.c',
+    'libbalsa-gpgme-cb.h',
+    'libbalsa-gpgme-cb.c',
+    'libbalsa-gpgme-keys.h',
+    'libbalsa-gpgme-keys.c',
+    'libbalsa-gpgme-widgets.h',
+    'libbalsa-gpgme-widgets.c',
+    'gmime-multipart-crypt.h',
+    'gmime-multipart-crypt.c',
+    'gmime-part-rfc2440.h',
+    'gmime-part-rfc2440.c',
+    'gmime-gpgme-signature.h',
+    'gmime-gpgme-signature.c',
+    'gmime-application-pkcs7.h',
+    'gmime-application-pkcs7.c']
+else
+  libbalsa_gpgme_extra = []
+endif
+
+libbalsa_a_sources = [
+  'abook-completion.c',
+  'abook-completion.h',
+  'address-book-extern.c',
+  'address-book-extern.h',
+  'address-book-gpe.c',
+  'address-book-gpe.h',
+  'address-book-ldap.c',
+  'address-book-ldap.h',
+  'address-book-ldif.c',
+  'address-book-ldif.h',
+  'address-book-osmo.c',
+  'address-book-osmo.h',
+  'address-book-rubrica.c',
+  'address-book-rubrica.h',
+  'address-book-text.c',
+  'address-book-text.h',
+  'address-book-vcard.c',
+  'address-book-vcard.h',
+  'address-book.c',
+  'address-book.h',
+  'address-view.c',
+  'address-view.h',
+  'address.c',
+  'address.h',
+  'application-helpers.c',
+  'application-helpers.h',
+  'body.c',
+  'body.h',
+  'cell-renderer-button.c',
+  'cell-renderer-button.h',
+  'completion.c',
+  'completion.h',
+  'files.c',
+  'files.h',
+  'filter-error.c',
+  'filter-file.c',
+  'filter-file.h',
+  'filter-funcs.c',
+  'filter-funcs.h',
+  'filter-private.h',
+  'filter.c',
+  'filter.h',
+  'folder-scanners.c',
+  'folder-scanners.h',
+  'gmime-filter-header.c',
+  'gmime-filter-header.h',
+  'html.c',
+  'html.h',
+  'identity.c',
+  'identity.h',
+  'imap-server.c',
+  'imap-server.h',
+  'information.c',
+  'information.h',
+  'libbalsa-conf.c',
+  'libbalsa-conf.h',
+  'libbalsa-progress.c',
+  'libbalsa-progress.h',
+  'macosx-helpers.c',
+  'macosx-helpers.h',
+  'missing.h',
+  'missing_time.c',
+  'libbalsa.c',
+  'libbalsa.h',
+  'libbalsa_private.h',
+  'libbalsa-vfs.c',
+  'libbalsa-vfs.h',
+  'mailbackend.h',
+  'mailbox-filter.c',
+  'mailbox-filter.h',
+  'mailbox.c',
+  'mailbox.h',
+  'mailbox_imap.c',
+  'mailbox_imap.h',
+  'mailbox_local.c',
+  'mailbox_local.h',
+  'mailbox_maildir.c',
+  'mailbox_maildir.h',
+  'mailbox_mbox.c',
+  'mailbox_mbox.h',
+  'mailbox_mh.c',
+  'mailbox_mh.h',
+  'mailbox_pop3.c',
+  'mailbox_pop3.h',
+  'mailbox_remote.c',
+  'mailbox_remote.h',
+  'message.c',
+  'message.h',
+  'mime.c',
+  'mime.h',
+  'mime-stream-shared.c',
+  'mime-stream-shared.h',
+  'misc.c',
+  'misc.h',
+  'rfc2445.c',
+  'rfc2445.h',
+  'rfc3156.c',
+  'rfc3156.h',
+  'rfc6350.c',
+  'rfc6350.h',
+  'send.c',
+  'send.h',
+  'server.c',
+  'server.h',
+  'smtp-server.c',
+  'smtp-server.h',
+  'source-viewer.c',
+  'url.c',
+  'url.h']
+
+libbalsa_a_sources += libbalsa_gpgme_extra
+
+libbalsa_compile_args = ['-I' + meson.build_root(),
+                         '-I' + meson.current_build_dir(),
+                         '-I' + join_paths(meson.source_root(), 'libbalsa'),
+                         '-I' + join_paths(meson.source_root(), 'libnetclient'),
+                         '-I' + join_paths(meson.source_root(), 'libbalsa', 'imap')]
+libbalsa_deps = declare_dependency(compile_args : libbalsa_compile_args,
+                                   dependencies : balsa_deps)
+
+# genmarshal
+#
+
+libbalsa_marshal_h = custom_target('libbalsa_marshal_h',
+  input   : 'libbalsa-marshal.list',
+  output  : 'libbalsa-marshal.h',
+  command : [
+    'sh', '-c',
+    glib_genmarshal +
+    ' --header' +
+    ' --prefix=libbalsa' +
+    ' @INPUT@' +
+    ' > libbalsa/libbalsa-marshal.h'
+  ]
+)
+
+libbalsa_marshal_c = custom_target('libbalsa_marshal_c',
+  input   : 'libbalsa-marshal.list',
+  output  : 'libbalsa-marshal.c',
+  command : [
+    'sh', '-c',
+    'echo \'#include "libbalsa-marshal.h"\' > libbalsa/libbalsa-marshal.c && ' +
+    glib_genmarshal +
+    ' --body' +
+    ' --prefix=libbalsa' +
+    ' @INPUT@' +
+    ' >> libbalsa/libbalsa-marshal.c'
+  ]
+)
+
+libbalsa_a = static_library('balsa', libbalsa_a_sources,
+                            libbalsa_marshal_c, libbalsa_marshal_h,
+                            dependencies : libbalsa_deps,
+                            install      : false)
+
+subdir('imap')
diff --git a/libinit_balsa/meson.build b/libinit_balsa/meson.build
new file mode 100644
index 0000000..8cd6c84
--- /dev/null
+++ b/libinit_balsa/meson.build
@@ -0,0 +1,29 @@
+# libinit_balsa/meson.build
+
+libinit_balsa_sources = [
+  'assistant_page_defclient.c',
+  'assistant_page_defclient.h',
+  'assistant_page_directory.c',
+  'assistant_page_directory.h',
+  'assistant_page_finish.c',
+  'assistant_page_finish.h',
+  'assistant_page_user.c',
+  'assistant_page_user.h',
+  'assistant_page_welcome.c',
+  'assistant_page_welcome.h',
+  'assistant_init.c',
+  'assistant_init.h',
+  'assistant_helper.c',
+  'assistant_helper.h'
+  ]
+
+libinit_balsa_compile_args = ['-I' + meson.build_root(),
+                              '-I' + join_paths(meson.source_root(), 'libbalsa'),
+                              '-I' + join_paths(meson.source_root(), 'libnetclient'),
+                              '-I' + join_paths(meson.source_root(), 'src')]
+libinit_balsa_deps = declare_dependency(compile_args : libinit_balsa_compile_args,
+                                        dependencies : balsa_deps)
+
+libinit_balsa_a = static_library('init_balsa', libinit_balsa_sources,
+                                 dependencies : libinit_balsa_deps,
+                                 install      : false)
diff --git a/libnetclient/meson.build b/libnetclient/meson.build
new file mode 100644
index 0000000..20f3cf7
--- /dev/null
+++ b/libnetclient/meson.build
@@ -0,0 +1,27 @@
+# libnetclient/test/meson.build
+
+libnetclient_a_sources = [
+  'net-client.c',
+  'net-client.h',
+  'net-client-pop.c',
+  'net-client-pop.h',
+  'net-client-smtp.c',
+  'net-client-smtp.h',
+  'net-client-utils.c',
+  'net-client-utils.h'
+  ]
+
+libnetclient_compile_args = '-I' + meson.build_root()
+netclient_deps = declare_dependency(compile_args : libnetclient_compile_args,
+                                    dependencies : libnetclient_deps)
+libnetclient_a = static_library('netclient', libnetclient_a_sources,
+                                dependencies : netclient_deps,
+                                install      : false)
+
+if with_libnetclient_docs
+  doxygen = doxygen_program.path()
+  dox_path = join_paths(meson.source_root(), meson.current_source_dir(), 'libnetclient.dox')
+  run_command(doxygen, dox_path)
+endif
+
+subdir('test')
diff --git a/libnetclient/test/meson.build b/libnetclient/test/meson.build
new file mode 100644
index 0000000..5b35cc9
--- /dev/null
+++ b/libnetclient/test/meson.build
@@ -0,0 +1,63 @@
+# libnetclient/test/meson.build
+
+if with_libnetclient_test
+
+  test_flags    = ['-DNCAT="' + ncat + '"',
+                   '-DSED="'  + sed  + '"',
+                   '-fprofile-arcs',
+                   '-ftest-coverage',
+                   '-g',
+                   '-Wno-error']
+  lcov_flags    = ['--rc',
+                   'lcov_branch_coverage=1']
+  genhtml_flags = ['--function-coverage',
+                   '--branch-coverage',
+                   '--num-spaces', '4']
+  valgr_flags   = ['--tool=memcheck',
+                   '--leak-check=full',
+                   '--track-fds=yes',
+                   '--child-silent-after-fork=yes']
+
+  test_deps = declare_dependency(compile_args : test_flags + ['-I.', '-I..'],
+                                 dependencies : libnetclient_deps)
+  test_executable = executable('tests', 'tests.c',
+                               link_with    : libnetclient_a,
+                               dependencies : test_deps,
+                               install      : false)
+  test('libnetclient-test', test_executable)
+  # now run the test with:
+  #   meson test --wrap='valgrind --tool=memcheck --leak-check=full --track-fds=yes 
--child-silent-after-fork=yes --suppressions=valgrind.supp' libnetclient-test
+  #
+  # To enable coverage measurements:
+  # If you enable coverage measurements by giving Meson
+  # the command line flag -Db_coverage=true, you can generate coverage reports.
+  # Meson will autodetect what coverage generator tools you have installed
+  # and will generate the corresponding targets.
+  # These targets are coverage-xml and coverage-text which are both provided by Gcovr
+  # and coverage-html, which requires Lcov and GenHTML.
+
+  # Or just use this code, munged from Makefile.am:
+  source_path = join_paths(meson.source_root(), meson.current_source_dir())
+  build_path  = meson.current_build_dir()
+
+  # valgrind
+  vg_path    = join_paths(build_path, 'vg')
+  supp_path  = join_paths(source_path, 'valgrind.supp')
+  tests_path = join_paths(build_path, 'tests')
+  run_command(valgrind, [valgr_flags,
+                         '--suppressions=' + supp_path,
+                         '--log-file=' + vg_path,
+                         tests_path])
+
+  # lcov
+  # Note: the following hack is needed so lcov recognises the paths of the sources...
+  libsrcdir = join_paths(source_path, '..')
+  lcov_out_path = join_paths(build_path, 'tests.covi')
+  run_command(lcov, ['-c', '-b', libsrcdir, '-d', source_path, '--no-external', '-o', lcov_out_path])
+  run_command(lcov, ['-r', lcov_out_path, 'tests.c', '-o', lcov_out_path])
+
+  # genhtml
+  html_out_path = join_paths(build_path, 'gcov')
+  run_command(genhtml, [genhtml_flags, '-o', html_out_path, lcov_out_path])
+
+endif # with_libnetclient_test
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..e58de49
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,823 @@
+project('balsa', 'c', default_options : 'sysconfdir=/etc')
+
+# if meson is used not in a git source tree, use version=2.5.3
+balsa_version = '2.5.3'
+
+balsa_from_git = run_command('sh', '-c', 'test -d ${MESON_SOURCE_ROOT}/.git').returncode() == 0
+
+if balsa_from_git
+  git_describe = run_command('git', 'describe', '--tags')
+  if git_describe.returncode() == 0
+    balsa_version = git_describe.stdout().strip()
+  endif
+endif
+
+# ###########################################################################
+# Versioning
+# ###########################################################################
+
+conf = configuration_data()
+conf.set_quoted('BALSA_VERSION', balsa_version)
+conf.set_quoted('VERSION', balsa_version)
+conf.set_quoted('PACKAGE_VERSION', balsa_version)
+conf.set_quoted('PACKAGE', 'balsa',
+                description : 'Name of package')
+
+# #####################################################################
+# System extensions
+# #####################################################################
+
+conf.set('_GNU_SOURCE', 1)
+
+# #####################################################################
+# Options
+# #####################################################################
+
+if get_option('enable-flock')
+  conf.set('USE_FLOCK', 1,
+    description : 'Define if flock locking should be used.')
+endif
+
+if get_option('enable-fcntl')
+  conf.set('USE_FCNTL', 1,
+    description : 'Define if fcntl locking should be used.')
+endif
+
+if get_option('enable-debug-threads')
+  conf.set('BALSA_DEBUG_THREADS', 1,
+    description : 'Defined to debug threads.')
+endif
+
+with_gnome         = get_option('with-gnome')
+gpgmecfg           = get_option('with-gpgme')
+have_smime         = get_option('enable-smime')
+gpgapp             = get_option('with-gpg-app')
+with_canberra      = get_option('with-canberra')
+with_compface      = get_option('with-compface')
+with_gss           = get_option('with-gss')
+use_html_widget    = get_option('with-html-widget')
+with_gtksourceview = get_option('with-gtksourceview')
+use_spell_checker  = get_option('with-spell-checker')
+with_ldap          = get_option('with-ldap')
+with_libnotify     = get_option('with-libnotify')
+use_igemacint      = get_option('with-macosx-desktop')
+with_rubrica       = get_option('with-rubrica')
+with_osmo          = get_option('with-osmo')
+with_sqlite        = get_option('with-sqlite')
+with_libsecret     = get_option('with-libsecret')
+with_gcr           = get_option('with-gcr')
+set_more_warnings  = get_option('enable-more-warnings')
+
+# Documentation and Testing requirements for libnetclient
+with_libnetclient_docs = get_option('with-libnetclient-docs')
+with_libnetclient_test = get_option('with-libnetclient-test')
+
+# #####################################################################
+# Programs: compilers and their options.
+# #####################################################################
+
+compiler = meson.get_compiler('c')
+
+uts_prefix = '''
+#define _GNU_SOURCE
+#include <sys/utsname.h>
+'''
+if compiler.has_member('struct utsname', 'domainname', prefix : uts_prefix)
+  conf.set('HAVE_STRUCT_UTSNAME_DOMAINNAME', 1,
+    description : 'Defined if domainname is a member of struct utsname')
+endif
+
+# glib-genmarshal
+#
+# We cannot use gnome.genmarshal because it generates a source file that
+# does not include the header file, which causes an error when compiling
+# with -Wmissing-prototypes and -Werror.
+#
+# If gnome.genmarshal is ever enhanced by adding the --include-header
+# option that is implemented in glib's internal build system, we should
+# use instead of this:
+
+glib_genmarshal = run_command('pkg-config',
+                              ['--variable=glib_genmarshal', 'glib-2.0']).stdout().strip()
+
+# yelp
+
+yelptool = find_program('yelp-build', required : false)
+if not yelptool.found()
+  message('*** The tools to build the documentation are not found.')
+  message('    To build it, please install the yelp-tools package.')
+  message('    Continuing with build. ****')
+endif
+
+# _NL_MEASUREMENT_MEASUREMENT is an enum and not a define
+
+code = '''
+#include <langinfo.h>
+void func()
+{
+    char c;
+    c = *((unsigned char *) nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
+}
+'''
+result = compiler.compiles(code, name : '_NL_MEASUREMENT_MEASUREMENT test')
+if result
+  conf.set('HAVE__NL_MEASUREMENT_MEASUREMENT', 1,
+    description : 'Define if _NL_MEASUREMENT_MEASUREMENT is available')
+endif
+
+# #####################################################################
+# GNOME libs
+# #####################################################################
+
+with_gnome_keyring = false
+if with_gnome
+  TOOLKIT_CATEGORIES = 'GNOME;GTK;'
+  gnome_extras = ['gio-unix-2.0']
+  if not with_libsecret
+    gnome_keyring_dep = dependency('gnome-keyring-1', version : '>= 1.0')
+    if gnome_keyring_dep.found()
+      gnome_extras += 'gnome-keyring-1'
+      conf.set('HAVE_GNOME_KEYRING', 1,
+        description : 'Defined when gnome-keyring is there.')
+      # Work around http://bugzilla.gnome.org/show_bug.cgi?id=556530
+      gnome_keyring_24_dep = dependency('gnome-keyring-1', version : '>= 2.24.1')
+      if gnome_keyring_24_dep.found()
+        conf.set('HAVE_GNOME_KEYRING_24', 1,
+          description : 'Defined with gnome-keyring-2.24 or newer.')
+      endif
+      with_gnome_keyring = true
+    endif
+  endif
+  conf.set('HAVE_GNOME', 1,
+    description : 'Defined when building for GNOME.')
+else
+  TOOLKIT_CATEGORIES = 'GTK;'
+  gnome_extras = []
+endif # with_gnome
+
+conf.set('TOOLKIT_CATEGORIES', TOOLKIT_CATEGORIES)
+
+# #####################################################################
+# Libraries.
+# #####################################################################
+
+# Make sure ld finds zlib:
+add_global_link_arguments('-lz', language : 'c')
+
+# Dependencies for balsa and balsa_ab:
+glib_dep    = dependency('glib-2.0', version : '>= 2.40.0')
+gtk_dep     = dependency('gtk+-3.0', version : '>= 3.10.0')
+gmime_dep   = dependency('gmime-2.6')
+gio_dep     = dependency('gio-2.0')
+gthread_dep = dependency('gthread-2.0')
+gnutls_dep  = dependency('gnutls')
+gnome_dependencies = []
+foreach extra : gnome_extras
+  gnome_dependencies += dependency(extra)
+endforeach
+
+# Dependencies for balsa
+balsa_deps = [glib_dep,
+              gtk_dep,
+              gmime_dep,
+              gio_dep,
+              gthread_dep,
+              gnutls_dep,
+              gnome_dependencies]
+
+# Dependencies for balsa_ab:
+balsa_ab_deps = [glib_dep,
+                 gtk_dep,
+                 gmime_dep,
+                 gnome_dependencies]
+
+# Dependencies for libnetclient:
+libnetclient_deps = [glib_dep,
+                     gio_dep,
+                     gnutls_dep]
+
+# Check whether res_init is available
+result = compiler.has_function('res_init', prefix : '#include <resolv.h>')
+if not result
+  result = compiler.has_function('res_init',
+                                 prefix : '#include <resolv.h>',
+                                 args   : '-lresolv')
+  if result
+    add_global_link_arguments('-lresolv')
+  endif
+endif
+
+if result
+  conf.set('HAVE_RES_INIT', 1,
+    description : 'Defined when res_init is available.')
+endif
+
+# ##########################################################################
+# Check versions
+# ##########################################################################
+
+# HTML widget
+#
+if use_html_widget == 'gtkhtml4'
+  html_dep = dependency('libgtkhtml-4.0')
+  conf.set('HAVE_GTKHTML4', 1,
+    description : 'Defined when GtkHtml-4 can be used.')
+elif use_html_widget == 'webkit' or use_html_widget == 'webkit2'
+  if use_html_widget == 'webkit2'
+    html_dep = dependency('webkit2gtk-4.0')
+    conf.set('USE_WEBKIT2', 1,
+      description : 'Defined when WebKit2 is requested.')
+  else
+    html_dep = dependency('webkit2gtk-3.0',
+                                 version  : '>= 1.5.1',
+                                 required : false)
+    if html_dep.found()
+      java_dep = dependency('javascriptcoregtk-3.0')
+    else
+      html_dep = dependency('webkit2gtk-3.0')
+    endif
+  endif
+  conf.set('HAVE_WEBKIT', 1,
+    description : 'Defined when WebKit can be used.')
+
+  html2text = find_program('python-html2text',
+                           'html2markdown',
+                           'html2markdown.py2',
+                           'html2markdown.py3',
+                           'html2text',
+                           required : false)
+  if html2text.found()
+    conf.set_quoted('HTML2TEXT', html2text.path(),
+      description : 'Path to html2text program.')
+  else
+    message('You cannot properly quote html-only messags.')
+  endif
+endif
+
+if is_variable('html_dep')
+  conf.set('HAVE_HTML_WIDGET', 1,
+    description : 'Defined when any HTML widget can be used.')
+  balsa_deps += html_dep
+endif
+
+# GPGME detection.
+
+if gpgmecfg == 'yes'
+  gpgmecfg_program = find_program('gpgme-config', required : false)
+  if not gpgmecfg_program.found()
+    error('GPGme build requested but gpgme-config program not found.')
+  endif
+  gpgmecfg = gpgmecfg_program.path()
+endif
+
+if gpgmecfg != 'no'
+  gpgmever = run_command(gpgmecfg, '--version').stdout().strip()
+  if gpgmever.version_compare('< 1.2.0')
+    gpgmecfg   = 'no'
+    have_smime = 'no'
+    message('Sorry, you need at least gpgme version 1.2.0')
+  else
+    if gpgmever.version_compare('< 1.8.0')
+      gpgme_libs = run_command(gpgmecfg, '--thread=pthread', '--libs')
+    else
+      gpgme_libs = run_command(gpgmecfg, '--libs')
+    endif
+    if gpgme_libs.returncode() != 0
+      error('*** You enabled gpgme support, but your gpgme installation does not support threads.')
+    endif
+
+    gpgme_cflags = run_command(gpgmecfg, '--cflags')
+    gpgme_cflags = gpgme_cflags.stdout().strip()
+    gpgme_libs   = gpgme_libs.stdout().strip()
+    gpgme_libs   = gpgme_libs.split(' ')
+
+    if gpgme_cflags != ''
+      gpgme_dep = declare_dependency(compile_args : gpgme_cflags,
+                                     link_args    : gpgme_libs)
+    else
+      gpgme_dep = declare_dependency(link_args    : gpgme_libs)
+    endif
+    conf.set('HAVE_GPGME', 1,
+             description : 'Defined when gpgme is available.')
+    balsa_deps += gpgme_dep
+    gpgmecfg = 'yes'
+  endif
+else
+  have_smime = 'no'
+endif
+
+# OpenLDAP configuration.
+#
+if with_ldap != 'no'
+  ldap_compile_args = []
+  ldap_link_args    = ['-lldap', '-llber', '-lresolv']
+  if with_ldap != 'yes'
+    ldap_compile_args += '-I' + with_ldap + '/include'
+    ldap_link_args    += '-L' + with_ldap + '/lib'
+  endif
+
+  result = compiler.has_function('ldap_search', args : ldap_link_args)
+  if result
+    conf.set('ENABLE_LDAP', 1,
+      description : 'Defined when the LDAP support is to be compiled in.')
+  else
+    error('*** You enabled LDAP but ldap library is not found.')
+  endif
+
+  result = compiler.has_function('ldap_start_tls', args : ldap_link_args)
+  if result
+    conf.set('HAVE_LDAP_TLS', 1,
+      description : 'Defined when LDAP lib supports TLS')
+  endif
+
+  ldap_dep = declare_dependency(compile_args : ldap_compile_args,
+                                link_args    : ldap_link_args)
+  balsa_deps += ldap_dep
+  balsa_ab_deps += ldap_dep
+endif # with_ldap != 'no'
+
+# SQLite configuration.
+#
+if with_sqlite != 'no'
+  sqlite_dep = dependency('sqlite3', required : false)
+  if sqlite_dep.found()
+    conf.set('HAVE_SQLITE3', 1,
+      description : 'If defined, use sqlite3 api.')
+  else
+    sqlite_dep = dependency('sqlite', version : '>= 2.8')
+  endif
+  conf.set('HAVE_SQLITE', 1,
+    description : 'If defined, enable GPE address book support.')
+
+  if with_sqlite != 'yes'
+    # If sqlite is installed in a nonstandard location, PKG_CONFIG_PATH
+    # would probably need to be set appropriately in the environment.
+    # There doesn't seem to be a way to do that within dependency().
+    real_dep = declare_dependency(dependencies : sqlite_dep,
+                                  compile_args : '-I' + with_sqlite + '/include',
+                                  link_args    : '-L' + with_sqlite + '/lib')
+  else
+    real_dep = sqlite_dep
+  endif
+
+  balsa_deps += real_dep
+  balsa_ab_deps += real_dep
+endif # with_sqlite != 'no'
+
+# Rubrica (libxml2) configuration
+#
+if with_rubrica
+  xml_dep = dependency('libxml-2.0')
+  conf.set('HAVE_RUBRICA', 1,
+    description : 'If defined, enable Rubrica2 address book support.')
+  balsa_deps += xml_dep
+  balsa_ab_deps += xml_dep
+endif # with_rubrica
+
+# Osmo address book support
+#
+if with_osmo
+  conf.set('HAVE_OSMO', 1,
+    description : 'If defined, enable Osmo address book support.')
+endif # with_osmo
+
+# OpenSSL configuration.
+#
+ssl_dep = dependency('openssl')
+if not ssl_dep.found()
+  if not compiler.has_header('openssl/ssl.h')
+    error('OpenSSL headers not found')
+  endif
+
+  # Look for SSL_library_init
+  code = '''
+  /* Override any GCC internal prototype to avoid an error.
+     Use char because int might match the return type of a GCC
+     builtin and then its argument prototype would still apply.  */
+  char SSL_library_init ();
+  int
+  main ()
+  {
+    return SSL_library_init ();
+  }
+  '''
+  ssl_link_args = ['-lssl', '-lcrypto']
+  result = compiler.links(code,
+                          args : ssl_link_args,
+                          name : 'OpenSSL test')
+  if result
+    ssl_dep = declare_dependency(linkargs : ssl_link_args)
+  else
+    error('libssl not found')
+  endif
+endif # not ssl_dep.found()
+balsa_deps += ssl_dep
+balsa_ab_deps += ssl_dep
+
+# KRB5/GSSAPI configuration.
+#
+if with_gss
+  krb5_config_program = find_program('krb5-config',
+                                     '/usr/kerberos/bin/krb5-config',
+                                     '/usr/lib/mit/bin/krb5-config',
+                                     required : false)
+  if not krb5_config_program.found()
+    error('GSS requested but krb5-config not found. Install krb5-devel/heimdal-devel')
+  endif
+  conf.set('HAVE_GSSAPI', 1,
+    description : 'Defined when GSSAPI support is to be compiled.')
+  krb5_config = krb5_config_program.path()
+  krb5_cflags = run_command(krb5_config, '--cflags gssapi').stdout().strip()
+  krb5_libs = run_command(krb5_config, '--libs gssapi').stdout().strip()
+  if compiler.has_header('gssapi.h')
+    conf.set('HAVE_HEIMDAL', 1,
+      description : 'Defined for Heimdal.')
+  elif not compiler.has_header('gssapi/gssapi.h')
+    error('gssapi.h not found')
+  endif
+  krb5_dep = declare_dependency(compile_args : krb5_cflags,
+                                link_args    : krb5_libs)
+  balsa_deps += krb5_dep
+endif # with_gss
+
+# Libnotify configuration
+#
+if with_libnotify
+  notify_dep = dependency('libnotify',
+                          version  : '>= 0.7.0',
+                          required : false)
+  if notify_dep.found()
+    notifyver = 7
+  else
+    notify_dep = dependency('libnotify',
+                            version  : '>= 0.4.0',
+                            required : false)
+    if notify_dep.found()
+      notifyver = 4
+    else
+      error('*** You enabled notify but the library is not found.')
+    endif
+  endif
+  conf.set('HAVE_NOTIFY', notifyver,
+    description : 'Defined when libnotify can be used.')
+  balsa_deps += notify_dep
+  balsa_ab_deps += notify_dep
+endif # with_libnotify
+
+# gcr configuration
+#
+if with_gcr
+  gcr_dep = dependency('gcr-3')
+  if gcr_dep.found()
+    conf.set('HAVE_GCR', 1,
+      description : 'Defined when gcr-3 can be used.')
+  endif
+  balsa_deps += gcr_dep
+endif # with_gcr
+
+# Compface configuration
+#
+if with_compface != 'no'
+  compface_compile_args = []
+  compface_link_args    = ['-lcompface']
+  if with_compface != 'yes'
+    compface_compile_args += '-I' + with_compface + '/include'
+    compface_link_args    += '-L' + with_compface + '/lib'
+  endif
+
+  result = compiler.has_function('uncompface', args : compface_link_args)
+  if result
+    conf.set('HAVE_COMPFACE', 1,
+      description : 'Defined when Compface support is requested.')
+  else
+    error('*** You enabled Compface but the library is not found.')
+  endif
+
+  compface_dep = declare_dependency(compile_args : compface_compile_args,
+                                    link_args    : compface_link_args)
+  balsa_deps += compface_dep
+endif # with_compface != 'no'
+
+# GtkSourceView configuration
+#
+if with_gtksourceview
+  gsv_dep = dependency('gtksourceview-3.0', version : '>= 3.2.0')
+  conf.set('HAVE_GTKSOURCEVIEW', 1,
+    description : 'Defined when GtkSourceView-3 can be used.')
+  balsa_deps += gsv_dep
+endif # with_gtksourceview
+
+# libcanberra configuration
+#
+if with_canberra
+  canberra_dep = dependency('libcanberra-gtk3')
+  conf.set('HAVE_CANBERRA', 1,
+    description : 'Defined when canberra can be used.')
+  balsa_deps += canberra_dep
+endif # with_canberra
+
+# ige-mac-integration (Mac OS X desktop only)
+#
+if use_igemacint
+  igemacint_dep = dependency('ige-mac-integration', version  : '>= 0.8')
+  conf.set('HAVE_MACOSX_DESKTOP', 1,
+    description : 'Defined when menus can be integrated into the Mac OS X desktop')
+  balsa_deps    += igemacint_dep
+  balsa_ab_deps += igemacint_dep
+endif # use_igemacint
+
+# Libsecret configuration
+#
+if with_libsecret
+  secret_dep = dependency('libsecret-1', required : false)
+  if not secret_dep.found()
+    error('You asked to link to libsecret, but the development tool is not installed')
+  endif
+  conf.set('HAVE_LIBSECRET', 1,
+    description : 'Defined when libsecret can be used.')
+  balsa_deps += secret_dep
+endif # with_libsecret
+
+#####################################################################
+# Headers.
+#####################################################################
+
+# Spell check detection.
+#
+if use_spell_checker == 'gspell'
+  spell_dep = dependency('gspell-1')
+  conf.set('HAVE_GSPELL', 1,
+    description : 'Defined when Gspell can be used.')
+  if spell_dep.version().version_compare('>= 1.1.2')
+    conf.set('HAVE_GSPELL_1_2', 1,
+      description : 'Defined when Gspell API is version 1.2.')
+  endif
+elif use_spell_checker == 'gtkspell'
+  spell_dep = dependency('gtkspell3-3.0',
+                         version  : '>= 3.0.3',
+                         required : false)
+  if spell_dep.found()
+    conf.set('HAVE_GTKSPELL_3_0_3', 1,
+      description : 'Defined when GtkSpell version is at least 3.0.3.')
+  else
+    spell3_dep = dependency('gtkspell3-3.0')
+    enchant_dep = dependency('enchant')
+    spell_dep = declare_dependency(dependencies : [spell3_dep, enchant_dep])
+  endif
+  conf.set('HAVE_GTKSPELL', 1,
+    description : 'Defined when GtkSpell can be used.')
+elif use_spell_checker == 'internal'
+  spell_dep = dependency('enchant')
+elif use_spell_checker != 'no'
+  error('bad option' + use_spell_checker)
+endif
+
+if is_variable('spell_dep')
+  balsa_deps += spell_dep
+endif
+
+#####################################################################
+# Typedefs, structures and compiler characteristics.
+#####################################################################
+
+conf.set('HAVE_DECL_CTIME_R',
+  compiler.has_header_symbol('time.h', 'ctime_r') ? 1 : 0,
+  description : 'Define to 1 if you have the declaration of ctime_r, and to 0 if you do not.')
+
+conf.set('HAVE_CTIME_R',
+  compiler.has_function('ctime_r') ? 1 : 0,
+  description : 'Define to 1 if you have the ctime_r function.')
+
+if not compiler.has_header('zlib.h')
+  error('zlib library required')
+endif
+
+# set more warnings.
+#
+
+if compiler.get_id() == 'gcc' and set_more_warnings
+  foreach argument : ['-Wsign-compare',
+                      '-Wpointer-arith',
+                      '-Wnested-externs',
+                      '-Wchar-subscripts',
+                      '-Wuninitialized',
+                      '-Wmissing-prototypes',
+                      '-Wreturn-type',
+                      '-Wdeclaration-after-statement']
+    if compiler.has_argument(argument)
+      add_global_arguments(argument, language : 'c')
+    endif
+  endforeach
+endif
+
+# extra warnings for GIT.
+#
+if balsa_from_git
+  add_global_arguments('-Wall', '-Werror', '-Wdeprecated-declarations', language : 'c')
+  add_global_arguments('-DGMIME_DISABLE_DEPRECATED', language : 'c')
+  add_global_arguments('-O2', '-U_FORTIFY_SOURCE', '-D_FORTIFY_SOURCE=2', language : 'c')
+endif # balsa_from_git
+
+#####################################################################
+# Extra functions.
+#####################################################################
+
+conf.set('HAVE_GETADDRINFO',
+  compiler.has_function('getaddrinfo') ? 1 : 0,
+  description : 'Define to 1 if you have the getaddrinfo function.')
+
+###########################################################################
+# Remember our prefixes
+###########################################################################
+
+balsa_data_prefix = join_paths(get_option('prefix'), get_option('datadir'), 'balsa')
+add_global_arguments('-DBALSA_DATA_PREFIX="' + balsa_data_prefix + '"', language : 'c')
+
+gtk_update_icon_cache_program = find_program('gtk-update-icon-cache')
+
+###########################################################################
+# Documentation and Testing requirements for libnetclient
+###########################################################################
+
+if with_libnetclient_docs
+  doxygen_program = find_program('doxygen', required : false)
+  if not doxygen_program.found()
+    error('*** Cannot build libnetclient API documentation, see libnetclient/README for fixing this issue 
***')
+  endif
+endif # with_libnetclient_docs
+
+if with_libnetclient_test
+  have_sput           = compiler.has_header('sput.h')
+  sed_program         = find_program('sed',         required : false)
+  ncat_program        = find_program('ncat',        required : false)
+  valgrind_program    = find_program('valgrind',    required : false)
+  lcov_program        = find_program('lcov',        required : false)
+  genhtml_program     = find_program('genhtml',     required : false)
+  screen_program      = find_program('screen',      required : false)
+  gnutls_serv_program = find_program('gnutls-serv', required : false)
+  sudo_program        = find_program('sudo',        required : false)
+  inetsim_program     = find_program('inetsim',     required : false)
+
+  if not (have_sput
+          and sed_program.found()
+          and ncat_program.found()
+          and valgrind_program.found()
+          and lcov_program.found()
+          and genhtml_program.found()
+          and screen_program.found()
+          and gnutls_serv_program.found()
+          and sudo_program.found()
+          and inetsim_program.found())
+    error('*** Cannot run libnetclient tests, see libnetclient/README for fixing this issue ***')
+  endif
+
+  sed         = sed_program.path()
+  ncat        = ncat_program.path()
+  valgrind    = valgrind_program.path()
+  lcov        = lcov_program.path()
+  genhtml     = genhtml_program.path()
+  screen      = screen_program.path()
+  gnutls_serv = gnutls_serv_program.path()
+  sudo        = sudo_program.path()
+  inetsim     = inetsim_program.path()
+endif # with_libnetclient_test
+
+#####################################################################
+# Output
+#####################################################################
+
+output_files = ['balsa.1', 'balsa.spec']
+
+foreach file : output_files
+  configure_file(input : file + '.in', output : file, configuration : conf)
+endforeach
+
+# config.h
+configure_file(output : 'config.h', configuration : conf)
+add_project_arguments('-DHAVE_CONFIG_H=1', language : 'c')
+
+#####################################################################
+# gettext
+#####################################################################
+
+i18n = import('i18n')
+
+gettext_package = 'balsa'
+add_project_arguments('-DGETTEXT_PACKAGE="' + gettext_package + '"', language : 'c')
+subdir('po')
+
+desktop_files = ['balsa.desktop', 'balsa-mailto-handler.desktop']
+foreach file : desktop_files
+  file_in = configure_file(input         : file + '.in.in',
+                           output        : file + 'in',
+                           configuration : conf)
+  i18n.merge_file(
+    input       : file_in,
+    output      : file,
+    type        : 'desktop',
+    po_dir      : 'po',
+    install     : true,
+    install_dir : join_paths(get_option('datadir'), 'applications')
+  )
+endforeach
+
+i18n.merge_file(
+  input       : 'balsa.appdata.xml.in',
+  output      : 'balsa.appdata.xml',
+  po_dir      : 'po',
+  install     : true,
+  install_dir : join_paths(get_option('datadir'), 'appdata')
+)
+
+##########################################################################
+# Summary
+##########################################################################
+
+message('')
+message('================ Final configuration ===================')
+message('    Installing into prefix: ' + get_option('prefix'))
+message('   Enable compile warnings: ' + (set_more_warnings  ? 'true' : 'false'))
+message('               HTML widget: ' + use_html_widget)
+message('                 Use GNOME: ' + (with_gnome         ? 'true' : 'false'))
+message('              Use Canberra: ' + (with_canberra      ? 'true' : 'false'))
+message('                 Use GPGME: ' + gpgmecfg)
+message('                  Use LDAP: ' + with_ldap)
+message('                   Use GSS: ' + (with_gss           ? 'true' : 'false'))
+message('                Use SQLite: ' + with_sqlite)
+message('             Spell checker: ' + use_spell_checker)
+message('             Use Libnotify: ' + (with_libnotify     ? 'true' : 'false'))
+message('         Use GtkSourceView: ' + (with_gtksourceview ? 'true' : 'false'))
+message('              Use Compface: ' + with_compface)
+message('             Use libsecret: ' + (with_libsecret     ? 'true' : 'false'))
+message('                   Use gcr: ' + (with_gcr           ? 'true' : 'false'))
+
+if balsa_from_git
+  message('''
+============================== NOTICE ================================
+                You are using Balsa from GIT source.
+  The program is likely to be unstable, contain incomplete features,
+or just plain not work. Use it at your own risk. You have been warned.
+======================================================================
+''')
+
+  if with_gnome_keyring
+    message('''
+*** Cannot build in a git tree with deprecated GnomeKeyring.
+*** Either install and configure with libsecret or configure --without-gnome.
+      ''')
+  endif
+endif
+
+if use_html_widget == 'webkit'
+  message('''
+*** You have configured Balsa to use the old webkitgtk HTML widget.
+*** This widget is no longer being actively developed, and likely
+*** has security issues fixed in the newer webkit2 widget.
+*** Balsa will continue support for the old webkit widget only
+*** while needed by long-term-stable releases of major distributors.
+  ''')
+endif
+
+subdirs = ['sounds',
+           'images',
+           'doc',
+           'libnetclient',
+           'libbalsa',
+           'libinit_balsa',
+           'src',
+           'ui']
+foreach dir : subdirs
+  subdir(dir)
+endforeach
+
+if with_gtksourceview
+  gtksourceview_files = ['balsa-mail.lang', 'balsa-mail-style.xml']
+  gtksourceviewdir = join_paths(get_option('datadir'), 'gtksourceview-3.0')
+  install_data(gtksourceview_files, install_dir : gtksourceviewdir)
+endif
+####################### Autotools stuff below this line #######################
+#
+#dist-hook: balsa.spec
+#      cp balsa.spec $(distdir)
+#
+#@MAINT@RPM: balsa.spec
+#@MAINT@       rm -f *.rpm
+#@MAINT@       $(MAKE) distdir="$(PACKAGE)-$(PACKAGE_VERSION)" dist
+#@MAINT@       cp $(top_srcdir)/rpm-po.patch $(top_builddir)/rpm-po.patch
+#@MAINT@       rpm -ta "./$(PACKAGE)-$(PACKAGE_VERSION).tar.gz"
+#@MAINT@       rm $(top_builddir)/rpm-po.patch
+#@MAINT@       -test -f "/usr/src/redhat/SRPMS/$(PACKAGE)-$(PACKAGE_VERSION)-@BALSA_RELEASE  src rpm" \
+#@MAINT@               && cp -f "/usr/src/redhat/SRPMS/$(PACKAGE)-$(PACKAGE_VERSION)-@BALSA_RELEASE  src 
rpm" .
+#@MAINT@       -for ping in /usr/src/redhat/RPMS/* ; do \
+#@MAINT@               if test -d $$ping ; then \
+#@MAINT@                       arch=`echo $$ping |sed -e 's,/.*/\([^/][^/]*\),\1,'` ; \
+#@MAINT@                       f="$$ping/$(PACKAGE)-$(PACKAGE_VERSION)-@BALSA_RELEASE@.$$arch.rpm" ; \
+#@MAINT@                       test -f $$f && cp -f $$f . ; \
+#@MAINT@               fi ; \
+#@MAINT@       done
+#
+#@MAINT@snapshot:
+#@MAINT@       $(MAKE) distdir=$(PACKAGE)-`date +"%y%m%d"` dist
+#
+#@MAINT@balsa-dcheck:
+#@MAINT@       $(MAKE) BALSA_DISTCHECK_HACK=yes distcheck
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..386259a
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,119 @@
+option('with-gnome',
+  type        : 'boolean',
+  value       : true,
+  description : 'Use GNOME libraries (default=true)')
+
+option('enable-flock',
+  type        : 'boolean',
+  value       : false,
+  description : 'Use flock() to lock files (default=false)')
+
+option('enable-fcntl',
+  type        : 'boolean',
+  value       : true,
+  description : 'Use fcntl() to lock files (default=true)')
+
+option('enable-debug-threads',
+  type        : 'boolean',
+  value       : false,
+  description : 'Debug threads (default=false)')
+
+option('with-gpgme',
+  type        : 'string',
+  value       : 'no',
+  description : 'build with gpgme/GnuPG support (default=no, path to gpgme-config optional)')
+
+option('enable-smime',
+  type        : 'string',
+  value       : 'check',
+  description : 'include S/MIME support (needs gpgme and gpgsm, experimental for gpg < 2.0.4)')
+
+option('with-gpg-app',
+  type        : 'string',
+  value       : 'no',
+  description : 'use PATH as GnuPG application (default=gpg2 if >= 2.0.4, otherwise gpg 1.x)')
+
+option('with-canberra',
+  type        : 'boolean',
+  value       : false,
+  description : 'Use libcanberra-gtk3 for filter sounds (default=false)')
+
+option('with-compface',
+  type        : 'string',
+  value       : 'no',
+  description : 'Enable Compface (default=no, path to compface installation optional)')
+
+option('with-gss',
+  type        : 'boolean',
+  value       : false,
+  description : 'Enable GSS (default=false)')
+
+option('with-html-widget',
+  type        : 'string',
+  value       : 'webkit2',
+  description : 'select the HTML renderer (default webkit2)')
+
+option('with-gtksourceview',
+  type        : 'boolean',
+  value       : false,
+  description : 'Use GtkSourceView-3 if available (default=false)')
+
+option('with-spell-checker',
+  type        : 'string',
+  value       : 'no',
+  description : 'select the external spell checker (default no)')
+
+option('with-ldap',
+  type        : 'string',
+  value       : 'no',
+  description : 'Use OpenLDAP if available (default=no)')
+
+option('with-libnotify',
+  type        : 'boolean',
+  value       : true,
+  description : 'Use libnotify if available (default=true)')
+
+option('with-macosx-desktop',
+  type        : 'boolean',
+  value       : false,
+  description : 'Use Mac OS X Desktop Integration (default=no, extremely experimental)')
+
+option('with-rubrica',
+  type        : 'boolean',
+  value       : false,
+  description : 'add Rubrica2 address book support (needs libxml2, default=false)')
+
+option('with-osmo',
+  type        : 'boolean',
+  value       : false,
+  description : 'add Osmo address book support (experimental, needs osmo > svn rev. 1099, default=no)')
+
+option('with-sqlite',
+  type        : 'string',
+  value       : 'no',
+  description : 'Use SQLite for GPE address books (default=no)')
+
+option('with-libsecret',
+  type        : 'boolean',
+  value       : false,
+  description : 'Link to libsecret instead of gnome-keyring (default=false)')
+
+option('with-gcr',
+  type        : 'boolean',
+  value       : false,
+  description : 'Use libgcr-3 for dealing with TLS certificates (experimental, default=false)')
+
+option('enable-more-warnings',
+  type        : 'boolean',
+  value       : true,
+  description : 'Enable maximum compiler warnings (default=true)')
+
+option('with-libnetclient-docs',
+  type        : 'boolean',
+  value       : false,
+  description : 'Check requirements for building the libnetclient API docs (see libnetclient/README; 
default=false)')
+
+option('with-libnetclient-test',
+  type        : 'boolean',
+  value       : false,
+  description : 'Check requirements for running libnetclient tests (see libnetclient/README; default=false)')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..1076a89
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,10 @@
+# po/meson.build
+
+langs = ['am', 'ar', 'az', 'bg', 'ca', 'cs', 'da', 'de', 'dz', 'el',
+         'en_CA', 'en_GB', 'es', 'et', 'eu', 'fi', 'fr', 'ga', 'gl',
+         'he', 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'ko', 'lt', 'lv',
+         'mk', 'ml', 'ms', 'nb', 'ne', 'nl', 'nn', 'oc', 'pa', 'pl',
+         'pt', 'pt_BR', 'ro', 'ru', 'rw', 'sk', 'sl', 'sq', 'sr', 'sr@latin',
+         'sv', 'tr', 'uk', 'vi', 'wa', 'zh_CN', 'zh_HK', 'zh_TW']
+
+i18n.gettext(gettext_package, preset : 'glib', languages : langs)
diff --git a/sounds/meson.build b/sounds/meson.build
new file mode 100644
index 0000000..abb4eb2
--- /dev/null
+++ b/sounds/meson.build
@@ -0,0 +1,14 @@
+# sounds/meson.build
+
+balsa_sounds = ['startup.wav', 'newmail.wav']
+
+balsasoundsdir = join_paths(get_option('datadir'), 'sounds', 'balsa')
+install_data(balsa_sounds, install_dir : balsasoundsdir)
+
+soundlistdir = join_paths(get_option('sysconfdir'), 'sound', 'events')
+i18n.merge_file(input       : 'balsa.soundlist.in',
+                output      : 'balsa.soundlist',
+                type        : 'desktop',
+                po_dir      : '../po',
+                install     : true,
+                install_dir : soundlistdir)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..49510c8
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,129 @@
+# src/meson.build
+
+balsa_base_srclist = [
+  'address-book-config.c',
+  'address-book-config.h',
+  'ab-window.c',
+  'ab-window.h',
+  'balsa-app.c',
+  'balsa-app.h',
+  'balsa-icons.c',
+  'balsa-icons.h',
+  'balsa-index.c',
+  'balsa-index.h',
+  'balsa-mblist.c',
+  'balsa-mblist.h',
+  'balsa-message.c',
+  'balsa-message.h',
+  'balsa-mime-widget.c',
+  'balsa-mime-widget.h',
+  'balsa-mime-widget-callbacks.c',
+  'balsa-mime-widget-callbacks.h',
+  'balsa-mime-widget-crypto.c',
+  'balsa-mime-widget-crypto.h',
+  'balsa-mime-widget-image.c',
+  'balsa-mime-widget-image.h',
+  'balsa-mime-widget-message.c',
+  'balsa-mime-widget-message.h',
+  'balsa-mime-widget-multipart.c',
+  'balsa-mime-widget-multipart.h',
+  'balsa-mime-widget-text.c',
+  'balsa-mime-widget-text.h',
+  'balsa-mime-widget-vcalendar.c',
+  'balsa-mime-widget-vcalendar.h',
+  'balsa-cite-bar.c',
+  'balsa-cite-bar.h',
+  'filter-edit-callbacks.c',
+  'filter-edit-dialog.c',
+  'filter-edit.h',
+  'filter-export-callbacks.c',
+  'filter-export-dialog.c',
+  'filter-export.h',
+  'filter-run-callbacks.c',
+  'filter-run-dialog.c',
+  'filter-run.h',
+  'folder-conf.c',
+  'folder-conf.h',
+  'information-dialog.c',
+  'information-dialog.h',
+  'mailbox-conf.c',
+  'mailbox-conf.h',
+  'mailbox-node.c',
+  'mailbox-node.h',
+  'main-window.c',
+  'main-window.h',
+  'main.c',
+  'message-window.c',
+  'message-window.h',
+  'pref-manager.c',
+  'pref-manager.h',
+  'print.h',
+  'quote-color.c',
+  'quote-color.h',
+  'save-restore.c',
+  'save-restore.h',
+  'sendmsg-window.c',
+  'sendmsg-window.h',
+  'store-address.c',
+  'store-address.h',
+  'threads.h',
+  'toolbar-factory.c',
+  'toolbar-factory.h',
+  'toolbar-prefs.c',
+  'toolbar-prefs.h'
+  ]
+
+balsa_print_source = [
+  'print-gtk.c',
+  'balsa-print-object.c',
+  'balsa-print-object.h',
+  'balsa-print-object-decor.c',
+  'balsa-print-object-decor.h',
+  'balsa-print-object-default.c',
+  'balsa-print-object-default.h',
+  'balsa-print-object-header.c',
+  'balsa-print-object-header.h',
+  'balsa-print-object-image.c',
+  'balsa-print-object-image.h',
+  'balsa-print-object-text.c',
+  'balsa-print-object-text.h'
+  ]
+
+balsa_sources = balsa_base_srclist + balsa_print_source
+if use_spell_checker == 'internal'
+  balsa_spell_extra = [
+    'spell-check.c',
+    'spell-check.h'
+    ]
+  balsa_sources += balsa_spell_extra
+endif
+
+locale_dir = join_paths(get_option('prefix'), get_option('datadir'), 'locale')
+balsa_compile_args = ['-DGNOMELOCALEDIR="' + locale_dir + '"',
+                      '-I' + meson.build_root(),
+                      '-I' + meson.source_root(),
+                      '-I' + join_paths(meson.source_root(), 'libbalsa'),
+                      '-I' + join_paths(meson.source_root(), 'libnetclient')]
+
+real_balsa_deps = declare_dependency(compile_args : balsa_compile_args,
+                                     dependencies : balsa_deps)
+real_balsa_libs = [libinit_balsa_a, libbalsa_a, libimap_a, libnetclient_a]
+
+executable('balsa', balsa_sources,
+           dependencies : real_balsa_deps,
+           link_with    : real_balsa_libs)
+
+balsa_ab_sources = [
+  'ab-main.c',
+  'address-book-config.c'
+  ]
+
+balsa_ab_compile_args = ['-I' + meson.build_root(),
+                         '-I' + join_paths(meson.source_root(), 'libbalsa')]
+
+real_balsa_ab_deps = declare_dependency(compile_args : balsa_ab_compile_args,
+                                        dependencies : balsa_ab_deps)
+
+executable('balsa_ab', balsa_ab_sources,
+           dependencies : real_balsa_ab_deps,
+           link_with    : libbalsa_a)
diff --git a/ui/meson.build b/ui/meson.build
new file mode 100644
index 0000000..871b413
--- /dev/null
+++ b/ui/meson.build
@@ -0,0 +1,12 @@
+# ui/meson.build
+
+balsa_ui_files = [
+  'source-viewer.ui',
+  'main-window.ui',
+  'message-window.ui',
+  'sendmsg-window.ui',
+  'ab-main.ui'
+  ]
+
+balsa_uidir = get_option('datadir') + 'ui'
+install_data(balsa_ui_files, install_dir : balsa_uidir)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]