mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Add tparm fallback to use under systems having tparm with fixed number of paramters, required with Solaris curses. Updated configure script to check for c99 for compilation with Sun Studio under solaris and updated LDFlAGS for fish_pager etc to include library dependencies from common.c etc.
darcs-hash:20070822075741-cac88-5532b074490bce1d7f37289b1774a4a5e44416d8.gz
This commit is contained in:
parent
2994378e1a
commit
74a270ea32
3 changed files with 155 additions and 49 deletions
101
configure.ac
101
configure.ac
|
@ -153,11 +153,13 @@ AH_BOTTOM([#if __GNUC__ >= 3
|
||||||
# Set up various programs needed for install
|
# Set up various programs needed for install
|
||||||
#
|
#
|
||||||
|
|
||||||
AC_PROG_CC
|
# Here we look for c99 before cc as Sun Studio compiler supports c99
|
||||||
|
# through the c99 binary.
|
||||||
|
|
||||||
|
AC_PROG_CC([gcc c99 cc])
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for seq command. If missing, make sure fallback shellscript
|
# Check for seq command. If missing, make sure fallback shellscript
|
||||||
# implementation is installed.
|
# implementation is installed.
|
||||||
|
@ -234,14 +236,17 @@ fi
|
||||||
# increases the odds of correct compilation, since we want to use the
|
# increases the odds of correct compilation, since we want to use the
|
||||||
# *wprintf functions, which where defined in C99.
|
# *wprintf functions, which where defined in C99.
|
||||||
#
|
#
|
||||||
|
# NOTE: Never versions of autoconf has AC_CHECK_PROG_CC_C99
|
||||||
|
#
|
||||||
|
|
||||||
XCFLAGS="$CFLAGS"
|
if test "$CC" != "c99"; then
|
||||||
CFLAGS="$CFLAGS -std=c99"
|
XCFLAGS="$CFLAGS"
|
||||||
XCPPFLAGS="$CPPFLAGS"
|
CFLAGS="$CFLAGS -std=c99"
|
||||||
CPPFLAGS="$CPPFLAGS -std=c99"
|
XCPPFLAGS="$CPPFLAGS"
|
||||||
AC_MSG_CHECKING(if -std=c99 works)
|
CPPFLAGS="$CPPFLAGS -std=c99"
|
||||||
|
AC_MSG_CHECKING(if -std=c99 works)
|
||||||
|
|
||||||
AC_CACHE_VAL(
|
AC_CACHE_VAL(
|
||||||
local_cv_has__std_c99,
|
local_cv_has__std_c99,
|
||||||
[
|
[
|
||||||
AC_TRY_RUN(
|
AC_TRY_RUN(
|
||||||
|
@ -258,7 +263,15 @@ AC_CACHE_VAL(
|
||||||
local_cv_has__std_c99=no,
|
local_cv_has__std_c99=no,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
AC_MSG_RESULT($local_cv_has__std_c99)
|
||||||
|
case x$local_cv_has__std_c99 in
|
||||||
|
xno)
|
||||||
|
CFLAGS="$XCFLAGS"
|
||||||
|
CPPFLAGS="$XCPPFLAGS" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try to enable large file support. This will make sure that on systems
|
# Try to enable large file support. This will make sure that on systems
|
||||||
|
@ -268,20 +281,12 @@ AC_CACHE_VAL(
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64"
|
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64"
|
||||||
|
|
||||||
AC_MSG_RESULT($local_cv_has__std_c99)
|
|
||||||
case x$local_cv_has__std_c99 in
|
|
||||||
xno)
|
|
||||||
CFLAGS="$XCFLAGS"
|
|
||||||
CPPFLAGS="$XCPPFLAGS" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# If we are using gcc, set some flags that increase the odds of the
|
# If we are using gcc, set some flags that increase the odds of the
|
||||||
# compiler producing a working binary...
|
# compiler producing a working binary...
|
||||||
#
|
#
|
||||||
|
|
||||||
if test "$CC" = gcc; then
|
if test "$GCC" = yes; then
|
||||||
|
|
||||||
#
|
#
|
||||||
# -fno-optimize-sibling-calls seems to work around a bug where
|
# -fno-optimize-sibling-calls seems to work around a bug where
|
||||||
|
@ -387,6 +392,34 @@ case $target_os in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Check for Solaris curses tputs having fixed length parameter list.
|
||||||
|
AC_MSG_CHECKING([if we are using non varargs tparm.])
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[
|
||||||
|
AC_LANG_PROGRAM(
|
||||||
|
[
|
||||||
|
#include <curses.h>
|
||||||
|
#include <term.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
tparm( "" );
|
||||||
|
]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
[tparm_solaris_kludge=no],
|
||||||
|
[tparm_solaris_kludge=yes]
|
||||||
|
)
|
||||||
|
if test "x$tparm_solaris_kludge" = "xyes"; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(
|
||||||
|
[TPARM_SOLARIS_KLUDGE],
|
||||||
|
[1],
|
||||||
|
[Define to 1 if tparm accepts a fixed amount of paramters.]
|
||||||
|
)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BSD-specific flags go here
|
# BSD-specific flags go here
|
||||||
|
@ -466,18 +499,26 @@ AC_DEFINE(
|
||||||
# slower compiles when developing fish.
|
# slower compiles when developing fish.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Check for os dependant libraries for all binaries.
|
||||||
|
LIBS_COMMON=$LIBS
|
||||||
|
LIBS=""
|
||||||
|
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
|
||||||
|
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
|
||||||
|
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
|
||||||
|
LIBS_SHARED=$LIBS
|
||||||
|
LIBS=$LIBS_COMMON
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for libraries needed by fish.
|
# Check for libraries needed by fish.
|
||||||
#
|
#
|
||||||
|
|
||||||
LIBS_COMMON=$LIBS
|
LIBS_COMMON=$LIBS
|
||||||
LIBS=""
|
LIBS="$LIBS_SHARED"
|
||||||
if test x$local_gettext != xno; then
|
if test x$local_gettext != xno; then
|
||||||
AC_SEARCH_LIBS( gettext, intl,,)
|
AC_SEARCH_LIBS( gettext, intl,,)
|
||||||
fi
|
fi
|
||||||
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
|
|
||||||
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
|
|
||||||
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
|
|
||||||
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
|
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
|
||||||
LIBS_FISH=$LIBS
|
LIBS_FISH=$LIBS
|
||||||
LIBS=$LIBS_COMMON
|
LIBS=$LIBS_COMMON
|
||||||
|
@ -487,7 +528,7 @@ LIBS=$LIBS_COMMON
|
||||||
#
|
#
|
||||||
|
|
||||||
LIBS_COMMON=$LIBS
|
LIBS_COMMON=$LIBS
|
||||||
LIBS=""
|
LIBS="$LIBS_SHARED"
|
||||||
if test x$local_gettext != xno; then
|
if test x$local_gettext != xno; then
|
||||||
AC_SEARCH_LIBS( gettext, intl,,)
|
AC_SEARCH_LIBS( gettext, intl,,)
|
||||||
fi
|
fi
|
||||||
|
@ -499,12 +540,10 @@ LIBS=$LIBS_COMMON
|
||||||
#
|
#
|
||||||
|
|
||||||
LIBS_COMMON=$LIBS
|
LIBS_COMMON=$LIBS
|
||||||
LIBS=""
|
LIBS="$LIBS_SHARED"
|
||||||
if test x$local_gettext != xno; then
|
if test x$local_gettext != xno; then
|
||||||
AC_SEARCH_LIBS( gettext, intl,,)
|
AC_SEARCH_LIBS( gettext, intl,,)
|
||||||
fi
|
fi
|
||||||
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
|
|
||||||
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
|
|
||||||
LIBS_FISH_PAGER=$LIBS
|
LIBS_FISH_PAGER=$LIBS
|
||||||
LIBS=$LIBS_COMMON
|
LIBS=$LIBS_COMMON
|
||||||
|
|
||||||
|
@ -513,11 +552,10 @@ LIBS=$LIBS_COMMON
|
||||||
#
|
#
|
||||||
|
|
||||||
LIBS_COMMON=$LIBS
|
LIBS_COMMON=$LIBS
|
||||||
LIBS=""
|
LIBS="$LIBS_SHARED"
|
||||||
if test x$local_gettext != xno; then
|
if test x$local_gettext != xno; then
|
||||||
AC_SEARCH_LIBS( gettext, intl,,)
|
AC_SEARCH_LIBS( gettext, intl,,)
|
||||||
fi
|
fi
|
||||||
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
|
|
||||||
LIBS_FISHD=$LIBS
|
LIBS_FISHD=$LIBS
|
||||||
LIBS=$LIBS_COMMON
|
LIBS=$LIBS_COMMON
|
||||||
|
|
||||||
|
@ -526,11 +564,11 @@ LIBS=$LIBS_COMMON
|
||||||
#
|
#
|
||||||
|
|
||||||
LIBS_COMMON=$LIBS
|
LIBS_COMMON=$LIBS
|
||||||
LIBS=""
|
LIBS="$LIBS_SHARED"
|
||||||
if test x$local_gettext != xno; then
|
if test x$local_gettext != xno; then
|
||||||
AC_SEARCH_LIBS( gettext, intl,,)
|
AC_SEARCH_LIBS( gettext, intl,,)
|
||||||
fi
|
fi
|
||||||
LIBS_FISHD=$LIBS
|
LIBS_MIMEDB=$LIBS
|
||||||
LIBS=$LIBS_COMMON
|
LIBS=$LIBS_COMMON
|
||||||
|
|
||||||
|
|
||||||
|
@ -539,11 +577,10 @@ LIBS=$LIBS_COMMON
|
||||||
#
|
#
|
||||||
|
|
||||||
LIBS_COMMON=$LIBS
|
LIBS_COMMON=$LIBS
|
||||||
LIBS=""
|
LIBS="$LIBS_SHARED"
|
||||||
if test x$local_gettext != xno; then
|
if test x$local_gettext != xno; then
|
||||||
AC_SEARCH_LIBS( gettext, intl,,)
|
AC_SEARCH_LIBS( gettext, intl,,)
|
||||||
fi
|
fi
|
||||||
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
|
|
||||||
LIBS_SET_COLOR=$LIBS
|
LIBS_SET_COLOR=$LIBS
|
||||||
LIBS=$LIBS_COMMON
|
LIBS=$LIBS_COMMON
|
||||||
|
|
||||||
|
|
58
fallback.c
58
fallback.c
|
@ -65,6 +65,64 @@ int tputs(const char *str, int affcnt, int (*fish_putc)(tputs_arg_t))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TPARM_SOLARIS_KLUDGE
|
||||||
|
|
||||||
|
#undef tparm
|
||||||
|
|
||||||
|
/**
|
||||||
|
Checks for known string values and maps to correct number of parameters.
|
||||||
|
*/
|
||||||
|
char *tparm_solaris_kludge( char *str, ... )
|
||||||
|
{
|
||||||
|
long int param[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
va_start( ap, str );
|
||||||
|
|
||||||
|
if( ( set_a_foreground && ! strcmp( str, set_a_foreground ) )
|
||||||
|
|| ( set_a_background && ! strcmp( str, set_a_background ) )
|
||||||
|
|| ( set_foreground && ! strcmp( str, set_foreground ) )
|
||||||
|
|| ( set_background && ! strcmp( str, set_background ) )
|
||||||
|
|| ( enter_underline_mode && ! strcmp( str, enter_underline_mode ) )
|
||||||
|
|| ( exit_underline_mode && ! strcmp( str, exit_underline_mode ) )
|
||||||
|
|| ( enter_standout_mode && ! strcmp( str, enter_standout_mode ) )
|
||||||
|
|| ( exit_standout_mode && ! strcmp( str, exit_standout_mode ) )
|
||||||
|
|| ( flash_screen && ! strcmp( str, flash_screen ) )
|
||||||
|
|| ( enter_subscript_mode && ! strcmp( str, enter_subscript_mode ) )
|
||||||
|
|| ( exit_subscript_mode && ! strcmp( str, exit_subscript_mode ) )
|
||||||
|
|| ( enter_superscript_mode && ! strcmp( str, enter_superscript_mode ) )
|
||||||
|
|| ( exit_superscript_mode && ! strcmp( str, exit_superscript_mode ) )
|
||||||
|
|| ( enter_blink_mode && ! strcmp( str, enter_blink_mode ) )
|
||||||
|
|| ( enter_italics_mode && ! strcmp( str, enter_italics_mode ) )
|
||||||
|
|| ( exit_italics_mode && ! strcmp( str, exit_italics_mode ) )
|
||||||
|
|| ( enter_reverse_mode && ! strcmp( str, enter_reverse_mode ) )
|
||||||
|
|| ( enter_shadow_mode && ! strcmp( str, enter_shadow_mode ) )
|
||||||
|
|| ( exit_shadow_mode && ! strcmp( str, exit_shadow_mode ) )
|
||||||
|
|| ( enter_standout_mode && ! strcmp( str, enter_standout_mode ) )
|
||||||
|
|| ( exit_standout_mode && ! strcmp( str, exit_standout_mode ) )
|
||||||
|
|| ( enter_secure_mode && ! strcmp( str, enter_secure_mode ) )
|
||||||
|
|| ( enter_bold_mode && ! strcmp ( str, enter_bold_mode ) ) )
|
||||||
|
{
|
||||||
|
param[0] = va_arg( ap, long int );
|
||||||
|
}
|
||||||
|
else if( cursor_address && ! strcmp( str, cursor_address ) )
|
||||||
|
{
|
||||||
|
param[0] = va_arg( ap, long int );
|
||||||
|
param[1] = va_arg( ap, long int );
|
||||||
|
}
|
||||||
|
|
||||||
|
va_end( ap );
|
||||||
|
|
||||||
|
|
||||||
|
return tparm( str, param[0], param[1], param[2], param[3],
|
||||||
|
param[4], param[5], param[6], param[7], param[8] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-defining just to make sure nothing breaks further down in this file.
|
||||||
|
#define tparm tparm_solaris_kludge
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_FWPRINTF
|
#ifndef HAVE_FWPRINTF
|
||||||
#define INTERNAL_FWPRINTF 1
|
#define INTERNAL_FWPRINTF 1
|
||||||
|
|
13
fallback.h
13
fallback.h
|
@ -73,6 +73,18 @@ int tputs(const char *str, int affcnt, int (*fish_putc)(tputs_arg_t));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TPARM_SOLARIS_KLUDGE
|
||||||
|
|
||||||
|
/**
|
||||||
|
Solaris tparm has a set fixed of paramters in it's curses implementation,
|
||||||
|
work around this here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define tparm tparm_solaris_kludge
|
||||||
|
char *tparm_solaris_kludge( char *str, ... );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_FWPRINTF
|
#ifndef HAVE_FWPRINTF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -424,4 +436,3 @@ int getopt_long(int argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue