X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=config%2Fconfigure;fp=config%2Fconfigure;h=916bec371ea8864f563e5b422aa6962ef374cbfc;hb=8f1a5aace7788ee23fb67530252ba434f35e7c51;hp=33670dd45ed12584e3612a8eacd0cbe676e194a2;hpb=5a472d6aaa2922939b28bfc8186e7341ec1fc222;p=bup.git diff --git a/config/configure b/config/configure index 33670dd..916bec3 100755 --- a/config/configure +++ b/config/configure @@ -179,17 +179,26 @@ TLOGN "checking for readline" bup_have_readline='' bup_readline_includes_in_subdir='' bup_readline_via_pkg_config='' +# We test this specific thing because it should work everywhere and it was +# a particulary problem on macos (we'd get the wrong includes if we just +# tested that the includes work). +readline_test_code=' + static char *on_completion_entry(const char *text, int state) { return NULL; } + void bup_test(void) { rl_completion_entry_function = on_completion_entry; } +' if pkg-config readline; then bup_readline_cflags="$(pkg-config readline --cflags)" || exit $? bup_readline_ldflags="$(pkg-config readline --libs)" || exit $? # It looks like it's not uncommon for pkg-config to provide a -I # that doesn't support the documentation's specified #include # . See what's really going on. - if bup_try_c_code '#include ' "$bup_readline_cflags" + if bup_try_c_code "#include $readline_test_code" \ + "$bup_readline_cflags" then bup_have_readline=1 bup_readline_includes_in_subdir=1 - elif bup_try_c_code '#include ' "$bup_readline_cflags" + elif bup_try_c_code "#include $readline_test_code" \ + "$bup_readline_cflags" then bup_have_readline=1 fi @@ -201,11 +210,11 @@ if pkg-config readline; then fi fi if ! test "$bup_have_readline"; then - if bup_try_c_code '#include '; then + if bup_try_c_code "#include $readline_test_code"; then bup_readline_ldflags=-lreadline bup_have_readline=1 bup_readline_includes_in_subdir=1 - elif bup_try_c_code '#include '; then + elif bup_try_c_code "#include $readline_test_code"; then bup_readline_ldflags=-lreadline bup_have_readline=1 fi