aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/ChangeLog6
-rw-r--r--m4/readline.m423
2 files changed, 28 insertions, 1 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index 81fdcec0..17c482cb 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * readline.m4: Enable cross compiling. Thanks to
+ Christer Solskogen <christer.solskogen@gmail.com> for
+ motivating and testing.
+
2014-04-08 Arnold D. Robbins <arnold@skeeve.com>
* 4.1.1: Release tar ball made.
diff --git a/m4/readline.m4 b/m4/readline.m4
index 77ed8b25..740b9c7b 100644
--- a/m4/readline.m4
+++ b/m4/readline.m4
@@ -62,7 +62,28 @@ dnl action if true:
dnl action if false:
[_found_readline=no],
dnl action if cross compiling:
- [_found_readline=no]
+ AC_TRY_LINK([#include <stdio.h>
+#include <readline/readline.h>
+#include <readline/history.h>], dnl includes
+ dnl function body
+ [
+ int fd;
+ char *line;
+
+ close(0);
+ close(1);
+ fd = open("/dev/null", 2); /* should get fd 0 */
+ dup(fd);
+ line = readline("giveittome> ");
+
+ /* some printfs don't handle NULL for %s */
+ printf("got <%s>\n", line ? line : "(NULL)");
+],
+dnl action if found:
+ [_found_readline=yes],
+dnl action if not found:
+ [_found_readline=no]
+ )
)
AC_MSG_RESULT([$_found_readline])