Skip to content

Commit

Permalink
Fix autoconf checking for readline
Browse files Browse the repository at this point in the history
Xcode 12 now enforces `-Werror -Wimplicit-function-declaration` by
default and using `exit()` without including the header `<stdlib.h>`
causes a compilation error. This prevents autoconf from identifying
readline version on macOS Catalina and Big Sur.

Use `return` instead of `exit()`.

Fixes #1072
  • Loading branch information
koutcher committed Feb 17, 2021
1 parent 2d82ec2 commit cbc1462
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/ax_lib_readline.m4
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ AC_CACHE_VAL(ac_cv_rl_version,
extern int rl_gnu_readline_p;
main()
int main(void)
{
FILE *fp;
fp = fopen("conftest.rlv", "w");
if (fp == 0)
exit(1);
${cf_cv_main_return:-return}(1);
if (rl_gnu_readline_p != 1)
fprintf(fp, "0.0\n");
else
fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
fclose(fp);
exit(0);
${cf_cv_main_return:-return}(0);
}
]])],
ac_cv_rl_version=`cat conftest.rlv`,
Expand Down

0 comments on commit cbc1462

Please sign in to comment.