Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit aef2d0d

Browse files
committed
Fix readline/libedit selection code to prefer readline over libedit
reliably (ie, regardless of which libraries they depend on). Also make sure that we don't select headers that obviously belong to the wrong one of the two libraries. This was discussed back around 4-Sep but seems to have slipped through the cracks. The header selection could be checked more closely, perhaps, but let's see if this is good enough.
1 parent c3df447 commit aef2d0d

File tree

3 files changed

+298
-36
lines changed

3 files changed

+298
-36
lines changed

config/programs.m4

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/config/programs.m4,v 1.16 2004/09/02 20:39:57 tgl Exp $
1+
# $PostgreSQL: pgsql/config/programs.m4,v 1.17 2004/11/30 06:13:02 tgl Exp $
22

33

44
# PGAC_PATH_FLEX
@@ -82,10 +82,10 @@ AC_MSG_CHECKING([for readline])
8282
8383
AC_CACHE_VAL([pgac_cv_check_readline],
8484
[pgac_cv_check_readline=no
85-
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
86-
for pgac_rllib in -lreadline -ledit ; do
87-
pgac_save_LIBS=$LIBS
88-
LIBS="${pgac_rllib}${pgac_lib} $LIBS"
85+
pgac_save_LIBS=$LIBS
86+
for pgac_rllib in -lreadline -ledit ; do
87+
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
88+
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
8989
AC_TRY_LINK_FUNC([readline], [[
9090
# NetBSD, OpenBSD, and Irix have a broken linker that does not
9191
# recognize dependent libraries
@@ -99,7 +99,6 @@ for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
9999
pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"
100100
break 2
101101
]])
102-
LIBS=$pgac_save_LIBS
103102
done
104103
done
105104
LIBS=$pgac_save_LIBS

configure

Lines changed: 270 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5954,10 +5954,10 @@ if test "${pgac_cv_check_readline+set}" = set; then
59545954
echo $ECHO_N "(cached) $ECHO_C" >&6
59555955
else
59565956
pgac_cv_check_readline=no
5957-
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
5958-
for pgac_rllib in -lreadline -ledit ; do
5959-
pgac_save_LIBS=$LIBS
5960-
LIBS="${pgac_rllib}${pgac_lib} $LIBS"
5957+
pgac_save_LIBS=$LIBS
5958+
for pgac_rllib in -lreadline -ledit ; do
5959+
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
5960+
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
59615961
cat >conftest.$ac_ext <<_ACEOF
59625962
#line $LINENO "configure"
59635963
#include "confdefs.h"
@@ -6013,7 +6013,6 @@ else
60136013
cat conftest.$ac_ext >&5
60146014
fi
60156015
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
6016-
LIBS=$pgac_save_LIBS
60176016
done
60186017
done
60196018
LIBS=$pgac_save_LIBS
@@ -7559,7 +7558,7 @@ fi
75597558
done
75607559

75617560

7562-
if test "$with_readline" = yes; then
7561+
if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
75637562

75647563
for ac_header in readline/readline.h
75657564
do
@@ -7672,7 +7671,7 @@ _ACEOF
76727671

76737672
else
76747673

7675-
for ac_header in editline/readline.h
7674+
for ac_header in readline.h
76767675
do
76777676
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
76787677
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -7782,8 +7781,25 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
77827781
_ACEOF
77837782

77847783
else
7784+
{ { echo "$as_me:$LINENO: error: readline header not found
7785+
If you have readline already installed, see config.log for details on the
7786+
failure. It is possible the compiler isn't looking in the proper directory.
7787+
Use --without-readline to disable readline support." >&5
7788+
echo "$as_me: error: readline header not found
7789+
If you have readline already installed, see config.log for details on the
7790+
failure. It is possible the compiler isn't looking in the proper directory.
7791+
Use --without-readline to disable readline support." >&2;}
7792+
{ (exit 1); exit 1; }; }
7793+
fi
77857794

7786-
for ac_header in readline.h
7795+
done
7796+
7797+
fi
7798+
7799+
done
7800+
7801+
7802+
for ac_header in readline/history.h
77877803
do
77887804
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
77897805
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -7893,11 +7909,122 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
78937909
_ACEOF
78947910

78957911
else
7896-
{ { echo "$as_me:$LINENO: error: readline header not found
7912+
7913+
for ac_header in history.h
7914+
do
7915+
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
7916+
if eval "test \"\${$as_ac_Header+set}\" = set"; then
7917+
echo "$as_me:$LINENO: checking for $ac_header" >&5
7918+
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
7919+
if eval "test \"\${$as_ac_Header+set}\" = set"; then
7920+
echo $ECHO_N "(cached) $ECHO_C" >&6
7921+
fi
7922+
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
7923+
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
7924+
else
7925+
# Is the header compilable?
7926+
echo "$as_me:$LINENO: checking $ac_header usability" >&5
7927+
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
7928+
cat >conftest.$ac_ext <<_ACEOF
7929+
#line $LINENO "configure"
7930+
#include "confdefs.h"
7931+
$ac_includes_default
7932+
#include <$ac_header>
7933+
_ACEOF
7934+
rm -f conftest.$ac_objext
7935+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7936+
(eval $ac_compile) 2>&5
7937+
ac_status=$?
7938+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7939+
(exit $ac_status); } &&
7940+
{ ac_try='test -s conftest.$ac_objext'
7941+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7942+
(eval $ac_try) 2>&5
7943+
ac_status=$?
7944+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7945+
(exit $ac_status); }; }; then
7946+
ac_header_compiler=yes
7947+
else
7948+
echo "$as_me: failed program was:" >&5
7949+
cat conftest.$ac_ext >&5
7950+
ac_header_compiler=no
7951+
fi
7952+
rm -f conftest.$ac_objext conftest.$ac_ext
7953+
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
7954+
echo "${ECHO_T}$ac_header_compiler" >&6
7955+
7956+
# Is the header present?
7957+
echo "$as_me:$LINENO: checking $ac_header presence" >&5
7958+
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
7959+
cat >conftest.$ac_ext <<_ACEOF
7960+
#line $LINENO "configure"
7961+
#include "confdefs.h"
7962+
#include <$ac_header>
7963+
_ACEOF
7964+
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
7965+
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
7966+
ac_status=$?
7967+
egrep -v '^ *\+' conftest.er1 >conftest.err
7968+
rm -f conftest.er1
7969+
cat conftest.err >&5
7970+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
7971+
(exit $ac_status); } >/dev/null; then
7972+
if test -s conftest.err; then
7973+
ac_cpp_err=$ac_c_preproc_warn_flag
7974+
else
7975+
ac_cpp_err=
7976+
fi
7977+
else
7978+
ac_cpp_err=yes
7979+
fi
7980+
if test -z "$ac_cpp_err"; then
7981+
ac_header_preproc=yes
7982+
else
7983+
echo "$as_me: failed program was:" >&5
7984+
cat conftest.$ac_ext >&5
7985+
ac_header_preproc=no
7986+
fi
7987+
rm -f conftest.err conftest.$ac_ext
7988+
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
7989+
echo "${ECHO_T}$ac_header_preproc" >&6
7990+
7991+
# So? What about this header?
7992+
case $ac_header_compiler:$ac_header_preproc in
7993+
yes:no )
7994+
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
7995+
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
7996+
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
7997+
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
7998+
no:yes )
7999+
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
8000+
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
8001+
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
8002+
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
8003+
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
8004+
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
8005+
esac
8006+
echo "$as_me:$LINENO: checking for $ac_header" >&5
8007+
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
8008+
if eval "test \"\${$as_ac_Header+set}\" = set"; then
8009+
echo $ECHO_N "(cached) $ECHO_C" >&6
8010+
else
8011+
eval "$as_ac_Header=$ac_header_preproc"
8012+
fi
8013+
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
8014+
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
8015+
8016+
fi
8017+
if test `eval echo '${'$as_ac_Header'}'` = yes; then
8018+
cat >>confdefs.h <<_ACEOF
8019+
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8020+
_ACEOF
8021+
8022+
else
8023+
{ { echo "$as_me:$LINENO: error: history header not found
78978024
If you have readline already installed, see config.log for details on the
78988025
failure. It is possible the compiler isn't looking in the proper directory.
78998026
Use --without-readline to disable readline support." >&5
7900-
echo "$as_me: error: readline header not found
8027+
echo "$as_me: error: history header not found
79018028
If you have readline already installed, see config.log for details on the
79028029
failure. It is possible the compiler isn't looking in the proper directory.
79038030
Use --without-readline to disable readline support." >&2;}
@@ -7912,10 +8039,120 @@ done
79128039

79138040
fi
79148041

7915-
done
8042+
if expr x"$pgac_cv_check_readline" : 'x-ledit' >/dev/null ; then
79168043

8044+
for ac_header in editline/readline.h
8045+
do
8046+
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
8047+
if eval "test \"\${$as_ac_Header+set}\" = set"; then
8048+
echo "$as_me:$LINENO: checking for $ac_header" >&5
8049+
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
8050+
if eval "test \"\${$as_ac_Header+set}\" = set"; then
8051+
echo $ECHO_N "(cached) $ECHO_C" >&6
8052+
fi
8053+
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
8054+
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
8055+
else
8056+
# Is the header compilable?
8057+
echo "$as_me:$LINENO: checking $ac_header usability" >&5
8058+
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
8059+
cat >conftest.$ac_ext <<_ACEOF
8060+
#line $LINENO "configure"
8061+
#include "confdefs.h"
8062+
$ac_includes_default
8063+
#include <$ac_header>
8064+
_ACEOF
8065+
rm -f conftest.$ac_objext
8066+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
8067+
(eval $ac_compile) 2>&5
8068+
ac_status=$?
8069+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
8070+
(exit $ac_status); } &&
8071+
{ ac_try='test -s conftest.$ac_objext'
8072+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8073+
(eval $ac_try) 2>&5
8074+
ac_status=$?
8075+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
8076+
(exit $ac_status); }; }; then
8077+
ac_header_compiler=yes
8078+
else
8079+
echo "$as_me: failed program was:" >&5
8080+
cat conftest.$ac_ext >&5
8081+
ac_header_compiler=no
8082+
fi
8083+
rm -f conftest.$ac_objext conftest.$ac_ext
8084+
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
8085+
echo "${ECHO_T}$ac_header_compiler" >&6
79178086

7918-
for ac_header in readline/history.h
8087+
# Is the header present?
8088+
echo "$as_me:$LINENO: checking $ac_header presence" >&5
8089+
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
8090+
cat >conftest.$ac_ext <<_ACEOF
8091+
#line $LINENO "configure"
8092+
#include "confdefs.h"
8093+
#include <$ac_header>
8094+
_ACEOF
8095+
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
8096+
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
8097+
ac_status=$?
8098+
egrep -v '^ *\+' conftest.er1 >conftest.err
8099+
rm -f conftest.er1
8100+
cat conftest.err >&5
8101+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
8102+
(exit $ac_status); } >/dev/null; then
8103+
if test -s conftest.err; then
8104+
ac_cpp_err=$ac_c_preproc_warn_flag
8105+
else
8106+
ac_cpp_err=
8107+
fi
8108+
else
8109+
ac_cpp_err=yes
8110+
fi
8111+
if test -z "$ac_cpp_err"; then
8112+
ac_header_preproc=yes
8113+
else
8114+
echo "$as_me: failed program was:" >&5
8115+
cat conftest.$ac_ext >&5
8116+
ac_header_preproc=no
8117+
fi
8118+
rm -f conftest.err conftest.$ac_ext
8119+
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
8120+
echo "${ECHO_T}$ac_header_preproc" >&6
8121+
8122+
# So? What about this header?
8123+
case $ac_header_compiler:$ac_header_preproc in
8124+
yes:no )
8125+
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
8126+
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
8127+
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
8128+
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
8129+
no:yes )
8130+
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
8131+
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
8132+
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
8133+
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
8134+
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
8135+
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
8136+
esac
8137+
echo "$as_me:$LINENO: checking for $ac_header" >&5
8138+
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
8139+
if eval "test \"\${$as_ac_Header+set}\" = set"; then
8140+
echo $ECHO_N "(cached) $ECHO_C" >&6
8141+
else
8142+
eval "$as_ac_Header=$ac_header_preproc"
8143+
fi
8144+
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
8145+
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
8146+
8147+
fi
8148+
if test `eval echo '${'$as_ac_Header'}'` = yes; then
8149+
cat >>confdefs.h <<_ACEOF
8150+
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8151+
_ACEOF
8152+
8153+
else
8154+
8155+
for ac_header in readline.h
79198156
do
79208157
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
79218158
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -8025,6 +8262,23 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
80258262
_ACEOF
80268263

80278264
else
8265+
{ { echo "$as_me:$LINENO: error: readline header not found
8266+
If you have libedit already installed, see config.log for details on the
8267+
failure. It is possible the compiler isn't looking in the proper directory.
8268+
Use --without-readline to disable libedit support." >&5
8269+
echo "$as_me: error: readline header not found
8270+
If you have libedit already installed, see config.log for details on the
8271+
failure. It is possible the compiler isn't looking in the proper directory.
8272+
Use --without-readline to disable libedit support." >&2;}
8273+
{ (exit 1); exit 1; }; }
8274+
fi
8275+
8276+
done
8277+
8278+
fi
8279+
8280+
done
8281+
80288282

80298283
for ac_header in editline/history.h
80308284
do
@@ -8248,13 +8502,13 @@ _ACEOF
82488502

82498503
else
82508504
{ { echo "$as_me:$LINENO: error: history header not found
8251-
If you have readline already installed, see config.log for details on the
8505+
If you have libedit already installed, see config.log for details on the
82528506
failure. It is possible the compiler isn't looking in the proper directory.
8253-
Use --without-readline to disable readline support." >&5
8507+
Use --without-readline to disable libedit support." >&5
82548508
echo "$as_me: error: history header not found
8255-
If you have readline already installed, see config.log for details on the
8509+
If you have libedit already installed, see config.log for details on the
82568510
failure. It is possible the compiler isn't looking in the proper directory.
8257-
Use --without-readline to disable readline support." >&2;}
8511+
Use --without-readline to disable libedit support." >&2;}
82588512
{ (exit 1); exit 1; }; }
82598513
fi
82608514

@@ -8266,10 +8520,6 @@ done
82668520

82678521
fi
82688522

8269-
done
8270-
8271-
fi
8272-
82738523
if test "$with_zlib" = yes; then
82748524
if test "${ac_cv_header_zlib_h+set}" = set; then
82758525
echo "$as_me:$LINENO: checking for zlib.h" >&5

0 commit comments

Comments
 (0)