]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: properly handle readline if it's explicitly disabled
authorPavel Hrdina <phrdina@redhat.com>
Thu, 8 Oct 2020 11:24:55 +0000 (13:24 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Fri, 9 Oct 2020 11:44:54 +0000 (13:44 +0200)
If readline is detected using pkg-config it would ignore the readline
option.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
meson.build

index ec252ddf39dda10c01081b386028a4c05b4a7519..d5694fd0b6e0d9397a334e3b9e1cf49ae385aa7c 100644 (file)
@@ -1243,26 +1243,30 @@ endif
 
 # readline 7.0 is the first version which includes pkg-config support
 readline_version = '7.0'
-readline_dep = dependency('readline', version: '>=' + readline_version, required: false)
-if not readline_dep.found()
-  readline_dep = cc.find_library('readline', required: get_option('readline'))
-
-  if readline_dep.found()
-    # This variable is present in all reasonable (5.0+) readline versions;
-    # however, the macOS base system contains a library called libedit which
-    # takes over the readline name despite lacking many of its features. We
-    # want to make sure we only enable readline support when linking against
-    # the actual readline library, and the availability of this specific
-    # variable is as good a witness for that fact as any.
-    correct_rl = cc.has_header_symbol('readline/readline.h', 'rl_completion_quote_character', prefix: '#include <stdio.h>')
-    if not correct_rl
-      if get_option('readline').enabled()
-        error('readline is missing rl_completion_quote_character')
-      else
-        readline_dep = dependency('', required: false)
+if not get_option('readline').disabled()
+  readline_dep = dependency('readline', version: '>=' + readline_version, required: false)
+  if not readline_dep.found()
+    readline_dep = cc.find_library('readline', required: get_option('readline'))
+
+    if readline_dep.found()
+      # This variable is present in all reasonable (5.0+) readline versions;
+      # however, the macOS base system contains a library called libedit which
+      # takes over the readline name despite lacking many of its features. We
+      # want to make sure we only enable readline support when linking against
+      # the actual readline library, and the availability of this specific
+      # variable is as good a witness for that fact as any.
+      correct_rl = cc.has_header_symbol('readline/readline.h', 'rl_completion_quote_character', prefix: '#include <stdio.h>')
+      if not correct_rl
+        if get_option('readline').enabled()
+          error('readline is missing rl_completion_quote_character')
+        else
+          readline_dep = dependency('', required: false)
+        endif
       endif
     endif
   endif
+else
+  readline_dep = dependency('', required: false)
 endif
 if readline_dep.found()
   # Gross kludge for readline include path obtained through pkg-config.