- add test for whether -lcurses is required when using readline, to fix
bug #429448. What is strange about this problem (on OpenBSD) is that the compile and link goes fine, but when you execute your first readline library function it does a dynamic link and crashes on the spot. Many autoconf tests only compile and sometimes link the test program, but this test compiles, links, and runs it.
This commit is contained in:
parent
3974d588de
commit
49aad8c1b1
137
bochs/configure
vendored
137
bochs/configure
vendored
@ -3710,22 +3710,100 @@ else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
echo $ac_n "checking if readline works without -lcurses""... $ac_c" 1>&6
|
||||
echo "configure:3715: checking if readline works without -lcurses" >&5
|
||||
OLD_LIBS=$LIBS
|
||||
LIBS="$LIBS -lreadline"
|
||||
rl_without_curses_ok=yes
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3723 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
int main() { rl_initialize(); exit(0); }
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:3731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -fr conftest*
|
||||
|
||||
echo "$ac_t""no" 1>&6
|
||||
rl_without_curses_ok=no
|
||||
|
||||
|
||||
fi
|
||||
rm -fr conftest*
|
||||
fi
|
||||
|
||||
echo $ac_n "checking if readline works with -lcurses""... $ac_c" 1>&6
|
||||
echo "configure:3748: checking if readline works with -lcurses" >&5
|
||||
LIBS="$LIBS -lcurses"
|
||||
rl_with_curses_ok=yes
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3755 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
int main() { rl_initialize(); exit(0); }
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:3763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -fr conftest*
|
||||
|
||||
echo "$ac_t""no" 1>&6
|
||||
rl_with_curses_ok=no
|
||||
|
||||
|
||||
fi
|
||||
rm -fr conftest*
|
||||
fi
|
||||
|
||||
LIBS=$OLD_LIBS
|
||||
if test "$rl_without_curses_ok" = no -a "$rl_with_curses_ok" = no; then
|
||||
echo ERROR: readline enabled but it is broken, with or without the -lcurses link option
|
||||
exit 1
|
||||
elif test "$rl_without_curses_ok" = no; then
|
||||
# we must add -lcurses!
|
||||
if test "$READLINE_LIB" != ""; then
|
||||
echo Adding -lcurses to your library list.
|
||||
READLINE_LIB="$READLINE_LIB -lcurses"
|
||||
fi
|
||||
else
|
||||
true # it worked without anything special
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
ac_safe=`echo "readline/history.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for readline/history.h""... $ac_c" 1>&6
|
||||
echo "configure:3719: checking for readline/history.h" >&5
|
||||
echo "configure:3797: checking for readline/history.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3724 "configure"
|
||||
#line 3802 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <readline/history.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:3729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:3807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@ -3751,9 +3829,8 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo $ac_n "checking for loader support""... $ac_c" 1>&6
|
||||
echo "configure:3757: checking for loader support" >&5
|
||||
echo "configure:3834: checking for loader support" >&5
|
||||
# Check whether --enable-loader or --disable-loader was given.
|
||||
if test "${enable_loader+set}" = set; then
|
||||
enableval="$enable_loader"
|
||||
@ -3791,7 +3868,7 @@ fi
|
||||
INSTRUMENT_DIR='instrument/stubs'
|
||||
|
||||
echo $ac_n "checking for instrumentation support""... $ac_c" 1>&6
|
||||
echo "configure:3795: checking for instrumentation support" >&5
|
||||
echo "configure:3872: checking for instrumentation support" >&5
|
||||
# Check whether --enable-instrumentation or --disable-instrumentation was given.
|
||||
if test "${enable_instrumentation+set}" = set; then
|
||||
enableval="$enable_instrumentation"
|
||||
@ -3926,7 +4003,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for VGA emulation""... $ac_c" 1>&6
|
||||
echo "configure:3930: checking for VGA emulation" >&5
|
||||
echo "configure:4007: checking for VGA emulation" >&5
|
||||
# Check whether --enable-vga or --disable-vga was given.
|
||||
if test "${enable_vga+set}" = set; then
|
||||
enableval="$enable_vga"
|
||||
@ -3960,7 +4037,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for FPU emulation""... $ac_c" 1>&6
|
||||
echo "configure:3964: checking for FPU emulation" >&5
|
||||
echo "configure:4041: checking for FPU emulation" >&5
|
||||
FPU_VAR=''
|
||||
FPU_GLUE_OBJ=''
|
||||
# Check whether --enable-fpu or --disable-fpu was given.
|
||||
@ -4005,7 +4082,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for x86 debugger support""... $ac_c" 1>&6
|
||||
echo "configure:4009: checking for x86 debugger support" >&5
|
||||
echo "configure:4086: checking for x86 debugger support" >&5
|
||||
# Check whether --enable-x86-debugger or --disable-x86-debugger was given.
|
||||
if test "${enable_x86_debugger+set}" = set; then
|
||||
enableval="$enable_x86_debugger"
|
||||
@ -4041,7 +4118,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for CDROM support""... $ac_c" 1>&6
|
||||
echo "configure:4045: checking for CDROM support" >&5
|
||||
echo "configure:4122: checking for CDROM support" >&5
|
||||
# Check whether --enable-cdrom or --disable-cdrom was given.
|
||||
if test "${enable_cdrom+set}" = set; then
|
||||
enableval="$enable_cdrom"
|
||||
@ -4080,7 +4157,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for Sound Blaster 16 support""... $ac_c" 1>&6
|
||||
echo "configure:4084: checking for Sound Blaster 16 support" >&5
|
||||
echo "configure:4161: checking for Sound Blaster 16 support" >&5
|
||||
# Check whether --enable-sb16 or --disable-sb16 was given.
|
||||
if test "${enable_sb16+set}" = set; then
|
||||
enableval="$enable_sb16"
|
||||
@ -4154,7 +4231,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for I/O Interface to the debugger""... $ac_c" 1>&6
|
||||
echo "configure:4158: checking for I/O Interface to the debugger" >&5
|
||||
echo "configure:4235: checking for I/O Interface to the debugger" >&5
|
||||
IODEBUG_OBJS=''
|
||||
# Check whether --enable-iodebug or --disable-iodebug was given.
|
||||
if test "${enable_iodebug+set}" = set; then
|
||||
@ -4279,7 +4356,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for gui library to use""... $ac_c" 1>&6
|
||||
echo "configure:4283: checking for gui library to use" >&5
|
||||
echo "configure:4360: checking for gui library to use" >&5
|
||||
|
||||
if (test "$with_x11" != yes) && \
|
||||
(test "$with_beos" != yes) && \
|
||||
@ -4452,7 +4529,7 @@ fi
|
||||
|
||||
if test "$use_curses" = yes; then
|
||||
echo $ac_n "checking for mvaddch in -lcurses""... $ac_c" 1>&6
|
||||
echo "configure:4456: checking for mvaddch in -lcurses" >&5
|
||||
echo "configure:4533: checking for mvaddch in -lcurses" >&5
|
||||
ac_lib_var=`echo curses'_'mvaddch | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -4460,7 +4537,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lcurses $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4464 "configure"
|
||||
#line 4541 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -4471,7 +4548,7 @@ int main() {
|
||||
mvaddch()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@ -4492,7 +4569,7 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for mvaddch in -lncurses""... $ac_c" 1>&6
|
||||
echo "configure:4496: checking for mvaddch in -lncurses" >&5
|
||||
echo "configure:4573: checking for mvaddch in -lncurses" >&5
|
||||
ac_lib_var=`echo ncurses'_'mvaddch | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -4500,7 +4577,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lncurses $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4504 "configure"
|
||||
#line 4581 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -4511,7 +4588,7 @@ int main() {
|
||||
mvaddch()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@ -4532,7 +4609,7 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for mvaddch in -ltermlib""... $ac_c" 1>&6
|
||||
echo "configure:4536: checking for mvaddch in -ltermlib" >&5
|
||||
echo "configure:4613: checking for mvaddch in -ltermlib" >&5
|
||||
ac_lib_var=`echo termlib'_'mvaddch | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -4540,7 +4617,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-ltermlib $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4544 "configure"
|
||||
#line 4621 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -4551,7 +4628,7 @@ int main() {
|
||||
mvaddch()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@ -4580,18 +4657,18 @@ fi
|
||||
if test "$with_rfb" = yes; then
|
||||
# first see if compiler takes "-pthread" argument
|
||||
echo $ac_n "checking for -pthread arg to compiler""... $ac_c" 1>&6
|
||||
echo "configure:4584: checking for -pthread arg to compiler" >&5
|
||||
echo "configure:4661: checking for -pthread arg to compiler" >&5
|
||||
CFLAGS_SAVE="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4588 "configure"
|
||||
#line 4665 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <pthread.h>
|
||||
int main() {
|
||||
pthread_create(0,0,0,0);
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
|
||||
# it compiles with -pthread
|
||||
@ -4607,7 +4684,7 @@ else
|
||||
# now try with -lpthread
|
||||
CFLAGS="$CFLAGS_SAVE"
|
||||
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
|
||||
echo "configure:4611: checking for pthread_create in -lpthread" >&5
|
||||
echo "configure:4688: checking for pthread_create in -lpthread" >&5
|
||||
ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -4615,7 +4692,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lpthread $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4619 "configure"
|
||||
#line 4696 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -4626,7 +4703,7 @@ int main() {
|
||||
pthread_create()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@ -4678,7 +4755,7 @@ fi
|
||||
# Extract the first word of "gzip", so it can be a program name with args.
|
||||
set dummy gzip; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4682: checking for $ac_word" >&5
|
||||
echo "configure:4759: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GZIP'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@ -4713,7 +4790,7 @@ fi
|
||||
# Extract the first word of "tar", so it can be a program name with args.
|
||||
set dummy tar; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4717: checking for $ac_word" >&5
|
||||
echo "configure:4794: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
@ -523,6 +523,48 @@ if test "$want_readline" = yes; then
|
||||
fi
|
||||
]
|
||||
)
|
||||
AC_MSG_CHECKING(if readline works without -lcurses)
|
||||
OLD_LIBS=$LIBS
|
||||
LIBS="$LIBS -lreadline"
|
||||
rl_without_curses_ok=yes
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
int main() { rl_initialize(); exit(0); }
|
||||
],
|
||||
[ AC_MSG_RESULT(yes) ],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
rl_without_curses_ok=no
|
||||
]
|
||||
)
|
||||
AC_MSG_CHECKING(if readline works with -lcurses)
|
||||
LIBS="$LIBS -lcurses"
|
||||
rl_with_curses_ok=yes
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
int main() { rl_initialize(); exit(0); }
|
||||
],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
rl_with_curses_ok=no
|
||||
]
|
||||
)
|
||||
LIBS=$OLD_LIBS
|
||||
if test "$rl_without_curses_ok" = no -a "$rl_with_curses_ok" = no; then
|
||||
echo ERROR: readline enabled but it is broken, with or without the -lcurses link option
|
||||
exit 1
|
||||
elif test "$rl_without_curses_ok" = no; then
|
||||
# we must add -lcurses!
|
||||
if test "$READLINE_LIB" != ""; then
|
||||
echo Adding -lcurses to your library list.
|
||||
READLINE_LIB="$READLINE_LIB -lcurses"
|
||||
fi
|
||||
else
|
||||
true # it worked without anything special
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(READLINE_LIB)
|
||||
|
||||
@ -530,7 +572,6 @@ AC_CHECK_HEADER(readline/history.h,
|
||||
AC_DEFINE(HAVE_READLINE_HISTORY_H)
|
||||
)
|
||||
|
||||
|
||||
AC_MSG_CHECKING(for loader support)
|
||||
AC_ARG_ENABLE(loader,
|
||||
[ --enable-loader support calling external loader from debugger],
|
||||
|
Loading…
x
Reference in New Issue
Block a user