diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 06:57:07 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 06:57:07 -0700 |
commit | c6c05649f5d3890281e6fe95694794d39f6f0841 (patch) | |
tree | 670470fb28f3eadc43006019e04d6847555ca1f4 /configure | |
parent | 6e8cecf1f958af3b46365b8f41ceea500d9f2019 (diff) | |
download | txr-c6c05649f5d3890281e6fe95694794d39f6f0841.tar.gz txr-c6c05649f5d3890281e6fe95694794d39f6f0841.tar.bz2 txr-c6c05649f5d3890281e6fe95694794d39f6f0841.zip |
Reveal struct winsize on Solaris.
On Solaris 10, we need __EXTENSIONS__ defined to make
struct winsize appear out of <termios.h>.
This commit adds detection for what preprocessor symbol needs
to be defined for struct winsize to appear, if it appears at
all. Then this symbol is defined on the compiler command line
when compiling linenoise.
* Makefile (CFLAGS): Add -D$(termios_define) for
linenoise.o target.
* configure (have_winsize, termios_define): New variables.
Detect whether struct winsize is available, and what
preprocessor symbol, if any, is required to reveal the
feature.
* linenoise/linenoise.c: Need to include TXR's "config.h"
for HAVE_WINSIZE.
(get_columns): Reorganized so that use of struct winsize
is guarded by HAVE_WINSIZE and fallback code is used if
either obtaining the size fails or the feature is completely
unavailable.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -124,6 +124,8 @@ have_git= have_pwuid= have_alloca= have_termios= +have_winsize= +termios_define= conf_dir=config config_h=$conf_dir/config.h config_make=$conf_dir/config.make @@ -651,6 +653,7 @@ have_glob := $have_glob have_posix_sigs := $have_posix_sigs have_termios := $have_termios +termios_define := $termios_define # do we compile in debug support? debug_support := $debug_support @@ -2153,6 +2156,32 @@ else printf "no\n" fi +printf "Checking for struct winsize ... " + +for termios_define in NOTHING __EXTENSIONS__ ; do + cat > conftest.c <<! +#define $termios_define +#include <sys/ioctl.h> +#include <termios.h> + +int main(int argc, char **argv) +{ + struct winsize ws; + return 0; +} +! + if conftest ; then + printf "yes\n" + printf "#define HAVE_WINSIZE 1\n" >> $config_h + have_winsize=y + break; + fi +done + +if [ -z "$have_winsize" ] ; then + printf "no\n" +fi + # # Dependent variables # |