summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2011-02-28 11:16:06 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2011-02-28 11:16:06 +0000
commite5dc4c2d8efbff77f4060fe9e6430f9e39947317 (patch)
tree86e3bc1b3cf282c7e87576d7f636bca0500eb922 /configure.ac
parent008aa0e3b8bbd962ef9e25feab3c87421c0c3344 (diff)
Merged revisions 309035 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r309035 | tilghman | 2011-02-28 05:10:28 -0600 (Mon, 28 Feb 2011) | 15 lines Merged revisions 309033-309034 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r309033 | tilghman | 2011-02-28 04:43:12 -0600 (Mon, 28 Feb 2011) | 4 lines A later version of flex already includes the fwrite workaround code, which if used twice causes a compilation error. Detect whether Flex will compile without the workaround; if so, suppress our workaround code. ........ r309034 | tilghman | 2011-02-28 05:07:52 -0600 (Mon, 28 Feb 2011) | 2 lines Clarify meaning, removing double negative (stupid!) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@309036 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac41
1 files changed, 41 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 9e8a2df81..763cd1a22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,6 +301,47 @@ __EOL__
rm -rf ${tmp}
fi
])
+AC_CACHE_CHECK([for flex that ignores fwrite return value], [ac_cv_FLEX_WORKAROUND], [
+ if test "x$FLEX" != "x:" ; then
+ # Create a temporary directory $tmp in $TMPDIR (default /tmp).
+ # Use mktemp if possible; otherwise fall back on mkdir,
+ # with $RANDOM to make collisions less likely.
+ : ${TMPDIR=/tmp}
+ {
+ tmp=`
+ (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
+ ` &&
+ test -n "$tmp" && test -d "$tmp"
+ } || {
+ tmp=$TMPDIR/foo$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+ } || exit $?
+ cat >$tmp/test.fl <<__EOL__
+%{
+#include <unistd.h>
+#include <stdio.h>
+static void yyunput (int c,char *buf_ptr ) __attribute__((unused));
+static int input(void) __attribute__((unused));
+%}
+
+%%
+username printf( "%s", getlogin() );
+__EOL__
+ ${FLEX} -o ${tmp}/test.c ${tmp}/test.fl
+ ${CC} -o ${tmp}/test.o -c ${tmp}/test.c -Wall -Werror >/dev/null 2>&1
+ if test -e "${tmp}/test.o"; then
+ ac_cv_FLEX_WORKAROUND=no
+ else
+ ac_cv_FLEX_WORKAROUND=yes
+ fi
+ rm -rf ${tmp}
+ fi
+ ])
+
+if test "x${ac_cv_FLEX_WORKAROUND}" = "xyes"; then
+ AC_DEFINE([NEED_FLEX_FWRITE_WORKAROUND], 1, [Define to 1 if your system has a version of flex that does not check the return value of fwrite.])
+fi
+
if test "x${ac_cv_path_BISON2}" = "x" ; then
BISON=:
PBX_BISON=0