~vcs-imports/gawk/master

« back to all changes in this revision

Viewing changes to m4/readline.m4

  • Committer: Arnold D. Robbins
  • Date: 2021-09-10 09:17:33 UTC
  • mfrom: (1472.2.20)
  • Revision ID: git-v1:dcb93a4544f44beb127248327818f6bbdbe18043
Merge branch 'gawk-5.1-stable'

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
AC_DEFUN([GAWK_CHECK_READLINE],
20
20
[
21
21
  AC_ARG_WITH([readline],
22
 
     AC_HELP_STRING([--with-readline=DIR],
 
22
     AS_HELP_STRING([--with-readline=DIR],
23
23
        [look for the readline library in DIR]),
24
24
     [_do_readline=$withval],[_do_readline=yes])
25
25
 
34
34
        _combo="-lreadline${_termcap:+ $_termcap}"
35
35
        LIBS="$LIBS $_combo"
36
36
 
37
 
        AC_MSG_CHECKING([whether readline via \"$_combo\" is present and sane])
 
37
        AC_MSG_CHECKING([whether readline via "$_combo" is present and sane])
38
38
 
39
 
        AC_TRY_RUN(
 
39
        AC_RUN_IFELSE(
40
40
dnl source program:
41
 
AC_LANG_SOURCE([[#include <stdio.h>
 
41
[AC_LANG_SOURCE([[#include <stdio.h>
42
42
#include <fcntl.h>
43
43
#include <unistd.h>
44
44
#include <readline/readline.h>
58
58
        /* some printfs don't handle NULL for %s */
59
59
        printf("got <%s>\n", line ? line : "(NULL)");
60
60
        return 0;
61
 
}]]),
 
61
}]])],
62
62
dnl action if true:
63
63
            [_found_readline=yes],
64
64
dnl action if false:
65
65
            [_found_readline=no],
66
66
dnl action if cross compiling:
67
 
                AC_TRY_LINK([#include <stdio.h>
 
67
                [AC_LINK_IFELSE(
 
68
                        [AC_LANG_PROGRAM([[#include <stdio.h>
68
69
#include <readline/readline.h>
69
 
#include <readline/history.h>],         dnl includes
 
70
#include <readline/history.h>]],                dnl includes
70
71
                        dnl function body
71
 
                        [
 
72
                        [[
72
73
        int fd;
73
74
        char *line;
74
75
 
80
81
 
81
82
        /* some printfs don't handle NULL for %s */
82
83
        printf("got <%s>\n", line ? line : "(NULL)");
83
 
],
 
84
]])],
84
85
dnl action if found:
85
86
                        [_found_readline=yes],
86
87
dnl action if not found:
87
88
                        [_found_readline=no]
88
 
                )
 
89
                )]
89
90
        )
90
91
 
91
92
        AC_MSG_RESULT([$_found_readline])