Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ top_inc = include_directories('.')

cc = meson.get_compiler('c')

config_h = configuration_data()
config_data = configuration_data()

# defines
set_defines = [
Expand All @@ -79,11 +79,11 @@ set_defines = [
]

foreach define: set_defines
config_h.set_quoted(define[0], define[1])
config_data.set_quoted(define[0], define[1])
endforeach

# Globally define_GNU_SOURCE and therefore enable the GNU extensions
config_h.set('_GNU_SOURCE', true)
config_data.set('_GNU_SOURCE', true)

# functions
check_functions = [
Expand All @@ -93,19 +93,17 @@ check_functions = [
]

foreach func: check_functions
config_h.set('HAVE_' + func.to_upper(), cc.has_function(func))
config_data.set('HAVE_' + func.to_upper(), cc.has_function(func))
endforeach

# compiler flags
common_c_flags = [
compiler_common_flags = []
compiler_c_flags = [
# FIXME: this should go as 'c_std=c99' in project's default_options.
# https://github.com/mesonbuild/meson/issues/1889
# https://github.com/mesonbuild/meson/pull/6729
'-std=c99',
'-DHAVE_CONFIG_H',
]
compiler_flags = []
compiler_c_flags = []
compiler_cpp_flags = []

if get_option('buildtype').contains('debug')
compiler_c_flags += cc.get_supported_arguments([
Expand All @@ -121,8 +119,6 @@ if get_option('buildtype').contains('debug')
])
endif

add_project_arguments(common_c_flags + compiler_c_flags, language: 'c')

glib_req_version = '>= 2.30.0'

gio_dep = dependency('gio-2.0', version: glib_req_version)
Expand Down Expand Up @@ -151,13 +147,13 @@ if js_engine == 'duktape'
libm_dep = cc.find_library('m')
thread_dep = dependency('threads')
func = 'pthread_condattr_setclock'
config_h.set('HAVE_' + func.to_upper(), cc.has_function(func, prefix : '#include <pthread.h>'))
config_data.set('HAVE_' + func.to_upper(), cc.has_function(func, prefix : '#include <pthread.h>'))
elif js_engine == 'mozjs'
js_dep = dependency('mozjs-115')

_system = host_machine.system().to_lower()
if _system.contains('freebsd')
config_h.set('__BSD_VISIBLE', 1)
config_data.set('__BSD_VISIBLE', 1)
endif
endif

Expand All @@ -172,12 +168,12 @@ endif

# check OS
host_system = host_machine.system()
config_h.set('HAVE_' + host_system.to_upper(), true)
config_data.set('HAVE_' + host_system.to_upper(), true)

# Check whether setnetgrent has a return value
config_h.set('HAVE_NETGROUP_H', cc.has_header('netgroup.h'))
config_data.set('HAVE_NETGROUP_H', cc.has_header('netgroup.h'))

if config_h.get('HAVE_SETNETGRENT', false)
if config_data.get('HAVE_SETNETGRENT', false)
setnetgrent_return_src = '''
#include <stddef.h>
#ifdef HAVE_NETGROUP_H
Expand All @@ -190,7 +186,7 @@ if config_h.get('HAVE_SETNETGRENT', false)
};
'''

config_h.set('HAVE_SETNETGRENT_RETURN', cc.compiles(setnetgrent_return_src, name: 'setnetgrent return support'))
config_data.set('HAVE_SETNETGRENT_RETURN', cc.compiles(setnetgrent_return_src, name: 'setnetgrent return support'))
endif

# Select wether to use logind, elogind or ConsoleKit for session tracking
Expand All @@ -214,11 +210,11 @@ if enable_logind
endif

func = 'sd_uid_get_display'
config_h.set10('HAVE_' + func.to_upper(), cc.has_function(func, dependencies: logind_dep))
config_data.set10('HAVE_' + func.to_upper(), cc.has_function(func, dependencies: logind_dep))
func = 'sd_pidfd_get_session'
config_h.set10('HAVE_' + func.to_upper(), cc.has_function(func, dependencies: logind_dep))
config_data.set10('HAVE_' + func.to_upper(), cc.has_function(func, dependencies: logind_dep))
endif
config_h.set('HAVE_LIBSYSTEMD', enable_logind)
config_data.set('HAVE_LIBSYSTEMD', enable_logind)

systemd_dep = dependency('systemd').found()
if systemd_dep
Expand All @@ -232,14 +228,14 @@ if systemd_dep
)
endif

config_h.set('HAVE_PIDFD_OPEN', cc.get_define('SYS_pidfd_open', prefix: '#include <sys/syscall.h>') != '')
config_data.set('HAVE_PIDFD_OPEN', cc.get_define('SYS_pidfd_open', prefix: '#include <sys/syscall.h>') != '')

# User for running polkitd
polkitd_user = get_option('polkitd_user')
config_h.set_quoted('POLKITD_USER', polkitd_user)
config_data.set_quoted('POLKITD_USER', polkitd_user)

polkitd_uid = get_option('polkitd_uid')
config_h.set('POLKITD_UID', polkitd_uid)
config_data.set('POLKITD_UID', polkitd_uid)

# Select which authentication framework to use
auth_deps = []
Expand All @@ -265,7 +261,7 @@ if enable_pam
# FIXME: Not necessary anymore?
if cc.compiles(pam_strerror_src.format('pam_handle_t *pamh = 0; char *s = pam_strerror(pamh, PAM_SUCCESS);'))
# FIXME: unused?
config_h.set('PAM_STRERROR_TWO_ARGS', true)
config_data.set('PAM_STRERROR_TWO_ARGS', true)
else
message('how to call pam_strerror: ' + cc.compiles(pam_strerror_src.format('char *s = pam_strerror(PAM_SUCCESS);')).to_string('1', 'unknown'))
endif
Expand All @@ -286,7 +282,7 @@ if enable_pam
elif auth_fw == 'shadow'
auth_deps += cc.find_library('crypt')
endif
config_h.set('POLKIT_AUTHFW_' + auth_fw.to_upper(), true)
config_data.set('POLKIT_AUTHFW_' + auth_fw.to_upper(), true)

# FIXME: sigtimedwait is not used anywhere?
'''
Expand Down Expand Up @@ -367,6 +363,16 @@ if enable_introspection
dependency('gobject-introspection-1.0', version: '>= 0.6.2')
endif

configure_file(
output: 'config.h',
configuration: config_data,
)

compiler_common_flags += ['-include', 'config.h']

add_project_arguments(compiler_common_flags + compiler_c_flags, language: 'c')
add_project_arguments(compiler_common_flags + compiler_cpp_flags, language: 'cpp')

content_files = files('COPYING')

subdir('actions')
Expand All @@ -380,12 +386,6 @@ if enable_tests
subdir('test')
endif

configure_file(
output: 'config.h',
configuration: config_h,
)


if not libs_only
meson.add_install_script(
'meson_post_install.py',
Expand Down
1 change: 0 additions & 1 deletion src/examples/cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* authentication dialog is removed.
*/

#include "config.h"
#include <polkit/polkit.h>

static gboolean
Expand Down
2 changes: 0 additions & 2 deletions src/examples/frobnicate.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#include "config.h"

#include <glib.h>
#include <unistd.h>
#include <stdlib.h>
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitactiondescription.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>
#include "polkitimplicitauthorization.h"
#include "polkitactiondescription.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitauthority.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "polkitauthorizationresult.h"
#include "polkitcheckauthorizationflags.h"
#include "polkitauthority.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitauthorityfeatures.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "polkitcheckauthorizationflags.h"
#include "polkitprivate.h"

Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitauthorizationresult.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "polkitauthorizationresult.h"
#include "polkitdetails.h"
#include "polkitprivate.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitcheckauthorizationflags.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "polkitcheckauthorizationflags.h"
#include "polkitprivate.h"

Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitdetails.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>
#include "polkitimplicitauthorization.h"
#include "polkitdetails.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkiterror.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "polkiterror.h"
#include "polkitprivate.h"

Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitidentity.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>

#include "polkitidentity.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitimplicitauthorization.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>

#include "polkitimplicitauthorization.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitpermission.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
* David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#ifdef HAVE_LIBSYSTEMD
# include <systemd/sd-login.h>
#endif
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitsubject.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>
#include <stdio.h>

Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitsystembusname.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>
#include <gio/gunixfdlist.h>
#include "polkitsystembusname.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkittemporaryauthorization.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>
#include "polkitimplicitauthorization.h"
#include "polkittemporaryauthorization.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitunixgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>
#include <grp.h>
#include <errno.h>
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitunixnetgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
* Author: Nikki VonHollen <vonhollen@google.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>
#include <errno.h>
#include "polkitunixnetgroup.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitunixprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <sys/types.h>
#ifdef HAVE_FREEBSD
#include <sys/param.h>
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitunixsession-systemd.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: Matthias Clasen
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdlib.h>
#include <string.h>
#include "polkitunixsession.h"
Expand Down
4 changes: 0 additions & 4 deletions src/polkit/polkitunixsession.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* Author: David Zeuthen <davidz@redhat.com>
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <string.h>
#include "polkitunixsession.h"
#include "polkitsubject.h"
Expand Down
Loading