aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-10-30 20:49:19 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-10-30 20:49:19 +0200
commite982e87ced45d48d23ffc86fa0b6cf6fabfbef8d (patch)
tree769a5bc0e1ed969333e2e794710ff51759e8396b /m4
parent3b13df110f42b26417de73151eb4a03657e85de4 (diff)
downloadegawk-e982e87ced45d48d23ffc86fa0b6cf6fabfbef8d.tar.gz
egawk-e982e87ced45d48d23ffc86fa0b6cf6fabfbef8d.tar.bz2
egawk-e982e87ced45d48d23ffc86fa0b6cf6fabfbef8d.zip
Enable cross-compiling for readline during configuring.
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])