mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-08-02 11:16:21 +00:00
build: simplify readline detection
This commit is contained in:
47
meson.build
47
meson.build
@@ -122,40 +122,25 @@ endforeach
|
|||||||
# we need to declare the variable before
|
# we need to declare the variable before
|
||||||
# using it in the conditional branch.
|
# using it in the conditional branch.
|
||||||
# Later the required is set correctly.
|
# Later the required is set correctly.
|
||||||
readline_dep = dependency('', required: false)
|
readline_dep = dependency('readline', required: false)
|
||||||
|
|
||||||
if platform == 'osx'
|
if not readline_dep.found()
|
||||||
brew = find_program('brew', required: false, dirs: ['/opt/homebrew/bin', '/usr/local/bin'])
|
if platform == 'osx'
|
||||||
|
# brew prefix
|
||||||
if brew.found()
|
brew = find_program('brew', required: false)
|
||||||
readline_prefix_cmd = run_command(brew, '--prefix', 'readline', check: false)
|
if brew.found()
|
||||||
if readline_prefix_cmd.returncode() == 0
|
prefix = run_command(brew, '--prefix', 'readline', check: false).stdout().strip()
|
||||||
readline_prefix = readline_prefix_cmd.stdout().strip()
|
readline_dep = cc.find_library('readline', dirs: [prefix / 'lib'], required: true)
|
||||||
else
|
add_project_arguments('-I' + prefix / 'include', language: 'c')
|
||||||
readline_prefix = '/usr/local'
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if run_command('test', '-f', '/opt/local/lib/libreadline.dylib', check: false).returncode() == 0
|
|
||||||
readline_prefix = '/opt/local'
|
|
||||||
else
|
|
||||||
readline_prefix = '/usr/local'
|
|
||||||
endif
|
endif
|
||||||
|
elif platform == 'openbsd'
|
||||||
|
# ereadline alias
|
||||||
|
readline_dep = cc.find_library('ereadline', dirs: ['/usr/local/lib'], required: false)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
readline_dep = cc.find_library('readline',
|
|
||||||
dirs: [readline_prefix / 'lib'],
|
# regular
|
||||||
required: true)
|
if not readline_dep.found()
|
||||||
add_project_arguments('-I' + readline_prefix / 'include', language: 'c')
|
|
||||||
elif platform == 'openbsd'
|
|
||||||
if run_command('test', '-d', '/usr/local/include/ereadline', check: false).returncode() == 0
|
|
||||||
readline_dep = cc.find_library('ereadline',
|
|
||||||
dirs: ['/usr/local/lib'],
|
|
||||||
required: true)
|
|
||||||
add_project_arguments('-I/usr/local/include/ereadline', language: 'c')
|
|
||||||
else
|
|
||||||
readline_dep = cc.find_library('readline', required: true)
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
readline_dep = cc.find_library('readline', required: true)
|
readline_dep = cc.find_library('readline', required: true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user