From dfd04662914948732d28178222de455da982ed08 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 13 Apr 2010 15:43:58 +0000 Subject: [PATCH] More carefully checking for libreadline suitability --- acinclude.m4 | 35 +++++++++++++++++++++++++++++++++++ configure.ac | 19 ++++++++++++++----- xorriso/configure_ac.txt | 14 ++++++++++++-- xorriso/xorriso_timestamp.h | 2 +- 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index b149e34e..a977db4c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -131,6 +131,41 @@ iconv_close(cd); ]) +dnl LIBBURNIA_ASSERT_READLINE disables xorriso readline if not all needed +dnl functions are present +AC_DEFUN([LIBBURNIA_ASSERT_READLINE], +[ + if test x$XORRISO_ASSUME_READLINE = x + then + dnl Check for the essential gestures of libisofs/util.c + AC_MSG_CHECKING([for desired functions in libreadline]) + libburnia_save_LIBS="$LIBS" + LIBS="$LIBS -lreadline" + AC_TRY_LINK([ +#include +#include +#include +#include +#include +#include +#include +#include ], +[HIST_ENTRY **hl; +readline(""); +add_history(""); +hl= history_list(); +], [readline_test="yes"], [readline_test="no"] + ) + AC_MSG_RESULT([$readline_test]) + if test x$readline_test = xno + then + READLINE_DEF= + LIBS="$libburnia_save_LIBS" + fi + fi +]) + + dnl LIBBURNIA_SET_PKGCONFIG determines the install directory for the *.pc file. dnl Important: Must be performed _after_ TARGET_SHIZZLE dnl diff --git a/configure.ac b/configure.ac index d2cb37ff..5830f347 100644 --- a/configure.ac +++ b/configure.ac @@ -77,16 +77,16 @@ if test x$LIBISOBURN_OLD_ICONV_CONFIGURE = x then dnl ts B00410 : To detect the need for -liconv and const argument of iconv() -LIBBURNIA_CHECK_ICONV + LIBBURNIA_CHECK_ICONV else dnl Outdated: produces double -liconv and warnings about parameter mismatch dnl If iconv(3) is in an extra lib, then it gets added to variable LIBS. dnl If not, then no -liconv will be added. -AC_CHECK_LIB(iconv, iconv, , ) + AC_CHECK_LIB(iconv, iconv, , ) dnl GNU iconv has no function iconv() but libiconv() and a macro iconv() -AC_CHECK_LIB(iconv, libiconv, , ) + AC_CHECK_LIB(iconv, libiconv, , ) fi @@ -120,10 +120,19 @@ if test x$enable_libreadline = xyes; then dnl Check whether there is readline-devel and readline-runtime. dnl If not, erase this macro which would enable use of readline(),add_history() READLINE_DEF="-DXorriso_with_readlinE" + + if test x$XORRISO_OLD_READLINE_CONFIGURE = x + then + +dnl ts B00411 : To disable readline if not all needed functions are present + LIBBURNIA_ASSERT_READLINE + + else dnl The empty yes case obviously causes -lreadline to be linked - AC_CHECK_HEADER(readline/readline.h, AC_CHECK_LIB(readline, readline, , READLINE_DEF= ), READLINE_DEF= ) + AC_CHECK_HEADER(readline/readline.h, AC_CHECK_LIB(readline, readline, , READLINE_DEF= ), READLINE_DEF= ) dnl The X= in the yes case prevents that -lreadline gets linked twice - AC_CHECK_HEADER(readline/history.h, AC_CHECK_LIB(readline, add_history, X= , READLINE_DEF= ), READLINE_DEF= ) + AC_CHECK_HEADER(readline/history.h, AC_CHECK_LIB(readline, add_history, X= , READLINE_DEF= ), READLINE_DEF= ) + fi else READLINE_DEF= fi diff --git a/xorriso/configure_ac.txt b/xorriso/configure_ac.txt index 34a2041a..273824fa 100644 --- a/xorriso/configure_ac.txt +++ b/xorriso/configure_ac.txt @@ -145,10 +145,20 @@ if test x$enable_libreadline = xyes; then dnl Check whether there is readline-devel and readline-runtime. dnl If not, erase this macro which would enable use of readline(),add_history() READLINE_DEF="-DXorriso_with_readlinE" + + if test x$XORRISO_OLD_READLINE_CONFIGURE = x + then + +dnl ts B00411 : To disable readline if not all needed functions are present + LIBBURNIA_ASSERT_READLINE + + else dnl The empty yes case obviously causes -lreadline to be linked - AC_CHECK_HEADER(readline/readline.h, AC_CHECK_LIB(readline, readline, , READLINE_DEF= ), READLINE_DEF= ) + AC_CHECK_HEADER(readline/readline.h, AC_CHECK_LIB(readline, readline, , READLINE_DEF= ), READLINE_DEF= ) dnl The X= in the yes case prevents that -lreadline gets linked twice - AC_CHECK_HEADER(readline/history.h, AC_CHECK_LIB(readline, add_history, X= , READLINE_DEF= ), READLINE_DEF= ) + AC_CHECK_HEADER(readline/history.h, AC_CHECK_LIB(readline, add_history, X= , READLINE_DEF= ), READLINE_DEF= ) + + fi else READLINE_DEF= fi diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 9726ee48..bee212ff 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.04.13.103917" +#define Xorriso_timestamP "2010.04.13.154201"