]> arthur.barton.de Git - bup.git/commitdiff
configure: fix readline.h detection
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 24 Jan 2021 20:22:32 +0000 (21:22 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 18 Apr 2021 17:27:10 +0000 (12:27 -0500)
Unfortunately, readline.h requires stdio.h to be included first,
except where it has been patched (e.g. Debian). Do that in the
configure script so we correctly detect readline.h on systems
that have an unpatched readline version.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
config/configure

index d8f6b4b8ec430bf631d9dbc150332da01085ddba..31a43e105a243a03aed1d08feb7d2214f80a2a1b 100755 (executable)
@@ -236,12 +236,16 @@ if pkg-config readline; then
     # It looks like it's not uncommon for pkg-config to provide a -I
     # that doesn't support the documentation's specified #include
     # <readline/readline.h>.  See what's really going on.
-    if bup_try_c_code "#include <readline/readline.h> $readline_test_code" \
+    if bup_try_c_code "#include <stdio.h> // required by unpatched readline
+#include <readline/readline.h>
+$readline_test_code" \
                       "$bup_readline_cflags"
     then
         bup_have_readline=1
         bup_readline_includes_in_subdir=1
-    elif bup_try_c_code "#include <readline.h> $readline_test_code" \
+    elif bup_try_c_code "#include <stdio.h> // required by unpatched readline
+#include <readline.h>
+$readline_test_code" \
                         "$bup_readline_cflags"
     then
         bup_have_readline=1