build: remove unneeded variables

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2021-09-13 10:09:45 +02:00
parent c6ea1dec85
commit 4ad3a929d9
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
3 changed files with 17 additions and 22 deletions

View File

@ -179,10 +179,8 @@ foreach decl : [
] ]
# We get -1 if the size cannot be determined # We get -1 if the size cannot be determined
have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 if cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
conf.set10('HAVE_' + decl.underscorify().to_upper(), true)
if have == true
conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
endif endif
endforeach endforeach
@ -228,9 +226,8 @@ foreach ident : [
#include <sys/resource.h>'''], #include <sys/resource.h>'''],
] ]
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') if cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
if have == true conf.set10('HAVE_' + ident[0].to_upper(), true)
conf.set10('HAVE_' + ident[0].to_upper(), have)
endif endif
endforeach endforeach
@ -259,10 +256,8 @@ if libseccomp.found()
] ]
# We get -1 if the size cannot be determined # We get -1 if the size cannot be determined
have = cc.sizeof(decl, prefix : seccomp_headers, args : '-D_GNU_SOURCE') > 0 if cc.sizeof(decl, prefix : seccomp_headers, args : '-D_GNU_SOURCE') > 0
conf.set10('HAVE_' + decl.underscorify().to_upper(), true)
if have == true
conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
endif endif
endforeach endforeach
endif endif

View File

@ -7,7 +7,7 @@ include_sources = files(
'netns_ifaddrs.h') 'netns_ifaddrs.h')
if cc.has_function('getline', prefix : '#include <stdio.h>', args : '-D_GNU_SOURCE') if cc.has_function('getline', prefix : '#include <stdio.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_GETLINE', have) conf.set10('HAVE_GETLINE', true)
else else
include_sources += files( include_sources += files(
'getline.c', 'getline.c',
@ -15,7 +15,7 @@ else
endif endif
if cc.has_function('fexecve', prefix : '#include <unistd.h>', args : '-D_GNU_SOURCE') if cc.has_function('fexecve', prefix : '#include <unistd.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_FEXECVE', have) conf.set10('HAVE_FEXECVE', true)
else else
include_sources += files( include_sources += files(
'fexecve.c', 'fexecve.c',
@ -29,7 +29,7 @@ getgr_headers = '''
''' '''
if cc.has_function('getgrgid_r', prefix : getgr_headers, args : '-D_GNU_SOURCE') if cc.has_function('getgrgid_r', prefix : getgr_headers, args : '-D_GNU_SOURCE')
conf.set10('HAVE_GETGRGID_R', have) conf.set10('HAVE_GETGRGID_R', true)
else else
include_sources += files( include_sources += files(
'getgrgid_r.c', 'getgrgid_r.c',
@ -43,17 +43,17 @@ mntent_headers = '''
have_hasmntopt = cc.has_function('hasmntopt', prefix : mntent_headers, args : '-D_GNU_SOURCE') have_hasmntopt = cc.has_function('hasmntopt', prefix : mntent_headers, args : '-D_GNU_SOURCE')
if have_hasmntopt if have_hasmntopt
conf.set10('HAVE_HASMNTOPT', have) conf.set10('HAVE_HASMNTOPT', true)
endif endif
have_setmntent = cc.has_function('setmntent', prefix : mntent_headers, args : '-D_GNU_SOURCE') have_setmntent = cc.has_function('setmntent', prefix : mntent_headers, args : '-D_GNU_SOURCE')
if have_setmntent if have_setmntent
conf.set10('HAVE_SETMNTENT', have) conf.set10('HAVE_SETMNTENT', true)
endif endif
have_endmntent = cc.has_function('endmntent', prefix : mntent_headers, args : '-D_GNU_SOURCE') have_endmntent = cc.has_function('endmntent', prefix : mntent_headers, args : '-D_GNU_SOURCE')
if have_endmntent if have_endmntent
conf.set10('HAVE_ENDMNTENT', have) conf.set10('HAVE_ENDMNTENT', true)
endif endif
if have_hasmntopt == false or have_setmntent == false or have_endmntent == false if have_hasmntopt == false or have_setmntent == false or have_endmntent == false
@ -63,7 +63,7 @@ if have_hasmntopt == false or have_setmntent == false or have_endmntent == false
endif endif
if cc.has_function('strlcpy', prefix : '#include <string.h>', args : '-D_GNU_SOURCE') if cc.has_function('strlcpy', prefix : '#include <string.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_STRLCPY', have) conf.set10('HAVE_STRLCPY', true)
else else
include_sources += files( include_sources += files(
'strlcpy.c', 'strlcpy.c',
@ -71,7 +71,7 @@ else
endif endif
if cc.has_function('strlcat', prefix : '#include <string.h>', args : '-D_GNU_SOURCE') if cc.has_function('strlcat', prefix : '#include <string.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_STRLCAT', have) conf.set10('HAVE_STRLCAT', true)
else else
include_sources += files( include_sources += files(
'strlcat.c', 'strlcat.c',
@ -79,7 +79,7 @@ else
endif endif
if cc.has_function('strchrnul', prefix : '#include <string.h>', args : '-D_GNU_SOURCE') if cc.has_function('strchrnul', prefix : '#include <string.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_STRCHRNUL', have) conf.set10('HAVE_STRCHRNUL', true)
else else
include_sources += files( include_sources += files(
'strchrnul.c', 'strchrnul.c',
@ -87,7 +87,7 @@ else
endif endif
if cc.has_function('openpty', prefix : '#include <pty.h>', args : '-D_GNU_SOURCE') if cc.has_function('openpty', prefix : '#include <pty.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_OPENPTY', have) conf.set10('HAVE_OPENPTY', true)
else else
include_sources += files( include_sources += files(
'openpty.c', 'openpty.c',

View File

@ -135,7 +135,7 @@ tools_lxc_console_sources = files(
'lxc_console.c') + tools_common_sources 'lxc_console.c') + tools_common_sources
if cc.has_function('getsubopt', prefix : '#include <stdlib.h>', args : '-D_GNU_SOURCE') if cc.has_function('getsubopt', prefix : '#include <stdlib.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_GETSUBOPT', have) conf.set10('HAVE_GETSUBOPT', true)
else else
include_sources += files( include_sources += files(
'tools/include/getsubopt.c', 'tools/include/getsubopt.c',