add-20070214.orig/0000755000175000017500000000000010565172742013361 5ustar azatothazatothadd-20070214.orig/COPYING0000644000175000017500000000222710565046332014412 0ustar azatothazatoth$Id: COPYING,v 1.2 2007/02/15 12:06:50 tom Exp $ ADD -------------------------------------------------------------------------------- Copyright 1995,2007 by Thomas E. Dickey. All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. add-20070214.orig/MANIFEST0000644000175000017500000000763210564727105014520 0ustar azatothazatothMANIFEST for add-20070214, version t20070214 -------------------------------------------------------------------------------- MANIFEST this file CHANGES summary of changes to 'add' COPYING copyright notice for 'add' README brief description of 'add' aclocal.m4 autoconf macros for 'add' add.1 manual-page for 'add' add.c vi-like adding machine add.h common definitions for 'add' add.hlp help-file for "add" config.guess configure utility script config.sub configure utility script config_h.in template for config.h configure configure script configure.in configure-script template configure Configuration script for UNIX curses.c curses-interface for 'add' install-sh generic install-script makefile.in makefile-template for 'add' mkdirs.sh make directory-hierarchy, from X windows screen.h interface to $(SCREEN).c porting subdirectory porting/descrip.mms VMS build-script for "add" porting/vms_link.opt VMS link-options for "add" testing subdirectory testing/README description of test-scripts testing/case00.add input-script for test-case00 testing/case00.opt command-line options for test-case00 testing/case00.ref reference-output for test-case00 testing/case01.add input-script for test-case01 testing/case01.ref reference-output for test-case01 testing/case02.add input-script for test-case02 testing/case02.ref reference-output for test-case02 testing/case03.add input-script for test-case03 testing/case03.ref reference-output for test-case03 testing/case04.add input-script for test-case04 testing/case04.opt command-line options for test-case04 testing/case04.ref reference-output for test-case04 testing/case05.add input-script for test-case05 testing/case05.ref reference-output for test-case05 testing/case06.add input-script for test-case06 testing/case06.ref reference-output for test-case06 testing/case07.add input-script for test-case07 testing/case07.ref reference-output for test-case07 testing/case08.add input-script for test-case08 testing/case08.opt command-line options for test-case08 testing/case08.ref reference-output for test-case08 testing/case09.add input-script for test-case09 testing/case09.ref reference-output for test-case09 testing/case10.add input-script for test-case10 testing/case10.ref reference-output for test-case10 testing/case11.add input-script for test-case11 testing/case11.opt command-line options for test-case11 testing/case11.ref reference-output for test-case11 testing/case12.add input-script for test-case12 testing/case12.ref reference-output for test-case12 testing/case13.add input-script for test-case13 testing/case13.opt command-line options for test-case13 testing/case13.ref reference-output for test-case13 testing/case14.add input-script for test-case14 testing/case14.opt command-line options for test-case14 testing/case14.ref reference-output for test-case14 testing/run_test.sh regress-script for 'add' testing/showCC wrapper for atac testing/testCC wrapper for atac add-20070214.orig/README0000644000175000017500000000055506062706571014246 0ustar azatothazatoth$Id: README,v 1.1 1995/12/11 01:46:33 tom Exp $ -------------------------------------------------------------------------------- -- Author: T.E.Dickey ADD is a full-screen tape editor that lets the user edit a calculation. It is a curses application. It's more suitable for balancing a checkbook than a spreadsheet or any of the various hand-calculator clones. add-20070214.orig/aclocal.m40000644000175000017500000014444410564723152015230 0ustar azatothazatothdnl $Id: aclocal.m4,v 1.8 2007/02/15 00:16:42 tom Exp $ dnl autoconf macros for 'add' dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl The second parameter if given makes this macro verbose. dnl dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily dnl confused by the quotes (which require backslashes to keep them usable). AC_DEFUN([CF_ADD_CFLAGS], [ cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $1 do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_ADD_INCDIR version: 4 updated: 2002/12/21 14:25:52 dnl ------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's dnl redundant. We don't normally need to add -I/usr/local/include for gcc, dnl but old versions (and some misinstalled ones) need that. To make things dnl worse, gcc 3.x gives error messages if -I/usr/local/include is added to dnl the include-path). AC_DEFUN([CF_ADD_INCDIR], [ for cf_add_incdir in $1 do while true do case $cf_add_incdir in /usr/include) # (vi ;; /usr/local/include) # (vi if test "$GCC" = yes then cf_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" AC_TRY_COMPILE([#include ], [printf("Hello")], [], [CPPFLAGS="$cf_save_CPPFLAGS"]) fi ;; *) # (vi CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" ;; esac cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` test "$cf_top_incdir" = "$cf_add_incdir" && break cf_add_incdir="$cf_top_incdir" done done ])dnl dnl --------------------------------------------------------------------------- dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34 dnl ---------------- dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' dnl in the sharutils 4.2 distribution. AC_DEFUN([CF_ANSI_CC_CHECK], [ AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[ cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) for cf_arg in "-DCC_HAS_PROTOS" \ "" \ -qlanglvl=ansi \ -std1 \ -Ae \ "-Aa -D_HPUX_SOURCE" \ -Xc do CF_ADD_CFLAGS($cf_arg) AC_TRY_COMPILE( [ #ifndef CC_HAS_PROTOS #if !defined(__STDC__) || (__STDC__ != 1) choke me #endif #endif ],[ int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);};], [cf_cv_ansi_cc="$cf_arg"; break]) done CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" ]) if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then CF_ADD_CFLAGS($cf_cv_ansi_cc) else AC_DEFINE(CC_HAS_PROTOS) fi fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44 dnl --------------- dnl For programs that must use an ANSI compiler, obtain compiler options that dnl will make it recognize prototypes. We'll do preprocessor checks in other dnl macros, since tools such as unproto can fake prototypes, but only part of dnl the preprocessor. AC_DEFUN([CF_ANSI_CC_REQD], [AC_REQUIRE([CF_ANSI_CC_CHECK]) if test "$cf_cv_ansi_cc" = "no"; then AC_ERROR( [Your compiler does not appear to recognize prototypes. You have the following choices: a. adjust your compiler options b. get an up-to-date compiler c. use a wrapper such as unproto]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 dnl -------------- dnl Allow user to disable a normally-on option. AC_DEFUN([CF_ARG_DISABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 dnl ------------- dnl Allow user to enable a normally-off option. AC_DEFUN([CF_ARG_ENABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41 dnl ------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. dnl dnl Parameters: dnl $1 = option name dnl $2 = help-string dnl $3 = action to perform if option is not default dnl $4 = action if perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes) if test "$enableval" != "$5" ; then ifelse($3,,[ :]dnl ,[ $3]) ifelse($4,,,[ else $4]) fi],[enableval=$5 ifelse($4,,,[ $4 ])dnl ])])dnl dnl --------------------------------------------------------------------------- dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31 dnl -------------- dnl Check if we're accidentally using a cache from a different machine. dnl Derive the system name, as a check for reusing the autoconf cache. dnl dnl If we've packaged config.guess and config.sub, run that (since it does a dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM dnl which is useful in cross-compiles. dnl dnl Note: we would use $ac_config_sub, but that is one of the places where dnl autoconf 2.5x broke compatibility with autoconf 2.13 AC_DEFUN([CF_CHECK_CACHE], [ if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then ifelse([$1],,[AC_CANONICAL_HOST],[$1]) system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) if test ".$system_name" != ".$cf_cv_system_name" ; then AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) AC_ERROR("Please remove config.cache and try again.") fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58 dnl --------------- dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from dnl a build-configuration such as imake. These have the pitfall that they dnl often contain compiler-specific options which we cannot use, mixed with dnl preprocessor options that we usually can. AC_DEFUN([CF_CHECK_CFLAGS], [ CF_VERBOSE(checking additions to CFLAGS) cf_check_cflags="$CFLAGS" cf_check_cppflags="$CPPFLAGS" CF_ADD_CFLAGS($1,yes) if test "$cf_check_cflags" != "$CFLAGS" ; then AC_TRY_LINK([#include ],[printf("Hello world");],, [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) if test "$cf_check_cppflags" != "$CPPFLAGS" ; then CF_VERBOSE(but keeping change to \$CPPFLAGS) fi CFLAGS="$cf_check_flags"]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CURSES_CPPFLAGS version: 9 updated: 2006/02/04 19:44:43 dnl ------------------ dnl Look for the curses headers. AC_DEFUN([CF_CURSES_CPPFLAGS],[ AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[ cf_cv_curses_incdir=no case $host_os in #(vi hpux10.*) #(vi test -d /usr/include/curses_colr && \ cf_cv_curses_incdir="-I/usr/include/curses_colr" ;; sunos3*|sunos4*) test -d /usr/5lib && \ test -d /usr/5include && \ cf_cv_curses_incdir="-I/usr/5include" ;; esac ]) test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS" CF_CURSES_HEADER CF_TERM_HEADER ])dnl dnl --------------------------------------------------------------------------- dnl CF_CURSES_FUNCS version: 12 updated: 2003/11/06 19:59:57 dnl --------------- dnl Curses-functions are a little complicated, since a lot of them are macros. AC_DEFUN([CF_CURSES_FUNCS], [ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_REQUIRE([CF_XOPEN_CURSES]) AC_REQUIRE([CF_CURSES_TERM_H]) for cf_func in $1 do CF_UPPER(cf_tr_func,$cf_func) AC_MSG_CHECKING(for ${cf_func}) CF_MSG_LOG(${cf_func}) AC_CACHE_VAL(cf_cv_func_$cf_func,[ eval cf_result='$ac_cv_func_'$cf_func if test ".$cf_result" != ".no"; then AC_TRY_LINK([ #ifdef HAVE_XCURSES #include char * XCursesProgramName = "test"; #else #include <${cf_cv_ncurses_header-curses.h}> #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) #include #else #if defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) #include #else #ifdef HAVE_TERM_H #include #endif #endif #endif #endif], [ #ifndef ${cf_func} long foo = (long)(&${cf_func}); exit(foo == 0); #endif ], [cf_result=yes], [cf_result=no]) fi eval 'cf_cv_func_'$cf_func'=$cf_result' ]) # use the computed/retrieved cache-value: eval 'cf_result=$cf_cv_func_'$cf_func AC_MSG_RESULT($cf_result) if test $cf_result != no; then AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func}) fi done ])dnl dnl --------------------------------------------------------------------------- dnl CF_CURSES_HEADER version: 1 updated: 2005/12/31 13:28:25 dnl ---------------- dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common dnl variations of ncurses' installs. dnl dnl See also CF_NCURSES_HEADER, which sets the same cache variable. AC_DEFUN([CF_CURSES_HEADER],[ AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ cf_cv_ncurses_header=none for cf_header in \ curses.h \ ncurses.h \ ncurses/curses.h \ ncurses/ncurses.h do AC_TRY_COMPILE([#include <${cf_header}>], [initscr(); tgoto("?", 0,0)], [cf_cv_ncurses_header=$cf_header; break],[]) done ]) if test "$cf_cv_ncurses_header" = none ; then AC_MSG_ERROR(No curses header-files found) fi # cheat, to get the right #define's for HAVE_NCURSES_H, etc. AC_CHECK_HEADERS($cf_cv_ncurses_header) ])dnl dnl --------------------------------------------------------------------------- dnl CF_CURSES_LIBS version: 24 updated: 2006/02/04 19:44:43 dnl -------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. AC_DEFUN([CF_CURSES_LIBS],[ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_MSG_CHECKING(if we have identified curses libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr(); tgoto("?", 0,0)], cf_result=yes, cf_result=no) AC_MSG_RESULT($cf_result) if test "$cf_result" = no ; then case $host_os in #(vi freebsd*) #(vi AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"]) ;; hpux10.*) #(vi AC_CHECK_LIB(cur_colr,initscr,[ LIBS="-lcur_colr $LIBS" ac_cv_func_initscr=yes ],[ AC_CHECK_LIB(Hcurses,initscr,[ # HP's header uses __HP_CURSES, but user claims _HP_CURSES. LIBS="-lHcurses $LIBS" CPPFLAGS="-D__HP_CURSES -D_HP_CURSES $CPPFLAGS" ac_cv_func_initscr=yes ])]) ;; linux*) # Suse Linux does not follow /usr/lib convention LIBS="$LIBS -L/lib" ;; sunos3*|sunos4*) test -d /usr/5lib && \ LIBS="$LIBS -L/usr/5lib -lcurses -ltermcap" ac_cv_func_initscr=yes ;; esac if test ".$ac_cv_func_initscr" != .yes ; then cf_save_LIBS="$LIBS" cf_term_lib="" cf_curs_lib="" if test ".${cf_cv_ncurses_version-no}" != .no then cf_check_list="ncurses curses cursesX" else cf_check_list="cursesX curses ncurses" fi # Check for library containing tgoto. Do this before curses library # because it may be needed to link the test-case for initscr. AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ for cf_term_lib in $cf_check_list termcap termlib unknown do AC_CHECK_LIB($cf_term_lib,tgoto,[break]) done ]) # Check for library containing initscr test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" for cf_curs_lib in $cf_check_list xcurses jcurses unknown do AC_CHECK_LIB($cf_curs_lib,initscr,[break]) done test $cf_curs_lib = unknown && AC_ERROR(no curses library found) LIBS="-l$cf_curs_lib $cf_save_LIBS" if test "$cf_term_lib" = unknown ; then AC_MSG_CHECKING(if we can link with $cf_curs_lib library) AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr()], [cf_result=yes], [cf_result=no]) AC_MSG_RESULT($cf_result) test $cf_result = no && AC_ERROR(Cannot link curses library) elif test "$cf_curs_lib" = "$cf_term_lib" ; then : elif test "$cf_term_lib" != predefined ; then AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr(); tgoto((char *)0, 0, 0);], [cf_result=no], [ LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr()], [cf_result=yes], [cf_result=error]) ]) AC_MSG_RESULT($cf_result) fi fi fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CURSES_TERM_H version: 6 updated: 2003/11/06 19:59:57 dnl ---------------- dnl SVr4 curses should have term.h as well (where it puts the definitions of dnl the low-level interface). This may not be true in old/broken implementations, dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4 dnl running with Solaris 2.5.1). AC_DEFUN([CF_CURSES_TERM_H], [ AC_CACHE_CHECK(for term.h, cf_cv_term_header,[ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl # If we found , look for , but always look # for if we do not find the variant. for cf_header in \ `echo ${cf_cv_ncurses_header-curses.h} | sed -e 's%/.*%/%'`term.h \ term.h do AC_TRY_COMPILE([ #include <${cf_cv_ncurses_header-curses.h}> #include <${cf_header}>], [WINDOW *x], [cf_cv_term_header=$cf_header break], [cf_cv_term_header=no]) done ]) case $cf_cv_term_header in #(vi term.h) #(vi AC_DEFINE(HAVE_TERM_H) ;; ncurses/term.h) AC_DEFINE(HAVE_NCURSES_TERM_H) ;; ncursesw/term.h) AC_DEFINE(HAVE_NCURSESW_TERM_H) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 dnl ---------- dnl "dirname" is not portable, so we fake it with a shell script. AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl dnl --------------------------------------------------------------------------- dnl CF_ENABLE_WARNINGS version: 3 updated: 2003/05/24 14:24:29 dnl ------------------ dnl Configure-option to enable gcc warnings AC_DEFUN([CF_ENABLE_WARNINGS],[ if ( test "$GCC" = yes || test "$GXX" = yes ) then AC_MSG_CHECKING(if you want to turn on gcc warnings) CF_ARG_ENABLE(warnings, [ --enable-warnings test: turn on gcc compiler warnings], [with_warnings=yes], [with_warnings=no]) AC_MSG_RESULT($with_warnings) if test "$with_warnings" = "yes" then CF_GCC_WARNINGS fi fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_FIND_LIBRARY version: 8 updated: 2004/11/23 20:14:58 dnl --------------- dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We dnl prefer a standard location, and use -L options only if we do not find the dnl library in the standard library location(s). dnl $1 = library name dnl $2 = library class, usually the same as library name dnl $3 = includes dnl $4 = code fragment to compile/link dnl $5 = corresponding function-name dnl $6 = flag, nonnull if failure should not cause an error-exit dnl dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had dnl to use a -L option. AC_DEFUN([CF_FIND_LIBRARY], [ eval 'cf_cv_have_lib_'$1'=no' cf_libdir="" AC_CHECK_FUNC($5, eval 'cf_cv_have_lib_'$1'=yes',[ cf_save_LIBS="$LIBS" AC_MSG_CHECKING(for $5 in -l$1) LIBS="-l$1 $LIBS" AC_TRY_LINK([$3],[$4], [AC_MSG_RESULT(yes) eval 'cf_cv_have_lib_'$1'=yes' ], [AC_MSG_RESULT(no) CF_LIBRARY_PATH(cf_search,$2) for cf_libdir in $cf_search do AC_MSG_CHECKING(for -l$1 in $cf_libdir) LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" AC_TRY_LINK([$3],[$4], [AC_MSG_RESULT(yes) eval 'cf_cv_have_lib_'$1'=yes' break], [AC_MSG_RESULT(no) LIBS="$cf_save_LIBS"]) done ]) ]) eval 'cf_found_library=[$]cf_cv_have_lib_'$1 ifelse($6,,[ if test $cf_found_library = no ; then AC_ERROR(Cannot link $1 library) fi ]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42 dnl -------------- dnl Find version of gcc AC_DEFUN([CF_GCC_VERSION],[ AC_REQUIRE([AC_PROG_CC]) GCC_VERSION=none if test "$GCC" = yes ; then AC_MSG_CHECKING(version of $CC) GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: dnl dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) dnl -Wredundant-decls (system headers make this too noisy) dnl -Wtraditional (combines too many unrelated messages, only a few useful) dnl -Wwrite-strings (too noisy, but should review occasionally). This dnl is enabled for ncurses using "--enable-const". dnl -pedantic dnl dnl Parameter: dnl $1 is an optional list of gcc warning flags that a particular dnl application might want to use, e.g., "no-unused" for dnl -Wno-unused dnl Special: dnl If $with_ext_const is "yes", add a check for -Wwrite-strings dnl AC_DEFUN([CF_GCC_WARNINGS], [ AC_REQUIRE([CF_GCC_VERSION]) CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) cat > conftest.$ac_ext <&AC_FD_CC ])dnl dnl --------------------------------------------------------------------------- dnl CF_NCURSES_CC_CHECK version: 3 updated: 2003/01/12 18:59:28 dnl ------------------- dnl Check if we can compile with ncurses' header file dnl $1 is the cache variable to set dnl $2 is the header-file to include dnl $3 is the root name (ncurses or ncursesw) AC_DEFUN([CF_NCURSES_CC_CHECK],[ AC_TRY_COMPILE([ ]ifelse($3,ncursesw,[ #define _XOPEN_SOURCE_EXTENDED #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ ])[ #include <$2>],[ #ifdef NCURSES_VERSION ]ifelse($3,ncursesw,[ #ifndef WACS_BSSB make an error #endif ])[ printf("%s\n", NCURSES_VERSION); #else #ifdef __NCURSES_H printf("old\n"); #else make an error #endif #endif ] ,[$1=$cf_header] ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_NCURSES_CPPFLAGS version: 18 updated: 2005/12/31 13:26:39 dnl ------------------- dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting dnl the CPPFLAGS variable so we can include its header. dnl dnl The header files may be installed as either curses.h, or ncurses.h (would dnl be obsolete, except that some packagers prefer this name to distinguish it dnl from a "native" curses implementation). If not installed for overwrite, dnl the curses.h file would be in an ncurses subdirectory (e.g., dnl /usr/include/ncurses), but someone may have installed overwriting the dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in dnl the header. dnl dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header dnl is already in the include-path, don't even bother with this, since we cannot dnl easily determine which file it is. In this case, it has to be . dnl dnl The optional parameter gives the root name of the library, in case it is dnl not installed as the default curses library. That is how the dnl wide-character version of ncurses is installed. AC_DEFUN([CF_NCURSES_CPPFLAGS], [AC_REQUIRE([CF_WITH_CURSES_DIR]) AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl cf_ncuhdr_root=ifelse($1,,ncurses,$1) test -n "$cf_cv_curses_dir" && \ test "$cf_cv_curses_dir" != "no" && \ CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS" AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[ cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" for cf_header in $cf_header_list do CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1) test "$cf_cv_ncurses_h" != no && break done ]) CF_NCURSES_HEADER CF_TERM_HEADER # some applications need this, but should check for NCURSES_VERSION AC_DEFINE(NCURSES) CF_NCURSES_VERSION ])dnl dnl --------------------------------------------------------------------------- dnl CF_NCURSES_HEADER version: 1 updated: 2005/12/31 13:28:37 dnl ----------------- dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common dnl variations of ncurses' installs. dnl dnl See also CF_CURSES_HEADER, which sets the same cache variable. AC_DEFUN([CF_NCURSES_HEADER],[ if test "$cf_cv_ncurses_h" != no ; then cf_cv_ncurses_header=$cf_cv_ncurses_h else AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[ test -n "$verbose" && echo CF_HEADER_PATH(cf_search,$cf_ncuhdr_root) test -n "$verbose" && echo search path $cf_search cf_save2_CPPFLAGS="$CPPFLAGS" for cf_incdir in $cf_search do CF_ADD_INCDIR($cf_incdir) for cf_header in \ ncurses.h \ curses.h do CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1) if test "$cf_cv_ncurses_h2" != no ; then cf_cv_ncurses_h2=$cf_incdir/$cf_header test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG break fi test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG done CPPFLAGS="$cf_save2_CPPFLAGS" test "$cf_cv_ncurses_h2" != no && break done test "$cf_cv_ncurses_h2" = no && AC_ERROR(not found) ]) CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2) cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header fi CF_ADD_INCDIR($cf_1st_incdir) fi # Set definitions to allow ifdef'ing for ncurses.h case $cf_cv_ncurses_header in # (vi *ncurses.h) AC_DEFINE(HAVE_NCURSES_H) ;; esac case $cf_cv_ncurses_header in # (vi ncurses/curses.h|ncurses/ncurses.h) AC_DEFINE(HAVE_NCURSES_NCURSES_H) ;; ncursesw/curses.h|ncursesw/ncurses.h) AC_DEFINE(HAVE_NCURSESW_NCURSES_H) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_NCURSES_LIBS version: 12 updated: 2004/04/27 16:26:05 dnl --------------- dnl Look for the ncurses library. This is a little complicated on Linux, dnl because it may be linked with the gpm (general purpose mouse) library. dnl Some distributions have gpm linked with (bsd) curses, which makes it dnl unusable with ncurses. However, we don't want to link with gpm unless dnl ncurses has a dependency, since gpm is normally set up as a shared library, dnl and the linker will record a dependency. dnl dnl The optional parameter gives the root name of the library, in case it is dnl not installed as the default curses library. That is how the dnl wide-character version of ncurses is installed. AC_DEFUN([CF_NCURSES_LIBS], [AC_REQUIRE([CF_NCURSES_CPPFLAGS]) cf_nculib_root=ifelse($1,,ncurses,$1) # This works, except for the special case where we find gpm, but # ncurses is in a nonstandard location via $LIBS, and we really want # to link gpm. cf_ncurses_LIBS="" cf_ncurses_SAVE="$LIBS" AC_CHECK_LIB(gpm,Gpm_Open, [AC_CHECK_LIB(gpm,initscr, [LIBS="$cf_ncurses_SAVE"], [cf_ncurses_LIBS="-lgpm"])]) case $host_os in #(vi freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). if test "$cf_nculib_root" = ncurses ; then AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) fi ;; esac LIBS="$cf_ncurses_LIBS $LIBS" if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) then LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS" else CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root, [#include <${cf_cv_ncurses_header-curses.h}>], [initscr()], initscr) fi if test -n "$cf_ncurses_LIBS" ; then AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS) cf_ncurses_SAVE="$LIBS" for p in $cf_ncurses_LIBS ; do q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` if test "$q" != "$LIBS" ; then LIBS="$q" fi done AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) LIBS="$cf_ncurses_SAVE"]) fi CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) AC_DEFINE_UNQUOTED($cf_nculib_ROOT) ])dnl dnl --------------------------------------------------------------------------- dnl CF_NCURSES_VERSION version: 11 updated: 2003/11/06 19:59:57 dnl ------------------ dnl Check for the version of ncurses, to aid in reporting bugs, etc. dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi. AC_DEFUN([CF_NCURSES_VERSION], [ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ cf_cv_ncurses_version=no cf_tempfile=out$$ rm -f $cf_tempfile AC_TRY_RUN([ #include <${cf_cv_ncurses_header-curses.h}> #include int main() { FILE *fp = fopen("$cf_tempfile", "w"); #ifdef NCURSES_VERSION # ifdef NCURSES_VERSION_PATCH fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); # else fprintf(fp, "%s\n", NCURSES_VERSION); # endif #else # ifdef __NCURSES_H fprintf(fp, "old\n"); # else make an error # endif #endif exit(0); }],[ cf_cv_ncurses_version=`cat $cf_tempfile`],,[ # This will not work if the preprocessor splits the line after the # Autoconf token. The 'unproto' program does that. cat > conftest.$ac_ext < #undef Autoconf #ifdef NCURSES_VERSION Autoconf NCURSES_VERSION #else #ifdef __NCURSES_H Autoconf "old" #endif ; #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out" AC_TRY_EVAL(cf_try) if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'` test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" rm -f conftest.out fi ]) rm -f $cf_tempfile ]) test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES) ])dnl dnl --------------------------------------------------------------------------- dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05 dnl ------------------ dnl see CF_WITH_NO_LEAKS AC_DEFUN([CF_NO_LEAKS_OPTION],[ AC_MSG_CHECKING(if you want to use $1 for testing) AC_ARG_WITH($1, [$2], [AC_DEFINE($3)ifelse([$4],,[ $4 ]) : ${with_cflags:=-g} : ${with_no_leaks:=yes} with_$1=yes], [with_$1=]) AC_MSG_RESULT(${with_$1:-no}) case .$with_cflags in #(vi .*-g*) case .$CFLAGS in #(vi .*-g*) #(vi ;; *) CF_ADD_CFLAGS([-g]) ;; esac ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46 dnl -------------- dnl Check the argument to see that it looks like a pathname. Rewrite it if it dnl begins with one of the prefix/exec_prefix variables, and then again if the dnl result begins with 'NONE'. This is necessary to work around autoconf's dnl delayed evaluation of those symbols. AC_DEFUN([CF_PATH_SYNTAX],[ if test "x$prefix" != xNONE; then cf_path_syntax="$prefix" else cf_path_syntax="$ac_default_prefix" fi case ".[$]$1" in #(vi .\[$]\(*\)*|.\'*\'*) #(vi ;; ..|./*|.\\*) #(vi ;; .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX ;; .\[$]{*prefix}*) #(vi eval $1="[$]$1" case ".[$]$1" in #(vi .NONE/*) $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` ;; esac ;; #(vi .no|.NONE/*) $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` ;; *) ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_PDCURSES_X11 version: 7 updated: 2006/11/12 17:31:59 dnl --------------- dnl Configure for PDCurses' X11 library AC_DEFUN([CF_PDCURSES_X11],[ AC_REQUIRE([CF_X_ATHENA]) AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none) if test "$XCURSES_CONFIG" != none ; then CPPFLAGS="`$XCURSES_CONFIG --cflags` $CPPFLAGS" LIBS="`$XCURSES_CONFIG --libs` $LIBS" cf_cv_lib_XCurses=yes else LDFLAGS="$LDFLAGS $X_LIBS" CF_CHECK_CFLAGS($X_CFLAGS) AC_CHECK_LIB(X11,XOpenDisplay, [LIBS="-lX11 $LIBS"],, [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[ LIBS="-lXCurses $LIBS" AC_TRY_LINK([ #include char *XCursesProgramName = "test"; ],[XCursesExit();], [cf_cv_lib_XCurses=yes], [cf_cv_lib_XCurses=no]) ]) fi if test $cf_cv_lib_XCurses = yes ; then AC_DEFINE(UNIX) AC_DEFINE(XCURSES) AC_DEFINE(HAVE_XCURSES) else AC_ERROR(Cannot link with XCurses) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 dnl ----------- dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. AC_DEFUN([CF_PROG_EXT], [ AC_REQUIRE([CF_CHECK_CACHE]) case $cf_cv_system_name in os2*) CFLAGS="$CFLAGS -Zmt" CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" CXXFLAGS="$CXXFLAGS -Zmt" # autoconf's macro sets -Zexe and suffix both, which conflict:w LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" ac_cv_exeext=.exe ;; esac AC_EXEEXT AC_OBJEXT PROG_EXT="$EXEEXT" AC_SUBST(PROG_EXT) test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") ])dnl dnl --------------------------------------------------------------------------- dnl CF_SUBDIR_PATH version: 4 updated: 2006/11/18 17:13:19 dnl -------------- dnl Construct a search-list for a nonstandard header/lib-file dnl $1 = the variable to return as result dnl $2 = the package name dnl $3 = the subdirectory, e.g., bin, include or lib AC_DEFUN([CF_SUBDIR_PATH], [$1="" test -d "[$]HOME" && { test -n "$verbose" && echo " ... testing $3-directories under [$]HOME" test -d "[$]HOME/$3" && $1="[$]$1 [$]HOME/$3" test -d "[$]HOME/$3/$2" && $1="[$]$1 [$]HOME/$3/$2" test -d "[$]HOME/$3/$2/$3" && $1="[$]$1 [$]HOME/$3/$2/$3" } # For other stuff under the home directory, it should be sufficient to put # a symbolic link for $HOME/$2 to the actual package location: test -d "[$]HOME/$2" && { test -n "$verbose" && echo " ... testing $3-directories under [$]HOME/$2" test -d "[$]HOME/$2/$3" && $1="[$]$1 [$]HOME/$2/$3" test -d "[$]HOME/$2/$3/$2" && $1="[$]$1 [$]HOME/$2/$3/$2" } test "$prefix" != /usr/local && \ test -d /usr/local && { test -n "$verbose" && echo " ... testing $3-directories under /usr/local" test -d /usr/local/$3 && $1="[$]$1 /usr/local/$3" test -d /usr/local/$3/$2 && $1="[$]$1 /usr/local/$3/$2" test -d /usr/local/$3/$2/$3 && $1="[$]$1 /usr/local/$3/$2/$3" test -d /usr/local/$2/$3 && $1="[$]$1 /usr/local/$2/$3" test -d /usr/local/$2/$3/$2 && $1="[$]$1 /usr/local/$2/$3/$2" } test "$prefix" != NONE && \ test -d $prefix && { test -n "$verbose" && echo " ... testing $3-directories under $prefix" test -d $prefix/$3 && $1="[$]$1 $prefix/$3" test -d $prefix/$3/$2 && $1="[$]$1 $prefix/$3/$2" test -d $prefix/$3/$2/$3 && $1="[$]$1 $prefix/$3/$2/$3" test -d $prefix/$2/$3 && $1="[$]$1 $prefix/$2/$3" test -d $prefix/$2/$3/$2 && $1="[$]$1 $prefix/$2/$3/$2" } test "$prefix" != /opt && \ test -d /opt && { test -n "$verbose" && echo " ... testing $3-directories under /opt" test -d /opt/$3 && $1="[$]$1 /opt/$3" test -d /opt/$3/$2 && $1="[$]$1 /opt/$3/$2" test -d /opt/$3/$2/$3 && $1="[$]$1 /opt/$3/$2/$3" test -d /opt/$2/$3 && $1="[$]$1 /opt/$2/$3" test -d /opt/$2/$3/$2 && $1="[$]$1 /opt/$2/$3/$2" } test "$prefix" != /usr && \ test -d /usr && { test -n "$verbose" && echo " ... testing $3-directories under /usr" test -d /usr/$3 && $1="[$]$1 /usr/$3" test -d /usr/$3/$2 && $1="[$]$1 /usr/$3/$2" test -d /usr/$3/$2/$3 && $1="[$]$1 /usr/$3/$2/$3" test -d /usr/$2/$3 && $1="[$]$1 /usr/$2/$3" } ])dnl dnl --------------------------------------------------------------------------- dnl CF_TERM_HEADER version: 1 updated: 2005/12/31 13:26:39 dnl -------------- dnl Look for term.h, which is part of X/Open curses. It defines the interface dnl to terminfo database. Usually it is in the same include-path as curses.h, dnl but some packagers change this, breaking various applications. AC_DEFUN([CF_TERM_HEADER],[ AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[ case ${cf_cv_ncurses_header} in #(vi */ncurses.h|*/ncursesw.h) #(vi cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'` ;; *) cf_term_header=term.h ;; esac for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" do AC_TRY_COMPILE([#include #include <${cf_cv_ncurses_header-curses.h}> #include <$cf_test> ],[int x = auto_left_margin],[ cf_cv_term_header="$cf_test"],[ cf_cv_term_header=unknown ]) test "$cf_cv_term_header" != unknown && break done ]) # Set definitions to allow ifdef'ing to accommodate subdirectories case $cf_cv_term_header in # (vi *term.h) AC_DEFINE(HAVE_TERM_H) ;; esac case $cf_cv_term_header in # (vi ncurses/term.h) #(vi AC_DEFINE(HAVE_NCURSES_TERM_H) ;; ncursesw/term.h) AC_DEFINE(HAVE_NCURSESW_TERM_H) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 dnl -------- dnl Make an uppercase version of a variable dnl $1=uppercase($2) AC_DEFUN([CF_UPPER], [ $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` ])dnl dnl --------------------------------------------------------------------------- dnl CF_UTF8_LIB version: 4 updated: 2003/03/01 18:36:42 dnl ----------- dnl Check for multibyte support, and if not found, utf8 compatibility library AC_DEFUN([CF_UTF8_LIB], [ AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ cf_save_LIBS="$LIBS" AC_TRY_LINK([ #include ],[putwc(0,0);], [cf_cv_utf8_lib=yes], [LIBS="-lutf8 $LIBS" AC_TRY_LINK([ #include ],[putwc(0,0);], [cf_cv_utf8_lib=add-on], [cf_cv_utf8_lib=no]) LIBS="$cf_save_LIBS" ])]) # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between # ncurses/ncursesw: if test "$cf_cv_utf8_lib" = "add-on" ; then AC_DEFINE(HAVE_LIBUTF8_H) LIBS="-lutf8 $LIBS" fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14 dnl ---------- dnl Use AC_VERBOSE w/o the warnings AC_DEFUN([CF_VERBOSE], [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59 dnl ------------------ dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses dnl libraries. AC_DEFUN([CF_WITH_CURSES_DIR],[ AC_ARG_WITH(curses-dir, [ --with-curses-dir=DIR directory in which (n)curses is installed], [CF_PATH_SYNTAX(withval) cf_cv_curses_dir=$withval], [cf_cv_curses_dir=no]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_DBMALLOC version: 6 updated: 2006/12/16 14:24:05 dnl ---------------- dnl Configure-option for dbmalloc. The optional parameter is used to override dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. AC_DEFUN([CF_WITH_DBMALLOC],[ CF_NO_LEAKS_OPTION(dbmalloc, [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], [USE_DBMALLOC]) if test "$with_dbmalloc" = yes ; then AC_CHECK_HEADER(dbmalloc.h, [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse($1,,[],[,$1]))]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_DMALLOC version: 6 updated: 2006/12/16 14:24:05 dnl --------------- dnl Configure-option for dmalloc. The optional parameter is used to override dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. AC_DEFUN([CF_WITH_DMALLOC],[ CF_NO_LEAKS_OPTION(dmalloc, [ --with-dmalloc test: use Gray Watson's dmalloc library], [USE_DMALLOC]) if test "$with_dmalloc" = yes ; then AC_CHECK_HEADER(dmalloc.h, [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse($1,,[],[,$1]))]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_NO_LEAKS version: 1 updated: 2006/12/14 18:00:21 dnl ---------------- AC_DEFUN([CF_WITH_NO_LEAKS],[ AC_REQUIRE([CF_WITH_DMALLOC]) AC_REQUIRE([CF_WITH_DBMALLOC]) AC_REQUIRE([CF_WITH_PURIFY]) AC_REQUIRE([CF_WITH_VALGRIND]) AC_MSG_CHECKING(if you want to perform memory-leak testing) AC_ARG_WITH(no-leaks, [ --with-no-leaks test: free permanent memory, analyze leaks], [AC_DEFINE(NO_LEAKS) cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}" case ${cf_doalloc} in #(vi *yes*) ;; *) AC_DEFINE(DOALLOC,10000) ;; esac with_no_leaks=yes], [with_no_leaks=]) AC_MSG_RESULT($with_no_leaks) ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_PURIFY version: 2 updated: 2006/12/14 18:43:43 dnl -------------- AC_DEFUN([CF_WITH_PURIFY],[ CF_NO_LEAKS_OPTION(purify, [ --with-purify test: use Purify], [USE_PURIFY], [LINK_PREFIX="$LINK_PREFIX purify"]) AC_SUBST(LINK_PREFIX) ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 dnl ---------------- AC_DEFUN([CF_WITH_VALGRIND],[ CF_NO_LEAKS_OPTION(valgrind, [ --with-valgrind test: use valgrind], [USE_VALGRIND]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_XOPEN_CURSES version: 8 updated: 2003/11/07 19:47:46 dnl --------------- dnl Test if we should define X/Open source for curses, needed on Digital Unix dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. dnl dnl The getbegyx() check is needed for HPUX, which omits legacy macros such dnl as getbegy(). The latter is better design, but the former is standard. AC_DEFUN([CF_XOPEN_CURSES], [ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[ AC_TRY_LINK([ #include #include <${cf_cv_ncurses_header-curses.h}>],[ long x = winnstr(stdscr, "", 0); int x1, y1; getbegyx(stdscr, y1, x1)], [cf_cv_need_xopen_extension=no], [AC_TRY_LINK([ #define _XOPEN_SOURCE_EXTENDED #include #include <${cf_cv_ncurses_header-curses.h}>],[ long x = winnstr(stdscr, "", 0); int x1, y1; getbegyx(stdscr, y1, x1)], [cf_cv_need_xopen_extension=yes], [cf_cv_need_xopen_extension=unknown])])]) test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" ])dnl dnl --------------------------------------------------------------------------- dnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41 dnl ----------- dnl Check for Xaw (Athena) libraries dnl dnl Sets $cf_x_athena according to the flavor of Xaw which is used. AC_DEFUN([CF_X_ATHENA], [AC_REQUIRE([CF_X_TOOLKIT]) cf_x_athena=${cf_x_athena-Xaw} AC_MSG_CHECKING(if you want to link with Xaw 3d library) withval= AC_ARG_WITH(Xaw3d, [ --with-Xaw3d link with Xaw 3d library]) if test "$withval" = yes ; then cf_x_athena=Xaw3d AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(if you want to link with neXT Athena library) withval= AC_ARG_WITH(neXtaw, [ --with-neXtaw link with neXT Athena library]) if test "$withval" = yes ; then cf_x_athena=neXtaw AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(if you want to link with Athena-Plus library) withval= AC_ARG_WITH(XawPlus, [ --with-XawPlus link with Athena-Plus library]) if test "$withval" = yes ; then cf_x_athena=XawPlus AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_CHECK_LIB(Xext,XextCreateExtension, [LIBS="-lXext $LIBS"]) cf_x_athena_lib="" CF_X_ATHENA_CPPFLAGS($cf_x_athena) CF_X_ATHENA_LIBS($cf_x_athena) ])dnl dnl --------------------------------------------------------------------------- dnl CF_X_ATHENA_CPPFLAGS version: 2 updated: 2002/10/09 20:00:37 dnl -------------------- dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. AC_DEFUN([CF_X_ATHENA_CPPFLAGS], [ cf_x_athena_root=ifelse($1,,Xaw,$1) cf_x_athena_include="" for cf_path in default \ /usr/contrib/X11R6 \ /usr/contrib/X11R5 \ /usr/lib/X11R5 \ /usr/local do if test -z "$cf_x_athena_include" ; then cf_save="$CPPFLAGS" cf_test=X11/$cf_x_athena_root/SimpleMenu.h if test $cf_path != default ; then CPPFLAGS="-I$cf_path/include $cf_save" AC_MSG_CHECKING(for $cf_test in $cf_path) else AC_MSG_CHECKING(for $cf_test) fi AC_TRY_COMPILE([ #include #include <$cf_test>],[], [cf_result=yes], [cf_result=no]) AC_MSG_RESULT($cf_result) if test "$cf_result" = yes ; then cf_x_athena_include=$cf_path break else CPPFLAGS="$cf_save" fi fi done if test -z "$cf_x_athena_include" ; then AC_MSG_WARN( [Unable to successfully find Athena header files with test program]) elif test "$cf_x_athena_include" != default ; then CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include" fi ]) dnl --------------------------------------------------------------------------- dnl CF_X_ATHENA_LIBS version: 6 updated: 2006/11/30 17:57:11 dnl ---------------- dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. AC_DEFUN([CF_X_ATHENA_LIBS], [AC_REQUIRE([CF_X_TOOLKIT]) cf_x_athena_root=ifelse($1,,Xaw,$1) cf_x_athena_lib="" for cf_path in default \ /usr/contrib/X11R6 \ /usr/contrib/X11R5 \ /usr/lib/X11R5 \ /usr/local do for cf_lib in \ "-l$cf_x_athena_root -lXmu" \ "-l$cf_x_athena_root -lXpm -lXmu" \ "-l${cf_x_athena_root}_s -lXmu_s" do if test -z "$cf_x_athena_lib" ; then cf_save="$LIBS" cf_test=XawSimpleMenuAddGlobalActions if test $cf_path != default ; then LIBS="-L$cf_path/lib $cf_lib $LIBS" AC_MSG_CHECKING(for $cf_lib in $cf_path) else LIBS="$cf_lib $LIBS" AC_MSG_CHECKING(for $cf_test in $cf_lib) fi AC_TRY_LINK([],[$cf_test()], [cf_result=yes], [cf_result=no]) AC_MSG_RESULT($cf_result) if test "$cf_result" = yes ; then cf_x_athena_lib="$cf_lib" break fi LIBS="$cf_save" fi done done if test -z "$cf_x_athena_lib" ; then AC_ERROR( [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) fi CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) ]) dnl --------------------------------------------------------------------------- dnl CF_X_TOOLKIT version: 11 updated: 2006/11/29 19:05:14 dnl ------------ dnl Check for X Toolkit libraries dnl AC_DEFUN([CF_X_TOOLKIT], [ AC_REQUIRE([AC_PATH_XTRA]) AC_REQUIRE([CF_CHECK_CACHE]) # SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -` cf_have_X_LIBS=no LDFLAGS="$X_LIBS $LDFLAGS" CF_CHECK_CFLAGS($X_CFLAGS) AC_CHECK_FUNC(XOpenDisplay,,[ AC_CHECK_LIB(X11,XOpenDisplay, [LIBS="-lX11 $LIBS"],, [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) AC_CHECK_FUNC(XtAppInitialize,,[ AC_CHECK_LIB(Xt, XtAppInitialize, [AC_DEFINE(HAVE_LIBXT) cf_have_X_LIBS=Xt LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) if test $cf_have_X_LIBS = no ; then AC_WARN( [Unable to successfully link X Toolkit library (-lXt) with test program. You will have to check and add the proper libraries by hand to makefile.]) fi ])dnl add-20070214.orig/add.10000644000175000017500000001601410564716211014167 0ustar azatothazatoth.\"/**************************************************************************** .\" Copyright 1995-2002,2007 by Thomas E. Dickey * .\" All Rights Reserved. * .\" * .\" Permission to use, copy, modify, and distribute this software and its * .\" documentation for any purpose and without fee is hereby granted, provided * .\" that the above copyright notice appear in all copies and that both that * .\" copyright notice and this permission notice appear in supporting * .\" documentation, and that the name of the above listed copyright holder(s) * .\" not be used in advertising or publicity pertaining to distribution of the * .\" software without specific, written prior permission. * .\" * .\" THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD * .\" TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * .\" FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE * .\" FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * .\" IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * .\" ***************************************************************************/ .\" $Id: add.1,v 1.5 2007/02/14 23:34:33 tom Exp $ .de EX .RS .nf .sp .fam C \" groff: Courier .. .de EE .fi .RE .sp .5 .fam T \" groff: Times-Roman (default) .. . .TH ADD 1 .hy 0 . .SH NAME \fBadd\fR \- full-screen editing calculator . .SH USAGE \fBadd\fP\fI [options] [file-specifications]\fP . .SH SYNOPSIS \fBAdd\fR is a fixed-point calculator that operates as a full-screen editor. . .SH DESCRIPTION \fBAdd\fR performs fixed-point computation. It is designed for use as a checkbook or expense-account balancing tool. .PP \fBAdd\fR maintains a running result for each operation. You may scroll to any position in the expression list and modify the list. Enter data by typing numbers (with optional decimal point), separated by operators. .PP An output transcript may be saved and reloaded for further editing. Scripts are loaded from left to right (with the "output" processed first). . .SH OPTIONS Command line options of \fBadd\fR are: . .TP .BI \-h Prints the list of options. .TP .BI \-i " interval" Sets compounding interval for interest computation. .TP .BI \-o " script" Specify file in which to save output transcript. .TP .BI \-p " num" Sets precision (number of digits after the decimal place). . .SH OPERATIONS . .SS Computations: . The operators are all single-character: . .TP .B "+" begins an addition .TP .B "-" begins a subtraction .TP .B "~" negates the result .TP .B "*" begins a multiplication .TP .B "/" begins a division .TP .B "%" begins an interest computation (uses \fIinterval\fR): rate=number. .TP .B "$" begins a sales-tax computation: rate=number. .TP .B "(" opening parenthesis. This may enclose a unary '-', more parentheses, or data (implicit unary '+'). .TP .B ")" closing parenthesis, expects another operator, not data. .TP .B "=" flushes out the current number, forces re-computation of the running result. . .PP A space flushes out the current number-input, and (by default) sets the next operator to be the same as the current one. You may repeat the last arithmetic operation of any type: . .TP .B "a" repeats the last '+' (default 0). .TP .B "s" repeats the last '-' (default 0). .TP .B "n" repeats the last '~'. .TP .B "m" repeats the last '*' (default 1). .TP .B "d" repeats the last '/' (default 1). .TP .B "i" repeats the last '%' (default 4). .TP .B "t" repeats the last '$' (default 4). . .PP You may toggle the prefix operator of any number by typing a single character: . .TP .B "A" toggles the operator to '+'. .TP .B "S" toggles the operator to '-'. .TP .B "N" toggles the operator to '~'. .TP .B "M" toggles the operator to '*'. .TP .B "D" toggles the operator to '/'. .TP .B "I" toggles the operator to '%'. .TP .B "T" toggles the operator to '$'. . .SS Editing: . As you enter data, you may edit it. A backspace deletes the last digit of the current number (if it is visible). Use the arrow keys or vi-style 'h' and 'l' to move left and right within the line. Other editing commands include . .TP .B "u" undoes the last x/X command (restricted to restoring the current data only). .TP .B "x" deletes the current data. If the data is null, deletes the following line. .TP .B "X" deletes the current data. If the data is null, deletes the preceding line and moves up. .TP .B "o" opens a new line after the current line. .TP .B "O" opens a new line before the current line. .TP .B "#" edit the associated comment. . .PP An "open" permits you to insert a new operator and data into the expression list. You may type an operator character (e.g., '+'), and continue with the new data, or an operator-repeat (e.g., 'A'). In either case, you may edit the new data, just as you would the old data. A 'u' (or other toggle, such as 'o', 'O', or 'q') typed after an open will undo the open (and close it). . .SS Scrolling/cursor movement: . .TP .B H move to the top line on the screen. .TP .B M move to the middle line on the screen. .TP .B L move to the last line on the screen .TP .B CTL/F scroll forward one screen. .TP .B CTL/B scroll backward one screen. .TP .B j move forward one line. .TP .B k move backward one line. .TP .B z move the current line to the top of the screen. .TP .B z. move the current line to the middle of the screen. .TP .B z- move the current line to the bottom of the screen. . .PP Like \fBvi\fR, \fBadd\fR allows you to jump to a particular line with a ":" command . .TP .B :$ jumps to the last entry .TP .B :1 jumps to the first entry. . .SS Scripts: . Transcript files are formatted to permit line-oriented entries: . .EX # comment .EE .PP The transcripts saved by \fBadd\fR contain the running result in the "ignored" part. To exit without saving a transcript, type 'Q'. A normal exit, by typing 'q', saves the list of operators, data (and running result) in the specified file. .PP You can read and write scripts without leaving \fBadd\fR. . reads a script at the current entry .TP .BI :e " file" clears the current script and reads a script from the file. .TP .BI :f shows the current script name. .TP .BI :r " file" .TP .BI :w " file" writes a script to the specified file. . .SH ENVIRONMENT \fBAdd\fR runs in a portable UNIX\*R environment. . .SH FILES \fBAdd\fR is a single binary module, with a help file \fBadd.hlp\fR installed in the same directory. . .SH FUTURE WORK It would be nice to be able to change the precision within the program. In particular, the interest and sales tax computations would be more useful if their precision was independent of the running total. . .SH AUTHOR Thomas Dickey . .SH SEE ALSO .PP wc\ (1), vi\ (1) add-20070214.orig/add.c0000644000175000017500000014170710564726644014274 0ustar azatothazatoth/****************************************************************************** * Copyright 1994-2002,2007 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * * that the above copyright notice appear in all copies and that both that * * copyright notice and this permission notice appear in supporting * * documentation, and that the name of the above listed copyright holder(s) * * not be used in advertising or publicity pertaining to distribution of the * * software without specific, written prior permission. * * * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD * * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE * * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ******************************************************************************/ static const char Id[] = "$Id: add.c,v 1.40 2007/02/15 00:47:32 tom Exp $"; static const char copyrite[] = "Copyright 1994-2002,2007 by Thomas E. Dickey"; /* * Title: add.c * Author: T.E.Dickey * Created: 05 May 1986 * Modified: (see CHANGES) * * Function: This is a simple adding machine that uses curses to display * a column of values, operators and results. The user can * move up and down in the column, modifying the values and * operators. */ #include #include #define SALLOC(s) (s *)malloc(sizeof(s)) #define SSTACK struct SStack SSTACK { SSTACK *next; FILE *sfp; char **sscripts; }; static void Recompute(DATA *); static void ShowRange(DATA *, DATA *); static void ShowFrom(DATA *); /* * Common data */ static char *top_output; static DATA *all_data; /* => beginning of data */ static DATA *top_data; /* => beginning of current screen */ static Value val_frac; /* # of units in 'len_frac' (e.g., 100.0) */ static long big_long; /* largest signed 'long' value */ static int interval; /* compounding interval-divisor */ static int val_width; /* maximum width of formatted number */ static int len_frac; /* nominal number of digits after period */ static Bool show_error; /* suppress normal reporting until GetC() */ static Bool show_scripts; /* force script to be visible, for testing */ /* * Input-script control: */ static SSTACK *sstack; /* script-stack */ static FILE *scriptFP; /* current script file-pointer */ static char **scriptv; /* pointer to list of input-scripts */ static Bool scriptCHG; /* set true if there's a change after scripts */ static Bool scriptNUM; /* set true to 0..n for script number */ /* * Help-screen */ static DATA *all_help; static char *helpfile; #define CMD(op,l,u,f,s) {op, l, u, f, s} /* * Check to see if the given character is a legal 'add' operator (excluding * editing/scrolling): */ /* *INDENT-OFF* */ static struct { char command; char repeats; char toggles; Bool isunary; char *explain; } Commands[] = { CMD(OP_ADD, 'a', 'A', TRUE, "add"), CMD(OP_SUB, 's', 'S', TRUE, "subtract"), CMD(OP_NEG, 'n', 'N', FALSE, "negate"), CMD(OP_MUL, 'm', 'M', FALSE, "multiply"), CMD(OP_DIV, 'd', 'D', FALSE, "divide"), CMD(OP_INT, 'i', 'I', FALSE, "interest"), CMD(OP_TAX, 't', 'T', FALSE, "tax"), CMD(L_PAREN, EOS, EOS, TRUE, "begin group"), CMD(R_PAREN, EOS, EOS, FALSE, "end group") }; /* *INDENT-ON* */ /* * Normally we don't show the results of replaying a script. This makes * loading scripts much faster. */ static int isVisible(void) { return show_scripts || (scriptFP == 0); } /* * Lookup a character to see if it is a legal operator, returning nonnull * in that case. */ #define LOOKUP(func,lookup,result) \ static int func(int c) { \ unsigned j; \ for (j = 0; j < SIZEOF(Commands); j++) \ if (Commands[j].lookup == c) \ return result; \ return 0; \ } LOOKUP(isCommand, command, c) LOOKUP(isRepeats, repeats, Commands[j].command) LOOKUP(isToggles, toggles, Commands[j].command) LOOKUP(isUnary, command, Commands[j].isunary) /* * Find the end of the DATA list */ static DATA *EndOfData(void) { register DATA *np; if ((np = all_data) != 0) { while (!LastData(np)) np = np->next; } return np; } /* * Returns true if the DATA entry is either the 0th or 1st entry in the * list. */ static int FirstData(DATA * np) { return (np->prev == 0 || np->prev == all_data); } /* * Tests for special case of operators that cannot appear in a unary context. */ static int UnaryConflict(DATA * np, int chr) { if (isCommand(chr)) return (!isUnary(chr) && (FirstData(np) || np->prev->psh)); return FALSE; } /* * Trim whitespace from the end of a string */ static void TrimString(char *src) { register char *end = src + strlen(src); while (end-- != src) { if (isspace(UCH(*end))) *end = EOS; else break; } } /* * Allocate a string, trimming whitespace from the end for consistency. */ static char * AllocString(char *src) { return strcpy(malloc((unsigned) (strlen(src) + 1)), src); } /* * Allocate and initialize a DATA entry */ static DATA * AllocData(DATA * after) { register DATA *np = SALLOC(DATA); np->txt = 0; np->val = np->sum = np->aux = 0.0; np->cmd = EOS; np->psh = FALSE; np->dot = len_frac; np->next = np->prev = 0; if (after != 0) { np->prev = after; np->next = after->next; after->next = np; if (!LastData(np)) np->next->prev = np; } else { /* append to the end of the list */ register DATA *op = EndOfData(); if (op != 0) { op->next = np; np->prev = op; } else { all_data = np; } } return np; } /* * Free and delink the data from the list. If it was a permanent entry, * recompute the display from that point. Otherwise, simply repaint. */ static DATA * FreeData(DATA * np, int permanent) { register DATA *prev = np->prev; register DATA *next = np->next; if (prev == 0) { /* we're at the beginning of the list */ all_data = next; if (next != 0) next->prev = 0; } else { prev->next = next; if (next != 0) { next->prev = prev; } else { /* deleted the end-of-data */ next = prev; } } if (np->txt != 0) free(np->txt); free((char *) np); if (top_data == np) top_data = next; if (screen_active) { if (permanent) { Recompute(next); } else { ShowFrom(next); } } return next; } /* * Count the data from the beginning to the specified entry. */ static int CountData(DATA * np) { register int seq = 0; while (np->prev != 0) { seq++; np = np->prev; } return seq; } static int CountFromTop(DATA * np) { return CountData(np) - CountData(top_data); } static int CountAllData(void) { return CountData(EndOfData()); } static DATA * FindData(int seq) { register DATA *np = all_data; while (seq-- > 0) { if (np == 0) break; np = np->next; } return np; } /* * Remove any fractional portion of the given value 'val', return the result. */ static Value Floor(Value val) { if (val > big_long) { val = big_long; } else if (val < -big_long) { val = -big_long; } else { long tmp = val; val = tmp; } return (val); } static Value Ceiling(Value val) { Value tmp = Floor(val); if (val > 0.0 && val > tmp) { tmp += 1.0; } else if (val < 0.0 && val < tmp) { tmp -= 1.0; } return (tmp); } /* * Return the last operand for the given operator, excluding the given data. */ static Value LastVAL(DATA * np, int cmd) { np = np->prev; while (np != 0) { if (cmd == np->cmd) return (np->val); np = np->prev; } if (cmd == OP_MUL || cmd == OP_DIV) return (1.0 * val_frac); else if (cmd == OP_INT || cmd == OP_TAX) return (4.0 * val_frac); return (0.0); } /* * Convert the given value 'val' to printing format (comma between groups of * three digits, decimal point before fractional part). */ static char * Format(char *dst, Value val) { int len, j, neg = val < 0.0; size_t grp; char bfr[MAXBFR], *s = dst; if (neg) { val = -val; *s++ = OP_SUB; } if (val >= big_long) { (void) strcpy(s, " ** overflow"); } else { (void) sprintf(bfr, "%0*.0f", len_frac, val); len = strlen(bfr) - len_frac; grp = len % 3; j = 0; while (j < len) { if (grp) { (void) strncpy(s, &bfr[j], grp); j += grp; s += grp; if (j < len) *s++ = COMMA; } grp = 3; } (void) sprintf(s, ".%s", &bfr[len]); } return (dst); } /* * Convert a value to printing form, writing it on the screen: */ static void putval(Value val) { char bfr[MAXBFR]; screen_printf("%*.*s", val_width, val_width, Format(bfr, val)); } /* */ static void setval(DATA * np, int cmd, Value val, int psh) { np->cmd = isCommand(cmd) ? cmd : OP_ADD; np->val = val; np->psh = psh; } /* * Compute the parenthesis level of the given data entry. This is a positive * number. */ static int LevelOf(DATA * target) { register DATA *np; register int level = 0; for (np = all_data; np != target; np = np->next) { if (np->cmd == R_PAREN) level--; if (np->psh) level++; } return level; } /* * Return a pointer to the last data entry in the screen. */ static DATA * ScreenBottom(void) { register DATA *np = top_data; register int count = screen_full; while (--count > 0) { if (!LastData(np)) np = np->next; else break; } return np; } /* * For an entry that isn't the currently-edited one, show the operator, * operand and result(s). Return the index of this entry in the screen * to use in testing for completion of repainting activity. */ static int ShowValue(DATA * np, int *editing, Bool comment) { int row = CountFromTop(np); int col = 0; int level; if (!isVisible()) { if (editing != 0) { editing[0] = editing[1] = 0; } } else if (row >= 0 && row < screen_full) { char cmd = isprint(UCH(np->cmd)) ? np->cmd : '?'; screen_set_position(row + 1, col); screen_clear_endline(); if (np->cmd != EOS) { for (level = LevelOf(np); level > 0; level--) screen_puts(". "); if (editing != 0) { screen_set_reverse(TRUE); screen_printf(" %c>>", cmd); screen_set_reverse(FALSE); } else { screen_printf(" %c: ", cmd); } if (editing != 0) { *editing = screen_col(); screen_set_reverse(TRUE); } if ((cmd == R_PAREN) || ((editing != 0) && !comment)) screen_printf("%*.*s", val_width, val_width, " "); else if (np->psh) screen_putc(L_PAREN); else putval(np->val); if (editing != 0) screen_set_reverse(FALSE); if (!np->psh) { screen_puts(" "); if (editing != 0) screen_set_bold(TRUE); putval(np->sum); if (editing != 0) screen_set_bold(FALSE); } if (cmd == OP_INT || cmd == OP_TAX) { screen_puts(" "); putval(np->aux); } col = screen_col(); if (editing != 0) editing[1] = col; col += 3; if ((np->txt != 0) && screen_cols_left(col) > 3) screen_puts(" # "); } if ((np->txt != 0) && screen_cols_left(col) > 0) { screen_printf("%.*s", screen_cols_left(col), np->txt); } if (LastData(np) && screen_rows_left(row) > 1) { screen_set_position(row + 2, 0); screen_clear_bottom(); } } return row; } static void ShowRange(DATA * first, DATA * last) { register DATA *np = first; while (np != last) { if (ShowValue(np, (int *) 0, FALSE) >= screen_full) break; np = np->next; } } static void ShowFrom(DATA * first) { ShowRange(first, (DATA *) 0); } /* * (Re)display the status line at the top of the screen. */ static void ShowStatus(DATA * np, int opened) { int seq = CountData(np); int top = CountData(top_data); DATA *last = EndOfData(); unsigned j; int c; char buffer[BUFSIZ]; if (!show_error && isVisible()) { screen_set_bold(TRUE); screen_set_position(0, 0); screen_clear_endline(); (void) sprintf(buffer, "%d of %d", seq, CountData(last)); screen_set_position(0, screen_cols_left((int) strlen(buffer))); screen_puts(buffer); screen_set_position(0, 0); if (opened < 0) { screen_puts("Edit comment (press return to exit)"); } else if (opened > 0) { screen_puts("Open-line expecting operator "); for (j = 0; j < SIZEOF(Commands); j++) { c = Commands[j].command; if (!isUnary(c) && FirstData(np)) continue; if ((c = Commands[j].command) == L_PAREN) continue; if ((c == R_PAREN) && (opened < 2)) continue; screen_putc(c); } screen_puts(" or oO to cancel"); } else if (np->cmd != EOS) { /* editing a value */ for (j = 0; j < SIZEOF(Commands); j++) { if (Commands[j].command == np->cmd) { screen_printf(" %s", Commands[j].explain); break; } } screen_set_position(0, 5 + val_width); putval(last->sum); screen_puts(" -- total"); } screen_set_bold(FALSE); } if (isVisible()) screen_set_position(seq - top + 1, 0); } /* * Show text in the status line */ static void ShowInfo(char *msg) { if (screen_active) { /* we've started curses */ screen_message("%s", msg); } else { (void) printf("%s\n", msg); } } /* * Show an error-message in the status line */ static void ShowError(char *msg, char *arg) { static const char format[] = "?? %s \"%s\""; if (screen_active) { /* we've started curses */ screen_message(format, msg, arg); show_error = TRUE; } else { (void) fprintf(stderr, format, msg, arg); (void) fprintf(stderr, "\n"); perror("add"); exit(errno); } } /* * Returns true if a file exists, -true if it isn't a file, false if neither. */ static int Fexists(char *path) { struct stat sb; if (*path == EOS) ShowError("No filename specified", path); if (stat(path, &sb) < 0) return FALSE; if ((sb.st_mode & S_IFMT) != S_IFREG) { ShowError("Not a file", path); return -TRUE; } return TRUE; } /* * Check file-access for writing a script */ static int Ok2Write(char *path) { if (Fexists(path) != -TRUE && access(path, 02) != 0 && errno != ENOENT) { ShowError("No write access", path); } else { return TRUE; } return FALSE; } /* * Write the current list of data as an ADD-script */ static void PutScript(char *path) { DATA *np; FILE *fp = (path && *path) ? fopen(path, "w") : 0; char buffer[MAXBFR]; int count = 0; if (fp == 0) { ShowError("Cannot open output", path); return; } (void) sprintf(buffer, "Writing results to \"%s\"", path); ShowInfo(buffer); for (np = all_data->next; np != 0; np = np->next) { if (np->cmd == EOS && np->next == 0) break; (void) fprintf(fp, "%c", np->cmd); if (np->psh) (void) fprintf(fp, "%c", L_PAREN); else if (np->cmd != R_PAREN) (void) fprintf(fp, "%s", Format(buffer, np->val)); if (!np->psh) (void) fprintf(fp, "\t%s", Format(buffer, np->sum)); if (np->cmd == OP_INT || np->cmd == OP_TAX) (void) fprintf(fp, "\t%s", Format(buffer, np->aux)); if (np->txt != 0) (void) fprintf(fp, "\t#%s", np->txt); (void) fprintf(fp, "\n"); count++; } (void) fclose(fp); /* If we've written the specified output, reset the changed-flag */ if (!strcmp(path, top_output)) scriptCHG = FALSE; (void) sprintf(buffer, "Wrote %d line%s to \"%s\"", count, count != 1 ? "s" : "", path); ShowInfo(buffer); show_error++; /* force the message to stay until next char */ } /* * Check file-access for reading a script. */ static int Ok2Read(char *path) { if (Fexists(path) != TRUE || access(path, 04) != 0) ShowError("No read access", path); else return TRUE; return FALSE; } /* * Save the current script-state and nest a new one. */ static void PushScripts(char *script) { SSTACK *p = SALLOC(SSTACK); p->next = sstack; p->sfp = scriptFP; p->sscripts = scriptv; sstack = p; scriptFP = 0; scriptv = (char **) calloc(2, sizeof(char *)); scriptv[0] = AllocString(script); } /* * Restore a previous script-state, if any. */ static int PopScripts(void) { SSTACK *p; scriptFP = 0; scriptv = 0; if ((p = sstack) != 0) { scriptFP = p->sfp; scriptv = p->sscripts; sstack = p->next; } return (scriptFP != 0); } /* * On end-of-file, go to the next script (or resume the parent script) */ static void NextScript(void) { (void) fclose(scriptFP); scriptFP = 0; if (!*(++scriptv)) PopScripts(); } /* * Read from a script, checking for end-of-file, and performing control-char * conversion. */ static int ReadScript(void) { int c = fgetc(scriptFP); if (feof(scriptFP) || ferror(scriptFP)) { NextScript(); if (!scriptNUM++) scriptCHG = FALSE; c = EOF; } else if (c == '^') { c = ReadScript(); if (c == EOF) c = '^'; /* we'll get an EOF on the next call */ else if (c == '?') c = '\177'; /* delete */ else c &= 037; } return c; } /* * As long as there is another input-script to process, read it. Scripts are * formatted * * to permit line-oriented entries. */ static int GetScript(void) { static int first; static int ignored; static int comment; register int c; while (scriptv != 0 && *scriptv != 0) { int was_invisible = !isVisible(); if (scriptFP == 0) { scriptFP = fopen(*scriptv, "r"); if (scriptFP == 0) { ShowError("Cannot read", *scriptv); scriptv++; } else { ShowInfo("Reading script"); first = TRUE; } continue; } while (scriptFP != 0) { if ((c = ReadScript()) == EOF) continue; if (c == '#' || c == COLON) { comment = TRUE; ignored = FALSE; } else if (!comment && (c == '\t')) { ignored = TRUE; } if (isReturn(c)) first = TRUE; if (ignored && isReturn(c)) { ignored = FALSE; } else if (!ignored) { if (isReturn(c)) { comment = FALSE; } else if (first) { if (isdigit(UCH(c))) { ungetc(c, scriptFP); c = OP_ADD; } first = FALSE; } return (c); } } /* Finally, paint the screen if I wasn't doing so before */ if (was_invisible) { int editcols[3]; DATA *last = EndOfData(); ShowStatus(last, FALSE); ShowRange(top_data, last); ShowValue(last, editcols, FALSE); first = TRUE; return EQUALS; /* flush out the last line */ } } if (first) { if (scriptNUM == 1) scriptCHG = FALSE; first = FALSE; } return EOS; } /* * Read a character from an input-script, if it is available. Otherwise, read * directly from the terminal. */ static int GetC(void) { register int c; if ((c = GetScript()) == EOS) { show_error = FALSE; c = screen_getc(); } return (c); } /* * Given a string, offset into it and insert-position, delete the character at * that offset, both from the string and screen. Return the resulting offset. */ static int DeleteChar(char *buffer, int offset, int pos, int limit) { int y, x, col; register char *t; /* delete from the actual buffer */ for (t = buffer + offset; (t[0] = t[1]) != EOS; t++) ; if (isVisible()) { /* update the display */ y = screen_row(); x = screen_col(); /* get current insert-position */ col = x - pos + offset; /* assume pos < len, offset < len */ screen_set_position(y, col); screen_delete_char(); if (limit > 0 && (int) strlen(buffer) < limit) { screen_set_position(y, col - offset); screen_insert_char(' '); x++; } if (pos > offset) x--; screen_set_position(y, x); } if (pos > offset) pos--; return pos; } /* * Insert a character into the given string, returning the updated insert * position. If the "rmargin" parameter is nonzero, we keep the buffer * right-justified to that limit. */ static int InsertChar(char *buffer, int chr, int pos, int lmargin, int rmargin, int *offset) { int y, x; int len = strlen(buffer); register char *t; /* perform the actual insertion into the buffer */ for (t = buffer + len;; t--) { t[1] = t[0]; if (t == buffer + pos) break; } t[0] = chr; if (isVisible()) { /* update the display on the screen */ y = screen_row(); x = screen_col(); if (screen_cols_left(x) > 0) { if (rmargin > 0) { x--; screen_set_position(y, x - pos); screen_delete_char(); screen_set_position(y, x); } screen_insert_char(chr); screen_set_position(y, x + 1); } else if (offset != 0) { screen_set_position(y, lmargin); screen_delete_char(); screen_set_position(y, x - 1); screen_insert_char(chr); screen_set_position(y, x); *offset += 1; } else { screen_alarm(); } } return pos + 1; } /* * Delete from the buffer the character to the left of the given col-position. */ static int doDeleteChar(char *buffer, int col, int limit) { if (col > 0) { col = DeleteChar(buffer, col - 1, col, limit); } else { screen_alarm(); } return col; } /* * Returns the index of the decimal-point in the given buffer (or -1 if not * found). */ static int DecimalPoint(char *buffer) { register char *dot = strchr(buffer, PERIOD); if (dot != 0) return (int) (dot - buffer); return -1; } /* * Return the sequence-pointer of the left-parenthesis enclosing the given * operand-set at 'np'. */ static DATA * Balance(DATA * np, int level) { int target = level; while (np->prev != 0) { if (np->cmd == R_PAREN) level++; else if (np->psh) level--; if (level <= target) break; /* unbalanced */ np = np->prev; } return (level == 0) ? np : 0; } static void ShowScriptName(void) { while (screen_move_left(screen_col() + 1, 0) > 0) { ; } if (*top_output) { screen_printf("script: %s", top_output); } else { screen_puts("no script"); } screen_clear_endline(); (void) screen_getc(); } /* * Edit an arbitrary buffer, starting at the current screen position. */ static void EditBuffer(char *buffer, int length) { int end, chr; int col = strlen(buffer); int done = FALSE; int offset = 0; int lmargin = screen_col(); int shown = FALSE; end = screen_cols_left(lmargin); end = min(end, length); if (end < (int) strlen(buffer)) offset = strlen(buffer) - end; while (!done) { while (col - offset < 0) { offset--; shown = FALSE; } while (col - offset > end) { offset++; shown = FALSE; } if (isVisible() && !shown) { int x; screen_set_position(screen_row(), lmargin); screen_printf("%.*s", end, buffer + offset); if (screen_cols_left(x = screen_col()) > 0) { screen_set_position(screen_row(), x); screen_clear_endline(); } screen_set_position(screen_row(), lmargin + col - offset); shown = TRUE; } chr = GetC(); if (isReturn(chr)) { done = TRUE; } else if (isAscii(chr) && isprint(UCH(chr))) { if ((int) strlen(buffer) < length - 1) col = InsertChar(buffer, chr, col, lmargin, 0, &offset); else screen_alarm(); } else if (is_delete_left(chr)) { col = doDeleteChar(buffer, col, 0); } else if (is_left_char(chr)) { col = screen_move_left(col, 0); } else if (is_right_char(chr)) { col = screen_move_right(col, (int) strlen(buffer)); } else if (is_home_char(chr)) { while (col > 0) col = screen_move_left(col, 0); } else if (is_end_char(chr)) { while (col < (int) strlen(buffer)) col = screen_move_right(col, (int) strlen(buffer)); } else { screen_alarm(); } } } /* * Edit the comment-field */ static void EditComment(DATA * np) { char buffer[BUFSIZ]; int row; int editcols[3]; (void) strcpy(buffer, np->txt != 0 ? np->txt : ""); ShowStatus(np, -1); row = ShowValue(np, editcols, TRUE) + 1; if (isVisible()) { screen_set_position(row, editcols[1]); screen_puts(" # "); } EditBuffer(buffer, sizeof(buffer)); TrimString(buffer); if (*buffer != EOS || (np->txt != 0)) { if (np->txt != 0) { if (!strcmp(buffer, np->txt)) return; /* no change needed */ free(np->txt); } np->txt = (*buffer != EOS) ? AllocString(buffer) : 0; scriptCHG = TRUE; } } /* * Returns true if the given entry has editable data */ static int HasData(DATA * np) { return !LastData(np) || (np->val != 0.0); } /* * Read a new number, until the operator for the next number is encountered. * Inputs: * np = line entry at which to prompt/read data * edit = true iff we re-edit prior contents of this line * Outputs: * *len_ = -2 if right parenthesis found, * = -1 if left parenthesis found, * = 0 if no number found (usually to switch operators) * = +n if value found, i.e., its length. * *val_ = the decoded number. * Returns: * The terminating character (e.g., an operator or command). */ static int EditValue(DATA * np, int *len_, Value * val_, int edit) { int c; int row; int col; /* current insert-position */ int editcols[3]; int done = FALSE; int was_visible = isVisible(); int lmargin = screen_col(); int nesting; /* if we find left parenthesis rather than number */ char buffer[MAXBFR]; /* current input value */ static char old_digit = EOS; /* nonzero iff we have pending digit */ if (np->cmd == R_PAREN) edit = FALSE; ShowStatus(np, FALSE); row = ShowValue(np, editcols, FALSE) + 1; if (isVisible()) { screen_set_position(row, editcols[0]); screen_set_reverse(TRUE); } if (edit) { if (np->psh) { buffer[0] = L_PAREN; buffer[1] = EOS; } else { register int len, dot; register char *s; (void) sprintf(buffer, "%0*.0f", len_frac, np->val); len = strlen(buffer); s = buffer + len; s[1] = EOS; for (c = 0; c < len_frac; c++, s--) s[0] = s[-1]; dot = len - len_frac; len++; buffer[dot] = PERIOD; } if (isVisible()) { screen_set_position(row, (int) (editcols[0] + val_width - strlen(buffer))); screen_puts(buffer); } } else { buffer[0] = EOS; } if (isVisible()) screen_set_position(row, editcols[0] + val_width); col = strlen(buffer); nesting = (*buffer == L_PAREN); c = EOS; while (!done) { if (old_digit) { c = old_digit; old_digit = EOS; } else { c = GetC(); } /* * If the current operator is a right parenthesis, we must have * an operator following, with no data intervening: */ if (np->cmd == R_PAREN) { if (isDigit(c) || (c == PERIOD) || (c == L_PAREN)) { screen_alarm(); } else { *len_ = -2; done = TRUE; } } /* * Move left/right within the buffer to adjust the insertion * position. In curses mode, CTL/F and CTL/B are conflicting. */ else if (is_left_char(c) && !is_up_page(c)) { col = screen_move_left(col, 0); } else if (is_right_char(c) && !is_down_page(c)) { col = screen_move_right(col, (int) strlen(buffer)); } else if (is_home_char(c)) { while (col > 0) col = screen_move_left(col, 0); } else if (is_end_char(c)) { while (col < (int) strlen(buffer)) col = screen_move_right(col, (int) strlen(buffer)); } /* * Backspace deletes the last character entered: */ else if (is_delete_left(c)) { col = doDeleteChar(buffer, col, val_width); if (*buffer == EOS) nesting = FALSE; } /* * A left parenthesis may be used only as the first (and only) * character of the operand. */ else if (c == L_PAREN) { if (*buffer != EOS) { screen_alarm(); } else { col = InsertChar(buffer, c, col, lmargin, val_width, (int *) 0); nesting = TRUE; } } /* * If we have received a left parenthesis, and do not delete * it, the next character begins a new operand-line: */ else if (nesting) { if (UnaryConflict(np, c)) screen_alarm(); else { if (isDigit(c) || c == PERIOD) { old_digit = c; c = OP_ADD; } *len_ = -1; done = TRUE; } } /* * Otherwise, we assume we have a normal value which we are * decoding: */ else if (isDigit(c)) { int limit = val_width; if (strchr(buffer, '.') == 0) limit -= (1 + len_frac); if ((int) strlen(buffer) > limit) screen_alarm(); else col = InsertChar(buffer, c, col, lmargin, val_width, (int *) 0); } /* * Decimal point can be entered once for each number. If we * get another, simply move it to the new position. */ else if (c == PERIOD) { register int dot; if ((dot = DecimalPoint(buffer)) >= 0) col = DeleteChar(buffer, dot, col, val_width); col = InsertChar(buffer, c, col, lmargin, val_width, (int *) 0); } /* * Otherwise, we assume a new operator-character for the * next command, flushing out the current command. Decode * the number (if any) which we have read: */ else if (c != COMMA) { if (*buffer != EOS) { register int len = strlen(buffer); register int dot; Value cents; if ((dot = DecimalPoint(buffer)) < 0) buffer[dot = len++] = PERIOD; while ((len - dot) <= len_frac) buffer[len++] = '0'; len = dot + 1 + len_frac; /* truncate */ buffer[len] = EOS; (void) sscanf(&buffer[dot + 1], "%lf", ¢s); if (dot) { buffer[dot] = EOS; (void) sscanf(buffer, "%lf", val_); buffer[dot] = PERIOD; *val_ *= val_frac; } else *val_ = 0.0; *val_ += cents; } else { *val_ = np->val; } *len_ = (*buffer == L_PAREN) ? 0 : strlen(buffer); done = TRUE; } } if (was_visible) screen_set_reverse(FALSE); return (c); } /* * Return true if (given the length returned by 'EditValue()', and the * state of the data-list) we don't display a value. */ static int NoValue(int len) { return ((len == 0 || len == -2) && (all_data->next->next != 0)); } /* * Compute one stage of the running total. To support parentheses, we use two * arguments: 'old' is the operand which contains the left parenthesis. */ static int Calculate(DATA * np, DATA * old) { Bool same; Value before = np->sum; np->sum = (old->prev) ? old->prev->sum : 0.0; switch (old->cmd) { default: case OP_ADD: np->sum += np->val; break; case OP_SUB: np->sum -= np->val; break; case OP_NEG: np->sum = -np->sum; break; case OP_MUL: np->sum *= (np->val / val_frac); np->sum = Floor(np->sum); break; case OP_DIV: if (np->val == 0.0) { if (np->sum > 0.0) np->sum = big_long; else if (np->sum < 0.0) np->sum = -big_long; } else { np->sum /= (np->val / val_frac); np->sum = Floor(np->sum); } break; case OP_INT: np->aux = Ceiling(np->sum * np->val / (interval * 100. * val_frac)); np->sum += np->aux; break; case OP_TAX: np->aux = Ceiling(np->sum * np->val / (100. * val_frac)); np->sum += np->aux; break; } same = (before == np->sum) && (before < big_long) && (before > -big_long); if (isVisible() && !same) scriptCHG = TRUE; return (same); } /* * Given a pointer 'np' into the operand list, and (possibly) new 'cmd' and * 'val' components, propagate the computation to the end of the vector, * showing the result on the screen. */ static void Recompute(DATA * base) { register DATA *np = base; register DATA *op; int level = LevelOf(np); Bool same; while (np != 0) { if (np->psh) { np->sum = 0.0; level++; } else { if (np->cmd == R_PAREN) { level--; np->val = np->prev->sum; op = Balance(np, level); if (op == 0) { op = all_data; level = 0; } } else { op = np; } same = Calculate(np, op); if ((level == 0) && same) break; } np = np->next; } ShowRange(base, np ? np->next : np); } /* * "Open" a new entry for editing. If 'after' is set, we open the entry * after the current 'base'. This is the normal mode of operation, and is * consistent with 'x'-command. */ static DATA * OpenLine(DATA * base, int after, int *repeated, int *edit) { DATA *save_top = top_data; DATA *op = after ? base : base->prev; DATA *np; int chr; int this_row; int done = FALSE; int nested; np = AllocData(op); nested = LevelOf(np); this_row = CountFromTop(np); /* Adjust 'top_data' if we have to scroll a little */ if (this_row <= 1) { while (this_row++ <= 1) { if (top_data->prev == all_data) break; top_data = top_data->prev; } } else { this_row -= (screen_full - 2); while (this_row-- > 0) top_data = top_data->next; } /* (Re)display the screen with the opened line */ if (top_data == save_top) ShowFrom(np->next); else ShowFrom(top_data); ShowStatus(np, TRUE + nested); screen_clear_endline(); *edit = FALSE; /* assume we'll get some new data */ while (!done) { chr = GetC(); if (UnaryConflict(np, chr)) { screen_alarm(); continue; } switch (chr) { case OP_INT: /* sC: open to interest */ case OP_TAX: /* sC: open to sales tax */ /* patch: provide defaults */ case OP_ADD: /* sC: open to add */ case OP_SUB: /* sC: open to subtract */ case OP_NEG: /* sC: open to negate */ case R_PAREN: /* sC: open closing brace */ setval(np, chr, 0.0, FALSE); done++; break; case L_PAREN: setval(np, OP_ADD, 0.0, TRUE); *edit = TRUE; /* force this to display */ done++; break; case OP_MUL: /* sC: open to multiply */ case OP_DIV: /* sC: open to divide */ setval(np, chr, val_frac, FALSE); done++; break; case 'a': case 's': case 'n': case 'm': case 'd': case 'i': case 't': chr = isRepeats(chr); setval(np, chr, LastVAL(np, chr), FALSE); done++; *repeated = TRUE; break; case 'q': case 'Q': case 'o': case 'O': case 'x': case 'X': case 'u': case 'U': (void) FreeData(np, FALSE); if (top_data != save_top) { top_data = save_top; ShowFrom(top_data); } np = base; done++; *edit = TRUE; /* go back to the original */ break; default: screen_alarm(); } } return (np); } /* * Perform half/full-screen scrolling: */ static DATA * ScrollBy(DATA * np, int amount) { int last_seq = CountAllData(); int this_seq = CountData(np); int next_seq = this_seq; int top = CountData(top_data); if (amount > 0) { if ((top + amount) < last_seq) { top += amount; next_seq = top; } else next_seq = last_seq; } else { if (this_seq > top) next_seq = top; else { next_seq = top + amount; next_seq = max(next_seq, 1); top = next_seq; } } ShowFrom(top_data = FindData(top)); return FindData(next_seq); } /* * Compute a one-line movement of the cursor. The 'amount' argument * compensates for other adjustments to the current data pointer in the calling * functions. */ static DATA * JumpBy(DATA * np, int amount) { int this_seq = CountData(np); int next_seq = this_seq + amount; int last_seq = CountAllData(); Bool end_flag = TRUE; Bool un_moved = FALSE; if (next_seq < 1) { next_seq = 1; } else if (next_seq > last_seq) { next_seq = last_seq; } else { end_flag = FALSE; } if (next_seq != this_seq) { np = FindData(next_seq); } else if (end_flag) { un_moved = TRUE; } /* Figure out if we have to adjust the top_data variable. * If so, we've got to redisplay the screen. */ if (!un_moved) { int top = CountData(top_data); Bool adjust = TRUE; if (next_seq < top) top_data = np; else if (next_seq >= top + screen_full) top_data = FindData(next_seq - screen_full + 1); else adjust = FALSE; if (adjust) ShowFrom(top_data); } return np; } /* * Jump to a specified entry, by number */ static DATA * JumpTo(DATA * np, int seq) { return JumpBy(np, seq - CountData(np)); } /* * Prompt/process a :-command */ static DATA * ColonCommand(DATA * np) { DATA *save_top = top_data; DATA *prior_np = np; char buffer[BUFSIZ]; char *reply; static char *last_write = ""; if (CountFromTop(np) >= screen_full - 1) { top_data = top_data->next; ShowFrom(top_data); } ShowStatus(np, FALSE); /* in case we have multiple prompts */ screen_set_position(screen_full, 0); screen_putc(COLON); screen_putc(' '); *buffer = EOS; EditBuffer(buffer, sizeof(buffer)); TrimString(buffer); reply = buffer; while (isspace(UCH(*reply))) reply++; if (*reply != EOS) { if (isdigit(UCH(*reply))) { char *dst; int seq = (int) strtol(reply, &dst, 0); np = JumpTo(np, seq); } else { char *param = reply + 1; while (isspace(UCH(*param))) param++; switch (*reply) { case '$': /* FALLTHRU */ case '%': np = JumpTo(np, CountAllData()); break; case 'e': np = all_data->next; while (np->next != 0) np = FreeData(np, TRUE); save_top = top_data; setval(np, OP_ADD, 0.0, FALSE); Recompute(np); if (Ok2Read(param)) PushScripts(param); break; case 'f': ShowScriptName(); break; case 'r': if (Ok2Read(param)) PushScripts(param); break; case 'w': if (*param == EOS) param = last_write; if (*param == EOS) param = top_output; if (Ok2Write(param)) { last_write = AllocString(param); PutScript(param); } break; case 'x': show_scripts = TRUE; break; default: screen_alarm(); } } } if (top_data != save_top && prior_np == np) { top_data = save_top; ShowFrom(top_data); } return np; } /* * Do simple screen movement. Note that some movement-commands may be * printing characters, so (if in edit-mode) we may have already intercepted * these as text. */ static int ScreenMovement(DATA ** pp, int chr) { DATA *np = *pp; int ok = TRUE; if (chr == COLON) { np = ColonCommand(np); } else if (chr == 'z') { chr = GetC(); if (isReturn(chr)) { top_data = np; } else { int top = CountData(top_data); int seq = CountData(np); if (chr == '-') { /* use current entry as end */ top = seq - screen_full + 1; } else { top = seq - screen_half + 1; } top = max(top, 1); top_data = FindData(top); } ShowFrom(top_data); #ifdef KEY_HOME } else if (chr == KEY_HOME) { /* C: move to first entry in list */ np = all_data->next; ShowFrom(top_data = np); #endif #ifdef KEY_END } else if (chr == KEY_END) { /* C: move to last entry in list */ int top, seq; np = EndOfData(); seq = CountData(np); top = seq - screen_full + 1; top = max(top, 1); top_data = FindData(top); ShowFrom(top_data); #endif } else if (chr == 'H') { /* C: move to first entry on screen */ np = top_data; } else if (chr == 'L') { /* C: move to last entry on screen */ np = ScreenBottom(); } else if (is_down_char(chr)) { /* C: move down 1 line */ np = JumpBy(np, 1); } else if (is_up_char(chr)) { /* C: move up 1 line */ np = JumpBy(np, -1); } else if (chr == CTL('D')) { /* C: scroll forward 1/2 screen */ np = ScrollBy(np, screen_half); } else if (chr == CTL('U')) { /* C: scroll backward 1/2 screen */ np = ScrollBy(np, -screen_half); } else if (is_down_page(chr)) { /* C: scroll forward one screen */ np = ScrollBy(np, screen_full); } else if (is_up_page(chr)) { /* C: scroll backward one screen */ np = ScrollBy(np, -screen_full); } else { ok = FALSE; } *pp = np; return ok; } /* * Display the help file. * We store the help-text as a special case of the data list to permit use * of the scrolling code. */ static void ShowHelp(void) { FILE *fp; DATA *save_data = all_data; DATA *save_top = top_data; DATA *np; int chr; int end; int done = FALSE; char buffer[BUFSIZ]; if ((all_data = all_help) == 0) { np = AllocData((DATA *) 0); /* header line not shown */ if ((fp = fopen(helpfile, "r")) != 0) { while (fgets(buffer, sizeof(buffer), fp) != 0) { np = AllocData(np); np->txt = AllocString(buffer); } (void) fclose(fp); } else { np = AllocData(np); np->txt = "Could not find help-file. Press 'q' to exit."; } } np = top_data = all_data->next; end = CountAllData(); ShowFrom(all_data); while (!done) { screen_set_position(0, 0); screen_set_bold(TRUE); screen_clear_endline(); (void) sprintf(buffer, "line %d of %d", CountData(np), end); screen_set_position(0, screen_cols_left((int) strlen(buffer))); screen_puts(buffer); screen_set_position(0, 0); screen_printf("ADD %s -- %s -- ", RELEASE, copyrite); screen_set_bold(FALSE); screen_set_position(CountFromTop(np) + 1, 0); chr = GetC(); if (chr == 'q' || chr == 'Q') { done = TRUE; } else if (!ScreenMovement(&np, chr)) { screen_alarm(); } } all_help = all_data; all_data = save_data; top_data = save_top; ShowFrom(top_data); } #ifndef VMS # ifdef unix # define isSlash(c) ((c) == '/') # else # define isSlash(c) ((c) == '/' || (c) == '\\') # endif static int AbsolutePath(char *path) { #if !defined(unix) && !defined(vms) /* assume MSDOS */ if (isalpha(UCH(*path)) && path[1] == ':') path += 2; #endif return isSlash(*path) || ((*path++ == '.') && (isSlash(*path) || (*path++ == '.' && isSlash(*path)))); } static char * PathLeaf(char *path) { register int n; for (n = strlen(path); n > 0; n--) if (isSlash(path[n - 1])) break; return path + n; } #endif /* * Find the help-file. On UNIX and MSDOS, we look for the file in the same * directory as that in which this program is stored, located by searching the * PATH environment variable. */ static void FindHelp(char *program) { #ifdef ADD_HELPFILE helpfile = ADD_HELPFILE; #else char temp[BUFSIZ]; register char *s = strcpy(temp, program); # if SYS_VMS for (s += strlen(temp); s != temp; s--) if (s[-1] == ']' || s[-1] == ':') break; # else /* assume UNIX or MSDOS */ if (AbsolutePath(temp)) { s = PathLeaf(temp); } else { char *path = getenv("PATH"); int j = 0, k, l; if (path == 0) path = ""; while (path[j] != EOS) { for (k = j; path[k] != EOS && path[k] != PATHSEP; k++) temp[k - j] = path[k]; if ((l = k - j) != 0) temp[l++] = '/'; s = strcpy(temp + l, program); if (access(temp, 5) == 0) { temp[l] = EOS; break; } j = (path[k] != EOS) ? k + 1 : k; } if (path[j] == EOS) { s = temp; *s++ = '.'; *s++ = '/'; s = PathLeaf(strcpy(s, program)); } } # endif /* VMS/UNIX/MSDOS */ (void) strcpy(s, "add.hlp"); helpfile = AllocString(temp); #endif /* ADD_HELPFILE */ } /* * Main program loop: given 'old' operator (applies to current entry), read the * value 'val', delimited by the next operator 'chr'. */ static int Loop(void) { DATA *np = EndOfData(); Value val; int test_c; int chr; int len; int opened; int repeated; /* if true, 'Loop' assumes editable value */ int edit = FALSE; for (;;) { chr = EditValue(np, &len, &val, edit); switch (chr) { case '\t': chr = EQUALS; break; case CTL('P'): chr = 'k'; break; case CTL('N'): case '\r': case '\n': chr = 'j'; break; case ' ': chr = DefaultOp(np); break; } if (chr == CTL('G')) { ShowScriptName(); } else if (chr == 'X') { /* C: delete current entry, move up */ if (NoValue(len)) { np = FreeData(np, TRUE); np = JumpBy(np, -1); edit = HasData(np); } else { edit = FALSE; } } else if (chr == 'x') { /* C: delete current entry, move down */ if (NoValue(len)) { np = FreeData(np, TRUE); edit = HasData(np); } else { edit = FALSE; } } else if (chr == 'u') { /* C: undo last 'x' command */ if (HasData(np)) edit = TRUE; else screen_alarm(); } else if ((test_c = isToggles(chr)) != EOS) { /* C: toggle current operator */ chr = test_c; if (UnaryConflict(np, chr)) { screen_alarm(); } else { if (len == 0) val = np->val; else edit = TRUE; setval(np, chr, val, np->psh); } } else { if (len != 0) { setval(np, np->cmd, val, (len == -1)); if (LastData(np) && isCommand(chr)) { (void) AllocData(np); np->next->cmd = chr; } else if (LastData(np) && isRepeats(chr)) { (void) AllocData(np); np->next->cmd = isRepeats(chr); } Recompute(np); } else { (void) ShowValue(np, (int *) 0, FALSE); } repeated = FALSE; opened = FALSE; if (chr == '?') { /* C: display help file */ ShowHelp(); } else if (chr == '#') { /* C: edit comment */ EditComment(np); } else if (chr == 'Q') { /* C: quit w/o changes */ return (FALSE); } else if (chr == 'q') { /* C: quit */ return (TRUE); } else if (ScreenMovement(&np, chr)) { ; } else if (chr == 'O' /* C: open before */ || chr == 'o') { /* C: open after */ opened = TRUE; np = OpenLine(np, (chr == 'o'), &repeated, &edit); if (repeated) chr = np->cmd; } else { if ((test_c = isRepeats(chr)) != EOS) { chr = test_c; repeated = TRUE; } if (isCommand(chr)) { np = JumpBy(np, 1); np->cmd = chr; } else if (chr == EQUALS) { Recompute(np); } else { screen_alarm(); } } if (repeated) { edit = TRUE; setval(np, chr, LastVAL(np, chr), FALSE); } else if (!opened) { edit = HasData(np); } } } } static void usage(void) { static const char *tbl[] = { "Usage: add [options] [scripts]" ,"" ,"Options:" ," -h print this message" ," -i interval specify compounding-interval (default=12)" ," -o script specify output-script name (default is the first" ," input-script name)" ," -p num specify precision (default=2)" ," -V print the version" ,"" ,"Description:" ," Script-based adding machine that allows you to edit the operations" ," and data." }; unsigned j; for (j = 0; j < SIZEOF(tbl); j++) fprintf(stderr, "%s\n", tbl[j]); exit(EXIT_FAILURE); } #if !HAVE_GETOPT int optind; int optchr; char *optarg; int getopt(int argc, char **argv, char *opts) { if (++optind < argc && (optarg = argv[optind]) != 0 && *optarg == '-') { if (*(++optarg) != ':' && (optchr = *optarg) != EOS && strchr(opts, *(optarg++)) != 0) return optchr; } return EOF; } #endif int main(int argc, char **argv) { long k; int j; int max_digits; /* maximum length of a number */ int changed; char tmp; Bool o_option = FALSE; (void) signal(SIGFPE, SIG_IGN); len_frac = 2; interval = 12; /* * Compute the maximum number of digits to display: * * big_long - the maximum positive value that we can stuff into * a 'long'. Assume symmetry, i.e., that we can use * the same negative magnitude. * val_width - the maximum length of a formatted number, counting * sign, decimal point and commas between groups * of digits. */ big_long = k = 1; while ((k = (k << 1) + 1) > big_long) big_long = k; for (k = big_long, max_digits = 0; k >= 10; k /= 10) max_digits++; FindHelp(argv[0]); while ((j = getopt(argc, argv, "hi:o:p:V")) != EOF) switch (j) { case 'p': if ((sscanf(optarg, "%d%c", &len_frac, &tmp) != 1) || (len_frac <= 0 || len_frac > max_digits - 2)) { fprintf(stderr, "Option p limited to 0..%d\n", max_digits - 2); usage(); } break; case 'i': if ((sscanf(optarg, "%d%c", &interval, &tmp) != 1) || (interval <= 0 || interval > 100)) { fprintf(stderr, "Option i limited to 0..100\n"); usage(); } break; case 'o': o_option = TRUE; top_output = optarg; break; case 'h': default: usage(); case 'V': puts(RELEASE); return EXIT_SUCCESS; } for (j = 0, val_frac = 1.0; j < len_frac; j++) val_frac *= 10.0; val_width = 1 + ((max_digits - len_frac) + 2) / 3 + max_digits + 1; /* * Allocate some dummy data so we can propagate results from it. */ all_data = 0; for (j = 0; j < 2; j++) { setval(AllocData((DATA *) 0), OP_ADD, 0.0, FALSE); } top_data = all_data->next; /* * If we have input scripts, save a pointer to the list: */ if (optind < argc) { if (top_output == 0 && !Fexists(argv[optind])) top_output = argv[optind++]; scriptv = argv + optind; for (j = 0; scriptv[j] != 0; j++) { (void) Ok2Read(scriptv[j]); } } else { scriptv = argv + argc; /* points to a null-pointer */ } /* * Get the default output-filename */ if (optind < argc && !top_output) top_output = argv[argc - 1]; if (top_output == 0) top_output = ""; /* * Setup and run the interactive portion of the program. */ screen_start(); changed = Loop(); screen_finish(); /* * If one or more scripts were given as input, and a '-o' argument * was given, overwrite the last one with the results. */ if (*top_output && changed && scriptCHG) PutScript(top_output); #if NO_LEAKS free(helpfile); while (FreeData(all_data, FALSE) != 0) /*EMPTY */ ; #if HAVE_DBMALLOC_H free(-1); /* FIXME: force linux+dbmalloc to report */ #endif #endif return (EXIT_SUCCESS); } add-20070214.orig/add.h0000644000175000017500000001241210564725437014266 0ustar azatothazatoth/****************************************************************************** * Copyright 1995-2002,2007 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * * that the above copyright notice appear in all copies and that both that * * copyright notice and this permission notice appear in supporting * * documentation, and that the name of the above listed copyright holder(s) * * not be used in advertising or publicity pertaining to distribution of the * * software without specific, written prior permission. * * * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD * * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE * * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ******************************************************************************/ /* $Id: add.h,v 1.11 2007/02/15 00:36:47 tom Exp $ * * common definitions for 'add' utility */ #ifndef ADD_H #define ADD_H #if defined(vaxc) || defined(vms) # define SYS_VMS 1 #elif defined(__TURBOC__) # define SYS_MSDOS 1 # define HAVE_GETOPT_H 1 /* GNU library */ #else # define SYS_UNIX 1 # include /* generated by 'configure' */ #endif #ifndef HAVE_BKGD #define HAVE_BKGD 0 #endif #ifndef HAVE_COLOR_PAIR #define HAVE_COLOR_PAIR 0 #endif #ifndef HAVE_DBMALLOC_H #define HAVE_DBMALLOC_H 0 #endif #ifndef HAVE_FLASH #define HAVE_FLASH 0 #endif #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif #ifndef HAVE_GETOPT_H #define HAVE_GETOPT_H 0 #endif #ifndef HAVE_KEYPAD #define HAVE_KEYPAD 0 #endif #ifndef HAVE_TYPEAHEAD #define HAVE_TYPEAHEAD 0 #endif #ifndef HAVE_UNISTD_H #define HAVE_UNISTD_H 0 #endif #ifndef HAVE_WSETSCRREG #define HAVE_WSETSCRREG 0 #endif #ifndef HAVE_XCURSES #define HAVE_XCURSES 0 #endif #ifndef NO_LEAKS #define NO_LEAKS 0 #endif #ifndef SYS_MSDOS #define SYS_MSDOS 0 #endif #ifndef SYS_UNIX #define SYS_UNIX 0 #endif #ifndef SYS_VMS #define SYS_VMS 0 #endif #include #if HAVE_UNISTD_H #include #endif #include #include #include #include #include #include #include #include #if HAVE_GETOPT # if HAVE_GETOPT_H # include # else extern char *optarg; extern int optind; # endif #endif #if HAVE_DBMALLOC_H #include #define NO_LEAKS 1 #endif #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #endif #if SYS_UNIX #define PATHSEP ':' #endif #if SYS_VMS #define PATHSEP ',' #define A_BOLD _BOLD #define KEY_UP SMG$K_TRM_UP #define KEY_DOWN SMG$K_TRM_DOWN #define KEY_LEFT SMG$K_TRM_LEFT #define KEY_RIGHT SMG$K_TRM_RIGHT #define KEY_NPAGE SMG$K_TRM_PF3 #define KEY_PPAGE SMG$K_TRM_PF4 #define wattrset(w,a) wsetattr(w,a) #define wattrclr(w,a) wclrattr(w,a) #define HAVE_BEEP 1 #endif #if SYS_MSDOS #define PATHSEP ';' #include #define HAVE_BEEP 1 #define HAVE_KEYPAD 1 #endif /* * Local declarations: */ #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif #ifndef max #define max(a,b) ((a)>(b)?(a):(b)) #endif #define MAXPATH 256 #define MAXBFR 132 #undef SIZEOF #define SIZEOF(v) (sizeof(v)/sizeof(v[0])) /* Tests for special character types */ #define CTL(c) ((c) & 0x1f) #define VI_UP 'k' #define VI_DOWN 'j' #define VI_LEFT 'h' #define VI_RIGHT 'l' #define VI_PPAGE CTL('B') #define VI_NPAGE CTL('F') #define UCH(c) ((unsigned char)c) #define isAscii(c) ((c) < 128) /* isascii isn't portable */ #define isReturn(c) ((c) == '\r' || (c) == '\n') #define isDigit(c) (isAscii(c) && isdigit(UCH(c))) #define LastData(np) ((np)->next == 0) /* Operators */ #define OP_ADD '+' #define OP_SUB '-' #define OP_NEG '~' #define OP_MUL '*' #define OP_DIV '/' #define OP_INT '%' #define OP_TAX '$' #define DefaultOp(np) np->cmd /* Miscellaneous characters */ #define L_PAREN '(' #define R_PAREN ')' #define EQUALS '=' #define PERIOD '.' #define COMMA ',' #define COLON ':' #define EOS '\0' /* * Local types */ typedef int Bool; typedef double Value; /* provides more precision than 'long' */ #define DATA struct _oprs DATA { DATA *next; DATA *prev; char *txt; /* comment, if any */ char cmd; /* operator */ Bool psh; /* true if we use left paren instead of 'val' */ int dot; /* number of digits past '.' */ Value val; /* operand value */ Value sum; /* running total */ Value aux; /* auxiliary value (derived from 'val') */ }; #endif /* ADD_H */ add-20070214.orig/add.hlp0000644000175000017500000001042310564726626014623 0ustar azatothazatothADD: full-screen editing calculator --- Usage: add [-p num] [-i interval] [-o script] scripts Options: -h print the usage message -p num Sets precision (number of digits after the decimal place). -i interval Sets compounding interval for interest computation. -o script Specify file in which to save output transcript. -V print the version An output transcript may be saved and reloaded for further editing. Scripts are loaded from left to right (with the "output" processed first). Computations: ADD performs fixed-point computation. It is designed for use as a checkbook balancing tool. ADD maintains a running result for each operation. You may scroll to any position in the expression list and modify the list. Enter data by typing numbers (with optional decimal point), separated by operators. The operators are all single-character: '+' begins an addition '-' begins a subtraction '~' negates the result '*' begins a multiplication '/' begins a division '%' begins an interest computation (uses 'interval'): rate=number. '$' begins a sales-tax computation: rate=number. '(' opening parenthesis. This may enclose a unary '-', more parentheses, or data (implicit unary '+'). ')' closing parenthesis, expects another operator, not data. '=' flushes out the current number, forces recomputation of the running result. A space flushes out the current number-input, and (by default) sets the next operator to be the same as the current one. You may repeat the last arithmetic operation of any type: 'a' repeats the last '+' (default 0). 's' repeats the last '-' (default 0). 'n' repeats the last '-'. 'm' repeats the last '*' (default 1). 'd' repeats the last '/' (default 1). 'i' repeats the last '%' (default 4). 't' repeats the last '$' (default 4). You may toggle the prefix operator of any number by typing a single character: 'A' toggles the operator to '+'. 'S' toggles the operator to '-'. 'N' toggles the operator to '~'. 'M' toggles the operator to '*'. 'D' toggles the operator to '/'. 'I' toggles the operator to '%'. 'T' toggles the operator to '$'. Editing: As you enter data, you may edit it. A backspace deletes the last digit of the current number (if it is visible). Use the arrow keys or vi-style 'h' and 'l' to move left and right within the line. Other editing commands include 'u' undoes the last x/X command (restricted to restoring the current data only). 'x' deletes the current data. If the data is null, deletes the following line. 'X' deletes the current data. If the data is null, deletes the preceding line and moves up. 'o' opens a new line after the current line. 'O' opens a new line before the current line. '#' edit the associated comment. An "open" permits you to insert a new operator and data into the expression list. You may type an operator character (e.g., '+'), and continue with the new data, or an operator-repeat (e.g., 'A'). In either case, you may edit the new data, just as you would the old data. A 'u' (or other toggle, such as 'o', 'O', or 'q') typed after an open will undo the open (and close it). Scrolling/cursor movement: H move to the top line on the screen. M move to the middle line on the screen. L move to the last line on the screen CTL/F scroll forward one screen. CTL/B scroll backward one screen. j move forward one line (also CTL/N). k move backward one line (also CTL/P). z move the current line to the top of the screen. z. move the current line to the middle of the screen. z- move the current line to the bottom of the screen. Like VI, ADD allows you to jump to a particular line with a ":" command :$ jumps to the last entry :1 jumps to the first entry. Scripts: Transcript files are formatted to permit line-oriented entries: The transcripts saved by ADD contain the running result in the "ignored" part. To exit without saving a transcript, type 'Q'. A normal exit, by typing 'q', saves the list of operators, data (and running result) in the specified file. You can read and write scripts without leaving ADD. :e file clears the current script and reads a script from the file. :f shows the current script-name (also CTL/G) :r file reads a script at the current entry :w file writes a script to the specified file. add-20070214.orig/config.guess0000755000175000017500000012670210543007420015673 0ustar azatothazatoth#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-12-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[3456]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[3456]* | authenticamd:Interix*:[3456]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: add-20070214.orig/config.sub0000755000175000017500000007755310536315020015347 0ustar azatothazatoth#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-12-08' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: add-20070214.orig/config_h.in0000644000175000017500000000037105576717302015471 0ustar azatothazatoth/* * $Id: config_h.in,v 1.1 1994/06/12 23:48:18 tom Exp $ * config_h.in is a template file used by configure to produce config.h. * config_h is then transformed (by config.status) into the header file * config.h -- Kevin Buettner. */ @DEFS@ add-20070214.orig/configure0000755000175000017500000052240610564724174015302 0ustar azatothazatoth#! /bin/sh # From configure.in Revision: 1.11 # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13.20030927 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF cat <<\EOF --enable and --with options recognized: --enable-warnings test: turn on gcc compiler warnings --with-curses-dir=DIR directory in which (n)curses is installed --with-ncurses compile/link with ncurses library --with-ncursesw compile/link with wide-char ncurses library --with-pdcurses compile/link with wide-char ncurses library --with-x use the X Window System --with-Xaw3d link with Xaw 3d library --with-neXtaw link with neXT Athena library --with-XawPlus link with Athena-Plus library --with-dmalloc test: use Gray Watson's dmalloc library --with-dbmalloc test: use Conor Cahill's dbmalloc library --with-purify test: use Purify --with-valgrind test: use valgrind EOF cat <<\EOF --with-no-leaks test: free permanent memory, analyze leaks EOF exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13.20030927" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=add.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi # If we find X, set shell vars x_includes and x_libraries to the # paths, otherwise set no_x=yes. # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 echo "configure:549: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" : fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=NO ac_x_libraries=NO rm -fr conftestdir if mkdir conftestdir; then cd conftestdir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat > Imakefile <<'EOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' EOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case "$ac_im_incroot" in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; esac case "$ac_im_usrlibdir" in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; esac fi cd .. rm -fr conftestdir fi if test "$ac_x_includes" = NO; then # Guess where to find include files, by looking for this one X11 .h file. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:617: \"$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* # We can compile using X headers with no special include directory. ac_x_includes= else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Look for the header file in a standard set of common directories. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest* fi # $ac_x_includes = NO if test "$ac_x_libraries" = NO; then # Check for the libraries. test -z "$x_direct_test_library" && x_direct_test_library=Xt test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. ac_x_libraries= else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest* fi # $ac_x_libraries = NO if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$ac_t""$have_x" 1>&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 echo "configure:810: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && cat >> confdefs.h <&6 else cf_cv_system_name="$system_name" fi test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && echo "$ac_t""Configuring for $cf_cv_system_name" 1>&6 if test ".$system_name" != ".$cf_cv_system_name" ; then echo "$ac_t""Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" 1>&6 { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; } fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:860: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:890: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:941: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:973: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 984 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:1015: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:1020: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:1048: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:1091: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:1144: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:1198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 echo "configure:1221: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) for cf_arg in "-DCC_HAS_PROTOS" \ "" \ -qlanglvl=ansi \ -std1 \ -Ae \ "-Aa -D_HPUX_SOURCE" \ -Xc do cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_arg do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" fi echo "$ac_t""$cf_cv_ansi_cc" 1>&6 if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_cv_ansi_cc do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi else cat >> confdefs.h <<\EOF #define CC_HAS_PROTOS 1 EOF fi fi if test "$cf_cv_ansi_cc" = "no"; then { echo "configure: error: Your compiler does not appear to recognize prototypes. You have the following choices: a. adjust your compiler options b. get an up-to-date compiler c. use a wrapper such as unproto" 1>&2; exit 1; } fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 echo "configure:1441: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_cygwin=no fi rm -f conftest* rm -f conftest* fi echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 echo "configure:1474: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_mingw32=no fi rm -f conftest* rm -f conftest* fi echo "$ac_t""$ac_cv_mingw32" 1>&6 MINGW32= test "$ac_cv_mingw32" = yes && MINGW32=yes case $cf_cv_system_name in os2*) CFLAGS="$CFLAGS -Zmt" CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" CXXFLAGS="$CXXFLAGS -Zmt" # autoconf's macro sets -Zexe and suffix both, which conflict:w LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" ac_cv_exeext=.exe ;; esac echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 echo "configure:1518: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$CYGWIN" = yes || test "$MINGW32" = yes; then ac_cv_exeext=.exe else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= if { (eval echo configure:1528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done else { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } fi rm -f conftest* test x"${ac_cv_exeext}" = x && ac_cv_exeext=no fi fi EXEEXT="" test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} echo "$ac_t""${ac_cv_exeext}" 1>&6 ac_exeext=$EXEEXT echo $ac_n "checking for object suffix""... $ac_c" 1>&6 echo "configure:1549: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext if { (eval echo configure:1555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; esac done else { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } fi rm -f conftest* fi echo "$ac_t""$ac_cv_objext" 1>&6 OBJEXT=$ac_cv_objext ac_objext=$ac_cv_objext PROG_EXT="$EXEEXT" test -n "$PROG_EXT" && cat >> confdefs.h <&6 echo "configure:1582: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1603: \"$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 : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1620: \"$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 : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1637: \"$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 : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:1662: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1675: \"$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* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:1742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi for ac_hdr in \ getopt.h \ stdlib.h \ string.h \ unistd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1774: checking for $ac_hdr" >&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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1784: \"$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* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done GCC_VERSION=none if test "$GCC" = yes ; then echo $ac_n "checking version of $CC""... $ac_c" 1>&6 echo "configure:1816: checking version of $CC" >&5 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown echo "$ac_t""$GCC_VERSION" 1>&6 fi if ( test "$GCC" = yes || test "$GXX" = yes ) then echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6 echo "configure:1826: checking if you want to turn on gcc warnings" >&5 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then enableval="$enable_warnings" test "$enableval" != yes && enableval=no if test "$enableval" != "no" ; then with_warnings=yes else with_warnings=no fi else enableval=no with_warnings=no fi echo "$ac_t""$with_warnings" 1>&6 if test "$with_warnings" = "yes" then INTEL_COMPILER=no if test "$GCC" = yes ; then case $host_os in linux*|gnu*) echo $ac_n "checking if this is really Intel C compiler""... $ac_c" 1>&6 echo "configure:1855: checking if this is really Intel C compiler" >&5 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -no-gcc" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* CFLAGS="$cf_save_CFLAGS" echo "$ac_t""$INTEL_COMPILER" 1>&6 ;; esac fi cat > conftest.$ac_ext <&6 echo "configure:1908: checking for $CC warning options" >&5 cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" for cf_opt in \ wd1419 \ wd1682 \ wd1683 \ wd1684 \ wd193 \ wd279 \ wd593 \ wd810 \ wd869 \ wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo configure:1924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" elif test "$GCC" = yes then echo "checking for $CC warning options" 1>&6 echo "configure:1934: checking for $CC warning options" >&5 cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" cf_warn_CONST="" test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" for cf_opt in \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ Winline \ Wmissing-declarations \ Wmissing-prototypes \ Wnested-externs \ Wpointer-arith \ Wshadow \ Wstrict-prototypes \ Wundef $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo configure:1953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6 case $cf_opt in #(vi Wcast-qual) #(vi CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" ;; Winline) #(vi case $GCC_VERSION in 3.3*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 continue;; esac ;; esac EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" fi rm -f conftest* fi fi # Check whether --with-curses-dir or --without-curses-dir was given. if test "${with_curses_dir+set}" = set; then withval="$with_curses_dir" if test "x$prefix" != xNONE; then cf_path_syntax="$prefix" else cf_path_syntax="$ac_default_prefix" fi case ".$withval" in #(vi .\$\(*\)*|.\'*\'*) #(vi ;; ..|./*|.\\*) #(vi ;; .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX ;; .\${*prefix}*) #(vi eval withval="$withval" case ".$withval" in #(vi .NONE/*) withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` ;; esac ;; #(vi .no|.NONE/*) withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` ;; *) { echo "configure: error: expected a pathname, not \"$withval\"" 1>&2; exit 1; } ;; esac cf_cv_curses_dir=$withval else cf_cv_curses_dir=no fi my_curses=no # Check whether --with-ncurses or --without-ncurses was given. if test "${with_ncurses+set}" = set; then withval="$with_ncurses" my_curses=ncurses fi # Check whether --with-ncursesw or --without-ncursesw was given. if test "${with_ncursesw+set}" = set; then withval="$with_ncursesw" my_curses=ncursesw fi # Check whether --with-pdcurses or --without-pdcurses was given. if test "${with_pdcurses+set}" = set; then withval="$with_pdcurses" my_curses=pdcurses fi if test $my_curses = pdcurses ; then if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >> confdefs.h <<\EOF #define X_DISPLAY_MISSING 1 EOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 echo "configure:2066: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_R_nospace=no fi rm -f conftest* if test $ac_R_nospace = yes; then echo "$ac_t""no" 1>&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_R_space=no fi rm -f conftest* if test $ac_R_space = yes; then echo "$ac_t""yes" 1>&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$ac_t""neither works" 1>&6 fi fi LIBS="$ac_xsave_LIBS" esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 echo "configure:2131: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" else echo "$ac_t""no" 1>&6 fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 echo "configure:2172: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" else echo "$ac_t""no" 1>&6 fi fi # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 echo "configure:2220: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else gethostbyname(); #endif ; return 0; } EOF if { (eval echo configure:2248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_gethostbyname=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 echo "configure:2269: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" else echo "$ac_t""no" 1>&6 fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says simon@lia.di.epfl.ch: it contains # gethostby* variants that don't use the nameserver (or something). # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 echo "configure:2318: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else connect(); #endif ; return 0; } EOF if { (eval echo configure:2346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_connect=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 echo "configure:2367: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" else echo "$ac_t""no" 1>&6 fi fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 echo "configure:2410: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else remove(); #endif ; return 0; } EOF if { (eval echo configure:2438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_remove=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 echo "configure:2459: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" else echo "$ac_t""no" 1>&6 fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 echo "configure:2502: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else shmat(); #endif ; return 0; } EOF if { (eval echo configure:2530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_shmat=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 echo "configure:2551: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" else echo "$ac_t""no" 1>&6 fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 echo "configure:2603: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" else echo "$ac_t""no" 1>&6 fi LDFLAGS="$ac_save_LDFLAGS" fi # SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -` cf_have_X_LIBS=no LDFLAGS="$X_LIBS $LDFLAGS" test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 cf_check_cflags="$CFLAGS" cf_check_cppflags="$CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $X_CFLAGS do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi if test "$cf_check_cflags" != "$CFLAGS" ; then cat > conftest.$ac_ext < int main() { printf("Hello world"); ; return 0; } EOF if { (eval echo configure:2744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 fi CFLAGS="$cf_check_flags" fi rm -f conftest* fi echo $ac_n "checking for XOpenDisplay""... $ac_c" 1>&6 echo "configure:2763: checking for XOpenDisplay" >&5 if eval "test \"`echo '$''{'ac_cv_func_XOpenDisplay'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay) choke me #else XOpenDisplay(); #endif ; return 0; } EOF if { (eval echo configure:2791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_XOpenDisplay=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_XOpenDisplay=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'XOpenDisplay`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 echo "configure:2810: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="-lX11 $LIBS" else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking for XtAppInitialize""... $ac_c" 1>&6 echo "configure:2853: checking for XtAppInitialize" >&5 if eval "test \"`echo '$''{'ac_cv_func_XtAppInitialize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XtAppInitialize(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize) choke me #else XtAppInitialize(); #endif ; return 0; } EOF if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_XtAppInitialize=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_XtAppInitialize=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'XtAppInitialize`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 echo $ac_n "checking for XtAppInitialize in -lXt""... $ac_c" 1>&6 echo "configure:2900: checking for XtAppInitialize in -lXt" >&5 ac_lib_var=`echo Xt'_'XtAppInitialize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_LIBXT 1 EOF cf_have_X_LIBS=Xt LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS" else echo "$ac_t""no" 1>&6 fi fi if test $cf_have_X_LIBS = no ; then echo "configure: warning: Unable to successfully link X Toolkit library (-lXt) with test program. You will have to check and add the proper libraries by hand to makefile." 1>&2 fi cf_x_athena=${cf_x_athena-Xaw} echo $ac_n "checking if you want to link with Xaw 3d library""... $ac_c" 1>&6 echo "configure:2957: checking if you want to link with Xaw 3d library" >&5 withval= # Check whether --with-Xaw3d or --without-Xaw3d was given. if test "${with_Xaw3d+set}" = set; then withval="$with_Xaw3d" : fi if test "$withval" = yes ; then cf_x_athena=Xaw3d echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking if you want to link with neXT Athena library""... $ac_c" 1>&6 echo "configure:2974: checking if you want to link with neXT Athena library" >&5 withval= # Check whether --with-neXtaw or --without-neXtaw was given. if test "${with_neXtaw+set}" = set; then withval="$with_neXtaw" : fi if test "$withval" = yes ; then cf_x_athena=neXtaw echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking if you want to link with Athena-Plus library""... $ac_c" 1>&6 echo "configure:2991: checking if you want to link with Athena-Plus library" >&5 withval= # Check whether --with-XawPlus or --without-XawPlus was given. if test "${with_XawPlus+set}" = set; then withval="$with_XawPlus" : fi if test "$withval" = yes ; then cf_x_athena=XawPlus echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6 echo "configure:3008: checking for XextCreateExtension in -lXext" >&5 ac_lib_var=`echo Xext'_'XextCreateExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lXext $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="-lXext $LIBS" else echo "$ac_t""no" 1>&6 fi cf_x_athena_lib="" cf_x_athena_root=$cf_x_athena cf_x_athena_include="" for cf_path in default \ /usr/contrib/X11R6 \ /usr/contrib/X11R5 \ /usr/lib/X11R5 \ /usr/local do if test -z "$cf_x_athena_include" ; then cf_save="$CPPFLAGS" cf_test=X11/$cf_x_athena_root/SimpleMenu.h if test $cf_path != default ; then CPPFLAGS="-I$cf_path/include $cf_save" echo $ac_n "checking for $cf_test in $cf_path""... $ac_c" 1>&6 echo "configure:3066: checking for $cf_test in $cf_path" >&5 else echo $ac_n "checking for $cf_test""... $ac_c" 1>&6 echo "configure:3069: checking for $cf_test" >&5 fi cat > conftest.$ac_ext < #include <$cf_test> int main() { ; return 0; } EOF if { (eval echo configure:3081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_result=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_result=no fi rm -f conftest* echo "$ac_t""$cf_result" 1>&6 if test "$cf_result" = yes ; then cf_x_athena_include=$cf_path break else CPPFLAGS="$cf_save" fi fi done if test -z "$cf_x_athena_include" ; then echo "configure: warning: Unable to successfully find Athena header files with test program" 1>&2 elif test "$cf_x_athena_include" != default ; then CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include" fi cf_x_athena_root=$cf_x_athena cf_x_athena_lib="" for cf_path in default \ /usr/contrib/X11R6 \ /usr/contrib/X11R5 \ /usr/lib/X11R5 \ /usr/local do for cf_lib in \ "-l$cf_x_athena_root -lXmu" \ "-l$cf_x_athena_root -lXpm -lXmu" \ "-l${cf_x_athena_root}_s -lXmu_s" do if test -z "$cf_x_athena_lib" ; then cf_save="$LIBS" cf_test=XawSimpleMenuAddGlobalActions if test $cf_path != default ; then LIBS="-L$cf_path/lib $cf_lib $LIBS" echo $ac_n "checking for $cf_lib in $cf_path""... $ac_c" 1>&6 echo "configure:3128: checking for $cf_lib in $cf_path" >&5 else LIBS="$cf_lib $LIBS" echo $ac_n "checking for $cf_test in $cf_lib""... $ac_c" 1>&6 echo "configure:3132: checking for $cf_test in $cf_lib" >&5 fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_result=no fi rm -f conftest* echo "$ac_t""$cf_result" 1>&6 if test "$cf_result" = yes ; then cf_x_athena_lib="$cf_lib" break fi LIBS="$cf_save" fi done done if test -z "$cf_x_athena_lib" ; then { echo "configure: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" 1>&2; exit 1; } fi cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >> confdefs.h <&6 echo "configure:3183: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XCURSES_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$XCURSES_CONFIG" in /*) ac_cv_path_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_XCURSES_CONFIG="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" ;; esac fi XCURSES_CONFIG="$ac_cv_path_XCURSES_CONFIG" if test -n "$XCURSES_CONFIG"; then echo "$ac_t""$XCURSES_CONFIG" 1>&6 else echo "$ac_t""no" 1>&6 fi test -n "$XCURSES_CONFIG" && break done test -n "$XCURSES_CONFIG" || XCURSES_CONFIG="none" if test "$XCURSES_CONFIG" != none ; then CPPFLAGS="`$XCURSES_CONFIG --cflags` $CPPFLAGS" LIBS="`$XCURSES_CONFIG --libs` $LIBS" cf_cv_lib_XCurses=yes else LDFLAGS="$LDFLAGS $X_LIBS" test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 cf_check_cflags="$CFLAGS" cf_check_cppflags="$CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $X_CFLAGS do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi if test "$cf_check_cflags" != "$CFLAGS" ; then cat > conftest.$ac_ext < int main() { printf("Hello world"); ; return 0; } EOF if { (eval echo configure:3319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 fi CFLAGS="$cf_check_flags" fi rm -f conftest* fi echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 echo "configure:3337: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="-lX11 $LIBS" else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for XCurses library""... $ac_c" 1>&6 echo "configure:3377: checking for XCurses library" >&5 if eval "test \"`echo '$''{'cf_cv_lib_XCurses'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else LIBS="-lXCurses $LIBS" cat > conftest.$ac_ext < char *XCursesProgramName = "test"; int main() { XCursesExit(); ; return 0; } EOF if { (eval echo configure:3394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_lib_XCurses=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_cv_lib_XCurses=no fi rm -f conftest* fi echo "$ac_t""$cf_cv_lib_XCurses" 1>&6 fi if test $cf_cv_lib_XCurses = yes ; then cat >> confdefs.h <<\EOF #define UNIX 1 EOF cat >> confdefs.h <<\EOF #define XCURSES 1 EOF cat >> confdefs.h <<\EOF #define HAVE_XCURSES 1 EOF else { echo "configure: error: Cannot link with XCurses" 1>&2; exit 1; } fi elif test $my_curses != no ; then if test $my_curses = ncursesw ; then echo $ac_n "checking for multibyte character support""... $ac_c" 1>&6 echo "configure:3432: checking for multibyte character support" >&5 if eval "test \"`echo '$''{'cf_cv_utf8_lib'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_save_LIBS="$LIBS" cat > conftest.$ac_ext < int main() { putwc(0,0); ; return 0; } EOF if { (eval echo configure:3447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_utf8_lib=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="-lutf8 $LIBS" cat > conftest.$ac_ext < int main() { putwc(0,0); ; return 0; } EOF if { (eval echo configure:3464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_utf8_lib=add-on else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_cv_utf8_lib=no fi rm -f conftest* LIBS="$cf_save_LIBS" fi rm -f conftest* fi echo "$ac_t""$cf_cv_utf8_lib" 1>&6 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between # ncurses/ncursesw: if test "$cf_cv_utf8_lib" = "add-on" ; then cat >> confdefs.h <<\EOF #define HAVE_LIBUTF8_H 1 EOF LIBS="-lutf8 $LIBS" fi fi cf_ncuhdr_root=$my_curses test -n "$cf_cv_curses_dir" && \ test "$cf_cv_curses_dir" != "no" && \ CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS" echo $ac_n "checking for $cf_ncuhdr_root header in include-path""... $ac_c" 1>&6 echo "configure:3502: checking for $cf_ncuhdr_root header in include-path" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" for cf_header in $cf_header_list do cat > conftest.$ac_ext < int main() { #ifdef NCURSES_VERSION printf("%s\n", NCURSES_VERSION); #else #ifdef __NCURSES_H printf("old\n"); #else make an error #endif #endif ; return 0; } EOF if { (eval echo configure:3534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_h=$cf_header else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_cv_ncurses_h=no fi rm -f conftest* test "$cf_cv_ncurses_h" != no && break done fi echo "$ac_t""$cf_cv_ncurses_h" 1>&6 if test "$cf_cv_ncurses_h" != no ; then cf_cv_ncurses_header=$cf_cv_ncurses_h else echo $ac_n "checking for $cf_ncuhdr_root include-path""... $ac_c" 1>&6 echo "configure:3560: checking for $cf_ncuhdr_root include-path" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_h2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else test -n "$verbose" && echo cf_search="" test -d "$HOME" && { test -n "$verbose" && echo " ... testing include-directories under $HOME" test -d "$HOME/include" && cf_search="$cf_search $HOME/include" test -d "$HOME/include/$cf_ncuhdr_root" && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" test -d "$HOME/include/$cf_ncuhdr_root/include" && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include" } # For other stuff under the home directory, it should be sufficient to put # a symbolic link for $HOME/$cf_ncuhdr_root to the actual package location: test -d "$HOME/$cf_ncuhdr_root" && { test -n "$verbose" && echo " ... testing include-directories under $HOME/$cf_ncuhdr_root" test -d "$HOME/$cf_ncuhdr_root/include" && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include" test -d "$HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" } test "$prefix" != /usr/local && \ test -d /usr/local && { test -n "$verbose" && echo " ... testing include-directories under /usr/local" test -d /usr/local/include && cf_search="$cf_search /usr/local/include" test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include" test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include" test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" } test "$prefix" != NONE && \ test -d $prefix && { test -n "$verbose" && echo " ... testing include-directories under $prefix" test -d $prefix/include && cf_search="$cf_search $prefix/include" test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" } test "$prefix" != /opt && \ test -d /opt && { test -n "$verbose" && echo " ... testing include-directories under /opt" test -d /opt/include && cf_search="$cf_search /opt/include" test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" test -d /opt/include/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include" test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include" test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" } test "$prefix" != /usr && \ test -d /usr && { test -n "$verbose" && echo " ... testing include-directories under /usr" test -d /usr/include && cf_search="$cf_search /usr/include" test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" test -d /usr/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include" test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include" } test "$includedir" != NONE && \ test "$includedir" != "/usr/include" && \ test -d "$includedir" && { test -d $includedir && cf_search="$cf_search $includedir" test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" } test "$oldincludedir" != NONE && \ test "$oldincludedir" != "/usr/include" && \ test -d "$oldincludedir" && { test -d $oldincludedir && cf_search="$cf_search $oldincludedir" test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" } test -n "$verbose" && echo search path $cf_search cf_save2_CPPFLAGS="$CPPFLAGS" for cf_incdir in $cf_search do for cf_add_incdir in $cf_incdir do while true do case $cf_add_incdir in /usr/include) # (vi ;; /usr/local/include) # (vi if test "$GCC" = yes then cf_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat > conftest.$ac_ext < int main() { printf("Hello") ; return 0; } EOF if { (eval echo configure:3662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f conftest* fi ;; *) # (vi CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" ;; esac cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` test "$cf_top_incdir" = "$cf_add_incdir" && break cf_add_incdir="$cf_top_incdir" done done for cf_header in \ ncurses.h \ curses.h do cat > conftest.$ac_ext < int main() { #ifdef NCURSES_VERSION printf("%s\n", NCURSES_VERSION); #else #ifdef __NCURSES_H printf("old\n"); #else make an error #endif #endif ; return 0; } EOF if { (eval echo configure:3710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_h2=$cf_header else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_cv_ncurses_h2=no fi rm -f conftest* if test "$cf_cv_ncurses_h2" != no ; then cf_cv_ncurses_h2=$cf_incdir/$cf_header test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 break fi test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 done CPPFLAGS="$cf_save2_CPPFLAGS" test "$cf_cv_ncurses_h2" != no && break done test "$cf_cv_ncurses_h2" = no && { echo "configure: error: not found" 1>&2; exit 1; } fi echo "$ac_t""$cf_cv_ncurses_h2" 1>&6 cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header fi for cf_add_incdir in $cf_1st_incdir do while true do case $cf_add_incdir in /usr/include) # (vi ;; /usr/local/include) # (vi if test "$GCC" = yes then cf_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat > conftest.$ac_ext < int main() { printf("Hello") ; return 0; } EOF if { (eval echo configure:3764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f conftest* fi ;; *) # (vi CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" ;; esac cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` test "$cf_top_incdir" = "$cf_add_incdir" && break cf_add_incdir="$cf_top_incdir" done done fi # Set definitions to allow ifdef'ing for ncurses.h case $cf_cv_ncurses_header in # (vi *ncurses.h) cat >> confdefs.h <<\EOF #define HAVE_NCURSES_H 1 EOF ;; esac case $cf_cv_ncurses_header in # (vi ncurses/curses.h|ncurses/ncurses.h) cat >> confdefs.h <<\EOF #define HAVE_NCURSES_NCURSES_H 1 EOF ;; ncursesw/curses.h|ncursesw/ncurses.h) cat >> confdefs.h <<\EOF #define HAVE_NCURSESW_NCURSES_H 1 EOF ;; esac echo $ac_n "checking for terminfo header""... $ac_c" 1>&6 echo "configure:3817: checking for terminfo header" >&5 if eval "test \"`echo '$''{'cf_cv_term_header'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case ${cf_cv_ncurses_header} in #(vi */ncurses.h|*/ncursesw.h) #(vi cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` ;; *) cf_term_header=term.h ;; esac for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" do cat > conftest.$ac_ext < #include <${cf_cv_ncurses_header-curses.h}> #include <$cf_test> int main() { int x = auto_left_margin ; return 0; } EOF if { (eval echo configure:3844: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_term_header="$cf_test" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_cv_term_header=unknown fi rm -f conftest* test "$cf_cv_term_header" != unknown && break done fi echo "$ac_t""$cf_cv_term_header" 1>&6 # Set definitions to allow ifdef'ing to accommodate subdirectories case $cf_cv_term_header in # (vi *term.h) cat >> confdefs.h <<\EOF #define HAVE_TERM_H 1 EOF ;; esac case $cf_cv_term_header in # (vi ncurses/term.h) #(vi cat >> confdefs.h <<\EOF #define HAVE_NCURSES_TERM_H 1 EOF ;; ncursesw/term.h) cat >> confdefs.h <<\EOF #define HAVE_NCURSESW_TERM_H 1 EOF ;; esac # some applications need this, but should check for NCURSES_VERSION cat >> confdefs.h <<\EOF #define NCURSES 1 EOF echo $ac_n "checking for ncurses version""... $ac_c" 1>&6 echo "configure:3899: checking for ncurses version" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_ncurses_version=no cf_tempfile=out$$ rm -f $cf_tempfile if test "$cross_compiling" = yes; then # This will not work if the preprocessor splits the line after the # Autoconf token. The 'unproto' program does that. cat > conftest.$ac_ext < #undef Autoconf #ifdef NCURSES_VERSION Autoconf NCURSES_VERSION #else #ifdef __NCURSES_H Autoconf "old" #endif ; #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" { (eval echo configure:3925: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" rm -f conftest.out fi else cat > conftest.$ac_ext < #include int main() { FILE *fp = fopen("$cf_tempfile", "w"); #ifdef NCURSES_VERSION # ifdef NCURSES_VERSION_PATCH fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); # else fprintf(fp, "%s\n", NCURSES_VERSION); # endif #else # ifdef __NCURSES_H fprintf(fp, "old\n"); # else make an error # endif #endif exit(0); } EOF if { (eval echo configure:3958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_ncurses_version=`cat $cf_tempfile` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -fr conftest* fi rm -f $cf_tempfile fi echo "$ac_t""$cf_cv_ncurses_version" 1>&6 test "$cf_cv_ncurses_version" = no || cat >> confdefs.h <<\EOF #define NCURSES 1 EOF cf_nculib_root=$my_curses # This works, except for the special case where we find gpm, but # ncurses is in a nonstandard location via $LIBS, and we really want # to link gpm. cf_ncurses_LIBS="" cf_ncurses_SAVE="$LIBS" echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 echo "configure:3989: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6 echo "configure:4024: checking for initscr in -lgpm" >&5 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$cf_ncurses_SAVE" else echo "$ac_t""no" 1>&6 cf_ncurses_LIBS="-lgpm" fi else echo "$ac_t""no" 1>&6 fi case $host_os in #(vi freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). if test "$cf_nculib_root" = ncurses ; then echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 echo "configure:4075: checking for tgoto in -lmytinfo" >&5 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lmytinfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" else echo "$ac_t""no" 1>&6 fi fi ;; esac LIBS="$cf_ncurses_LIBS $LIBS" if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) then LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS" else eval 'cf_cv_have_lib_'$cf_nculib_root'=no' cf_libdir="" echo $ac_n "checking for initscr""... $ac_c" 1>&6 echo "configure:4128: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char initscr(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_initscr) || defined (__stub___initscr) choke me #else initscr(); #endif ; return 0; } EOF if { (eval echo configure:4156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_initscr=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'initscr`\" = yes"; then echo "$ac_t""yes" 1>&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' else echo "$ac_t""no" 1>&6 cf_save_LIBS="$LIBS" echo $ac_n "checking for initscr in -l$cf_nculib_root""... $ac_c" 1>&6 echo "configure:4176: checking for initscr in -l$cf_nculib_root" >&5 LIBS="-l$cf_nculib_root $LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:4186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 cf_search="" test -d "$HOME" && { test -n "$verbose" && echo " ... testing lib-directories under $HOME" test -d "$HOME/lib" && cf_search="$cf_search $HOME/lib" test -d "$HOME/lib/$cf_nculib_root" && cf_search="$cf_search $HOME/lib/$cf_nculib_root" test -d "$HOME/lib/$cf_nculib_root/lib" && cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib" } # For other stuff under the home directory, it should be sufficient to put # a symbolic link for $HOME/$cf_nculib_root to the actual package location: test -d "$HOME/$cf_nculib_root" && { test -n "$verbose" && echo " ... testing lib-directories under $HOME/$cf_nculib_root" test -d "$HOME/$cf_nculib_root/lib" && cf_search="$cf_search $HOME/$cf_nculib_root/lib" test -d "$HOME/$cf_nculib_root/lib/$cf_nculib_root" && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root" } test "$prefix" != /usr/local && \ test -d /usr/local && { test -n "$verbose" && echo " ... testing lib-directories under /usr/local" test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib" test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib" test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" } test "$prefix" != NONE && \ test -d $prefix && { test -n "$verbose" && echo " ... testing lib-directories under $prefix" test -d $prefix/lib && cf_search="$cf_search $prefix/lib" test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" } test "$prefix" != /opt && \ test -d /opt && { test -n "$verbose" && echo " ... testing lib-directories under /opt" test -d /opt/lib && cf_search="$cf_search /opt/lib" test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" test -d /opt/lib/$cf_nculib_root/lib && cf_search="$cf_search /opt/lib/$cf_nculib_root/lib" test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib" test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" } test "$prefix" != /usr && \ test -d /usr && { test -n "$verbose" && echo " ... testing lib-directories under /usr" test -d /usr/lib && cf_search="$cf_search /usr/lib" test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" test -d /usr/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/lib/$cf_nculib_root/lib" test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib" } for cf_libdir in $cf_search do echo $ac_n "checking for -l$cf_nculib_root in $cf_libdir""... $ac_c" 1>&6 echo "configure:4255: checking for -l$cf_nculib_root in $cf_libdir" >&5 LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:4265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 LIBS="$cf_save_LIBS" fi rm -f conftest* done fi rm -f conftest* fi eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root if test $cf_found_library = no ; then { echo "configure: error: Cannot link $cf_nculib_root library" 1>&2; exit 1; } fi fi if test -n "$cf_ncurses_LIBS" ; then echo $ac_n "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS""... $ac_c" 1>&6 echo "configure:4296: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 cf_ncurses_SAVE="$LIBS" for p in $cf_ncurses_LIBS ; do q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` if test "$q" != "$LIBS" ; then LIBS="$q" fi done cat > conftest.$ac_ext < int main() { initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); ; return 0; } EOF if { (eval echo configure:4312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 LIBS="$cf_ncurses_SAVE" fi rm -f conftest* fi cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >> confdefs.h <&6 echo "configure:4337: checking for extra include directories" >&5 if eval "test \"`echo '$''{'cf_cv_curses_incdir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_curses_incdir=no case $host_os in #(vi hpux10.*) #(vi test -d /usr/include/curses_colr && \ cf_cv_curses_incdir="-I/usr/include/curses_colr" ;; sunos3*|sunos4*) test -d /usr/5lib && \ test -d /usr/5include && \ cf_cv_curses_incdir="-I/usr/5include" ;; esac fi echo "$ac_t""$cf_cv_curses_incdir" 1>&6 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS" echo $ac_n "checking if we have identified curses headers""... $ac_c" 1>&6 echo "configure:4362: checking if we have identified curses headers" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_ncurses_header=none for cf_header in \ curses.h \ ncurses.h \ ncurses/curses.h \ ncurses/ncurses.h do cat > conftest.$ac_ext < int main() { initscr(); tgoto("?", 0,0) ; return 0; } EOF if { (eval echo configure:4382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_header=$cf_header; break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done fi echo "$ac_t""$cf_cv_ncurses_header" 1>&6 if test "$cf_cv_ncurses_header" = none ; then { echo "configure: error: No curses header-files found" 1>&2; exit 1; } fi # cheat, to get the right #define's for HAVE_NCURSES_H, etc. for ac_hdr in $cf_cv_ncurses_header do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:4405: checking for $ac_hdr" >&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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:4415: \"$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* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done echo $ac_n "checking for terminfo header""... $ac_c" 1>&6 echo "configure:4444: checking for terminfo header" >&5 if eval "test \"`echo '$''{'cf_cv_term_header'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case ${cf_cv_ncurses_header} in #(vi */ncurses.h|*/ncursesw.h) #(vi cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` ;; *) cf_term_header=term.h ;; esac for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" do cat > conftest.$ac_ext < #include <${cf_cv_ncurses_header-curses.h}> #include <$cf_test> int main() { int x = auto_left_margin ; return 0; } EOF if { (eval echo configure:4471: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_term_header="$cf_test" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_cv_term_header=unknown fi rm -f conftest* test "$cf_cv_term_header" != unknown && break done fi echo "$ac_t""$cf_cv_term_header" 1>&6 # Set definitions to allow ifdef'ing to accommodate subdirectories case $cf_cv_term_header in # (vi *term.h) cat >> confdefs.h <<\EOF #define HAVE_TERM_H 1 EOF ;; esac case $cf_cv_term_header in # (vi ncurses/term.h) #(vi cat >> confdefs.h <<\EOF #define HAVE_NCURSES_TERM_H 1 EOF ;; ncursesw/term.h) cat >> confdefs.h <<\EOF #define HAVE_NCURSESW_TERM_H 1 EOF ;; esac echo $ac_n "checking for ncurses version""... $ac_c" 1>&6 echo "configure:4520: checking for ncurses version" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_ncurses_version=no cf_tempfile=out$$ rm -f $cf_tempfile if test "$cross_compiling" = yes; then # This will not work if the preprocessor splits the line after the # Autoconf token. The 'unproto' program does that. cat > conftest.$ac_ext < #undef Autoconf #ifdef NCURSES_VERSION Autoconf NCURSES_VERSION #else #ifdef __NCURSES_H Autoconf "old" #endif ; #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" { (eval echo configure:4546: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" rm -f conftest.out fi else cat > conftest.$ac_ext < #include int main() { FILE *fp = fopen("$cf_tempfile", "w"); #ifdef NCURSES_VERSION # ifdef NCURSES_VERSION_PATCH fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); # else fprintf(fp, "%s\n", NCURSES_VERSION); # endif #else # ifdef __NCURSES_H fprintf(fp, "old\n"); # else make an error # endif #endif exit(0); } EOF if { (eval echo configure:4579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_ncurses_version=`cat $cf_tempfile` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -fr conftest* fi rm -f $cf_tempfile fi echo "$ac_t""$cf_cv_ncurses_version" 1>&6 test "$cf_cv_ncurses_version" = no || cat >> confdefs.h <<\EOF #define NCURSES 1 EOF echo $ac_n "checking if we have identified curses libraries""... $ac_c" 1>&6 echo "configure:4603: checking if we have identified curses libraries" >&5 cat > conftest.$ac_ext < int main() { initscr(); tgoto("?", 0,0) ; return 0; } EOF if { (eval echo configure:4612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_result=no fi rm -f conftest* echo "$ac_t""$cf_result" 1>&6 if test "$cf_result" = no ; then case $host_os in #(vi freebsd*) #(vi echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 echo "configure:4628: checking for tgoto in -lmytinfo" >&5 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lmytinfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="-lmytinfo $LIBS" else echo "$ac_t""no" 1>&6 fi ;; hpux10.*) #(vi echo $ac_n "checking for initscr in -lcur_colr""... $ac_c" 1>&6 echo "configure:4670: checking for initscr in -lcur_colr" >&5 ac_lib_var=`echo cur_colr'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lcur_colr $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="-lcur_colr $LIBS" ac_cv_func_initscr=yes else echo "$ac_t""no" 1>&6 echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6 echo "configure:4712: checking for initscr in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 # HP's header uses __HP_CURSES, but user claims _HP_CURSES. LIBS="-lHcurses $LIBS" CPPFLAGS="-D__HP_CURSES -D_HP_CURSES $CPPFLAGS" ac_cv_func_initscr=yes else echo "$ac_t""no" 1>&6 fi fi ;; linux*) # Suse Linux does not follow /usr/lib convention LIBS="$LIBS -L/lib" ;; sunos3*|sunos4*) test -d /usr/5lib && \ LIBS="$LIBS -L/usr/5lib -lcurses -ltermcap" ac_cv_func_initscr=yes ;; esac if test ".$ac_cv_func_initscr" != .yes ; then cf_save_LIBS="$LIBS" cf_term_lib="" cf_curs_lib="" if test ".${cf_cv_ncurses_version-no}" != .no then cf_check_list="ncurses curses cursesX" else cf_check_list="cursesX curses ncurses" fi # Check for library containing tgoto. Do this before curses library # because it may be needed to link the test-case for initscr. echo $ac_n "checking for tgoto""... $ac_c" 1>&6 echo "configure:4784: checking for tgoto" >&5 if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgoto(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_tgoto) || defined (__stub___tgoto) choke me #else tgoto(); #endif ; return 0; } EOF if { (eval echo configure:4812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_tgoto=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_tgoto=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'tgoto`\" = yes"; then echo "$ac_t""yes" 1>&6 cf_term_lib=predefined else echo "$ac_t""no" 1>&6 for cf_term_lib in $cf_check_list termcap termlib unknown do echo $ac_n "checking for tgoto in -l$cf_term_lib""... $ac_c" 1>&6 echo "configure:4833: checking for tgoto in -l$cf_term_lib" >&5 ac_lib_var=`echo $cf_term_lib'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-l$cf_term_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 break else echo "$ac_t""no" 1>&6 fi done fi # Check for library containing initscr test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" for cf_curs_lib in $cf_check_list xcurses jcurses unknown do echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6 echo "configure:4882: checking for initscr in -l$cf_curs_lib" >&5 ac_lib_var=`echo $cf_curs_lib'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-l$cf_curs_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 break else echo "$ac_t""no" 1>&6 fi done test $cf_curs_lib = unknown && { echo "configure: error: no curses library found" 1>&2; exit 1; } LIBS="-l$cf_curs_lib $cf_save_LIBS" if test "$cf_term_lib" = unknown ; then echo $ac_n "checking if we can link with $cf_curs_lib library""... $ac_c" 1>&6 echo "configure:4927: checking if we can link with $cf_curs_lib library" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:4936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_result=no fi rm -f conftest* echo "$ac_t""$cf_result" 1>&6 test $cf_result = no && { echo "configure: error: Cannot link curses library" 1>&2; exit 1; } elif test "$cf_curs_lib" = "$cf_term_lib" ; then : elif test "$cf_term_lib" != predefined ; then echo $ac_n "checking if we need both $cf_curs_lib and $cf_term_lib libraries""... $ac_c" 1>&6 echo "configure:4952: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 cat > conftest.$ac_ext < int main() { initscr(); tgoto((char *)0, 0, 0); ; return 0; } EOF if { (eval echo configure:4961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=no else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:4978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_result=error fi rm -f conftest* fi rm -f conftest* echo "$ac_t""$cf_result" 1>&6 fi fi fi fi echo $ac_n "checking if you want to use dmalloc for testing""... $ac_c" 1>&6 echo "configure:5002: checking if you want to use dmalloc for testing" >&5 # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then withval="$with_dmalloc" cat >> confdefs.h <<\EOF #define USE_DMALLOC 1 EOF : ${with_cflags:=-g} : ${with_no_leaks:=yes} with_dmalloc=yes else with_dmalloc= fi echo "$ac_t""${with_dmalloc:-no}" 1>&6 case .$with_cflags in #(vi .*-g*) case .$CFLAGS in #(vi .*-g*) #(vi ;; *) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -g do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi ;; esac ;; esac if test "$with_dmalloc" = yes ; then ac_safe=`echo "dmalloc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dmalloc.h""... $ac_c" 1>&6 echo "configure:5109: checking for dmalloc.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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:5119: \"$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* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6 echo "configure:5136: checking for dmalloc_debug in -ldmalloc" >&5 ac_lib_var=`echo dmalloc'_'dmalloc_debug | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldmalloc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_lib=HAVE_LIB`echo dmalloc | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 fi else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking if you want to use dbmalloc for testing""... $ac_c" 1>&6 echo "configure:5191: checking if you want to use dbmalloc for testing" >&5 # Check whether --with-dbmalloc or --without-dbmalloc was given. if test "${with_dbmalloc+set}" = set; then withval="$with_dbmalloc" cat >> confdefs.h <<\EOF #define USE_DBMALLOC 1 EOF : ${with_cflags:=-g} : ${with_no_leaks:=yes} with_dbmalloc=yes else with_dbmalloc= fi echo "$ac_t""${with_dbmalloc:-no}" 1>&6 case .$with_cflags in #(vi .*-g*) case .$CFLAGS in #(vi .*-g*) #(vi ;; *) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -g do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi ;; esac ;; esac if test "$with_dbmalloc" = yes ; then ac_safe=`echo "dbmalloc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dbmalloc.h""... $ac_c" 1>&6 echo "configure:5298: checking for dbmalloc.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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:5308: \"$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* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6 echo "configure:5325: checking for debug_malloc in -ldbmalloc" >&5 ac_lib_var=`echo dbmalloc'_'debug_malloc | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldbmalloc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_lib=HAVE_LIB`echo dbmalloc | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 fi else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking if you want to use purify for testing""... $ac_c" 1>&6 echo "configure:5380: checking if you want to use purify for testing" >&5 # Check whether --with-purify or --without-purify was given. if test "${with_purify+set}" = set; then withval="$with_purify" cat >> confdefs.h <<\EOF #define USE_PURIFY 1 EOF : ${with_cflags:=-g} : ${with_no_leaks:=yes} with_purify=yes else with_purify= fi echo "$ac_t""${with_purify:-no}" 1>&6 case .$with_cflags in #(vi .*-g*) case .$CFLAGS in #(vi .*-g*) #(vi ;; *) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -g do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi ;; esac ;; esac echo $ac_n "checking if you want to use valgrind for testing""... $ac_c" 1>&6 echo "configure:5486: checking if you want to use valgrind for testing" >&5 # Check whether --with-valgrind or --without-valgrind was given. if test "${with_valgrind+set}" = set; then withval="$with_valgrind" cat >> confdefs.h <<\EOF #define USE_VALGRIND 1 EOF : ${with_cflags:=-g} : ${with_no_leaks:=yes} with_valgrind=yes else with_valgrind= fi echo "$ac_t""${with_valgrind:-no}" 1>&6 case .$with_cflags in #(vi .*-g*) case .$CFLAGS in #(vi .*-g*) #(vi ;; *) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -g do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi ;; esac ;; esac echo $ac_n "checking if you want to perform memory-leak testing""... $ac_c" 1>&6 echo "configure:5598: checking if you want to perform memory-leak testing" >&5 # Check whether --with-no-leaks or --without-no-leaks was given. if test "${with_no_leaks+set}" = set; then withval="$with_no_leaks" cat >> confdefs.h <<\EOF #define NO_LEAKS 1 EOF cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}" case ${cf_doalloc} in #(vi *yes*) ;; *) cat >> confdefs.h <<\EOF #define DOALLOC 10000 EOF ;; esac with_no_leaks=yes else with_no_leaks= fi echo "$ac_t""$with_no_leaks" 1>&6 echo $ac_n "checking for size_t""... $ac_c" 1>&6 echo "configure:5624: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else rm -rf conftest* ac_cv_type_size_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_size_t" 1>&6 if test $ac_cv_type_size_t = no; then cat >> confdefs.h <<\EOF #define size_t unsigned EOF fi echo $ac_n "checking declaration of chtype""... $ac_c" 1>&6 echo "configure:5658: checking declaration of chtype" >&5 if eval "test \"`echo '$''{'ac_have_type_chtype'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { chtype x = 1 ; return 0; } EOF if { (eval echo configure:5671: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_have_type_chtype=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_have_type_chtype=no fi rm -f conftest* fi echo "$ac_t""$ac_have_type_chtype" 1>&6 test $ac_have_type_chtype = no && cat >> confdefs.h <<\EOF #define chtype int EOF for ac_func in \ getcwd \ getopt \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:5695: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:5723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done echo $ac_n "checking if we must define _XOPEN_SOURCE_EXTENDED""... $ac_c" 1>&6 echo "configure:5750: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 if eval "test \"`echo '$''{'cf_cv_need_xopen_extension'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <${cf_cv_ncurses_header-curses.h}> int main() { long x = winnstr(stdscr, "", 0); int x1, y1; getbegyx(stdscr, y1, x1) ; return 0; } EOF if { (eval echo configure:5768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_need_xopen_extension=no else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < #include <${cf_cv_ncurses_header-curses.h}> int main() { long x = winnstr(stdscr, "", 0); int x1, y1; getbegyx(stdscr, y1, x1) ; return 0; } EOF if { (eval echo configure:5789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_need_xopen_extension=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_cv_need_xopen_extension=unknown fi rm -f conftest* fi rm -f conftest* fi echo "$ac_t""$cf_cv_need_xopen_extension" 1>&6 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" echo $ac_n "checking for term.h""... $ac_c" 1>&6 echo "configure:5808: checking for term.h" >&5 if eval "test \"`echo '$''{'cf_cv_term_header'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # If we found , look for , but always look # for if we do not find the variant. for cf_header in \ `echo ${cf_cv_ncurses_header-curses.h} | sed -e 's%/.*%/%'`term.h \ term.h do cat > conftest.$ac_ext < #include <${cf_header}> int main() { WINDOW *x ; return 0; } EOF if { (eval echo configure:5830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_term_header=$cf_header break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_cv_term_header=no fi rm -f conftest* done fi echo "$ac_t""$cf_cv_term_header" 1>&6 case $cf_cv_term_header in #(vi term.h) #(vi cat >> confdefs.h <<\EOF #define HAVE_TERM_H 1 EOF ;; ncurses/term.h) cat >> confdefs.h <<\EOF #define HAVE_NCURSES_TERM_H 1 EOF ;; ncursesw/term.h) cat >> confdefs.h <<\EOF #define HAVE_NCURSESW_TERM_H 1 EOF ;; esac for cf_func in \ COLOR_PAIR \ beep \ bkgd \ flash \ keypad \ typeahead \ wsetscrreg \ do cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` echo $ac_n "checking for ${cf_func}""... $ac_c" 1>&6 echo "configure:5885: checking for ${cf_func}" >&5 echo "(line 5887) testing ${cf_func} ..." 1>&5 if eval "test \"`echo '$''{'cf_cv_func_$cf_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else eval cf_result='$ac_cv_func_'$cf_func if test ".$cf_result" != ".no"; then cat > conftest.$ac_ext < char * XCursesProgramName = "test"; #else #include <${cf_cv_ncurses_header-curses.h}> #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) #include #else #if defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) #include #else #ifdef HAVE_TERM_H #include #endif #endif #endif #endif int main() { #ifndef ${cf_func} long foo = (long)(&${cf_func}); exit(foo == 0); #endif ; return 0; } EOF if { (eval echo configure:5925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cf_result=no fi rm -f conftest* fi eval 'cf_cv_func_'$cf_func'=$cf_result' fi # use the computed/retrieved cache-value: eval 'cf_result=$cf_cv_func_'$cf_func echo "$ac_t""$cf_result" 1>&6 if test $cf_result != no; then cat >> confdefs.h < confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13.20030927" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "makefile config.h:config_h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@EXTRA_CPPFLAGS@%$EXTRA_CPPFLAGS%g s%@EXEEXT@%$EXEEXT%g s%@OBJEXT@%$OBJEXT%g s%@PROG_EXT@%$PROG_EXT%g s%@CPP@%$CPP%g s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g s%@X_CFLAGS@%$X_CFLAGS%g s%@X_PRE_LIBS@%$X_PRE_LIBS%g s%@X_LIBS@%$X_LIBS%g s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g s%@XCURSES_CONFIG@%$XCURSES_CONFIG%g s%@LINK_PREFIX@%$LINK_PREFIX%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a list of #define's. We won't use it as a sed # script, but as data to insert where we see @DEFS@. We expect AC_SAVE_DEFS to # be either 'cat' or 'sort'. cat confdefs.h >conftest.vals # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail echo ' rm -f conftest.frag' >> $CONFIG_STATUS while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write chunks of a limited-size here document to conftest.frag. echo ' cat >> conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals # Run sed to substitute the contents of conftest.frag into conftest.in at the # marker @DEFS@. echo ' cat >> conftest.edit < conftest.out rm -f conftest.in mv conftest.out conftest.in rm -f conftest.edit conftest.frag ' >> $CONFIG_STATUS cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF # Extra commands, if any exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 add-20070214.orig/configure.in0000644000175000017500000000305210564722776015701 0ustar azatothazatothdnl Process this file with 'autoconf' to produce a 'configure' script dnl $Id: configure.in,v 1.11 2007/02/15 00:14:54 tom Exp $ AC_REVISION($Revision: 1.11 $) AC_PREREQ(2.13.20030927) AC_INIT(add.c) AC_CONFIG_HEADER(config.h:config_h.in) CF_CHECK_CACHE AC_PROG_CC AC_PROG_INSTALL AC_C_CONST CF_ANSI_CC_REQD CF_PROG_EXT AC_HEADER_STDC AC_CHECK_HEADERS(\ getopt.h \ stdlib.h \ string.h \ unistd.h \ ) CF_ENABLE_WARNINGS CF_WITH_CURSES_DIR my_curses=no AC_ARG_WITH(ncurses, [ --with-ncurses compile/link with ncurses library], [my_curses=ncurses]) AC_ARG_WITH(ncursesw, [ --with-ncursesw compile/link with wide-char ncurses library], [my_curses=ncursesw]) AC_ARG_WITH(pdcurses, [ --with-pdcurses compile/link with wide-char ncurses library], [my_curses=pdcurses]) if test $my_curses = pdcurses ; then CF_PDCURSES_X11 elif test $my_curses != no ; then if test $my_curses = ncursesw ; then CF_UTF8_LIB fi CF_NCURSES_CPPFLAGS($my_curses) CF_NCURSES_LIBS($my_curses) else CF_CURSES_CPPFLAGS CF_NCURSES_VERSION CF_CURSES_LIBS fi CF_WITH_NO_LEAKS AC_TYPE_SIZE_T AC_MSG_CHECKING(declaration of chtype) AC_CACHE_VAL(ac_have_type_chtype,[ AC_TRY_COMPILE([#include ], [chtype x = 1], [ac_have_type_chtype=yes], [ac_have_type_chtype=no])]) AC_MSG_RESULT($ac_have_type_chtype) test $ac_have_type_chtype = no && AC_DEFINE(chtype,int) AC_CHECK_FUNCS(\ getcwd \ getopt \ ) CF_CURSES_FUNCS(\ COLOR_PAIR \ beep \ bkgd \ flash \ keypad \ typeahead \ wsetscrreg \ ) ### output makefile and config.h AC_OUTPUT(makefile,,,cat) add-20070214.orig/curses.c0000644000175000017500000002017410564724110015024 0ustar azatothazatoth/****************************************************************************** * Copyright 1995-2002,2007 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * * that the above copyright notice appear in all copies and that both that * * copyright notice and this permission notice appear in supporting * * documentation, and that the name of the above listed copyright holder(s) * * not be used in advertising or publicity pertaining to distribution of the * * software without specific, written prior permission. * * * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD * * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE * * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ******************************************************************************/ static const char Id[] = "$Id: curses.c,v 1.13 2007/02/15 00:24:40 tom Exp $"; /* * Title: curses.c * Author: T.E.Dickey * Created: 14 Dec 1995 (split-off from add.c) * Modified: * * Function: This module hides the curses functional interface from 'add' * */ #include #include #include #if HAVE_XCURSES #include #else #include #endif #ifndef PADSLASH /* PDCURSES */ #define PADSLASH '/' #define PADSTAR '*' #define PADPLUS '+' #define PADMINUS '-' #define PADENTER '\n' #endif #if !HAVE_COLOR_PAIR && defined(COLOR_PAIR) #define HAVE_COLOR_PAIR 1 #endif #if HAVE_COLOR_PAIR #define CURRENT_COLOR current_color #define SetColors(n) wattron(stdscr, current_color = COLOR_PAIR(n)) #else #define CURRENT_COLOR 0 #define SetColors(n) #endif #ifdef A_BOLD #define BeginBold() wattron (stdscr, A_BOLD | CURRENT_COLOR) #define EndOfBold() wattroff(stdscr, A_BOLD) #else #define BeginBold() standout() #define EndOfBold() standend() #endif #ifdef A_REVERSE #define BeginHigh() wattron (stdscr, A_REVERSE | CURRENT_COLOR) #define EndOfHigh() wattroff(stdscr, A_REVERSE) #else #define BeginHigh() standout() #define EndOfHigh() standend() #endif /* * Common data */ Bool screen_active; /* true while we've got curses running */ int screen_full; /* screen-size */ int screen_half; /* scrolling amount */ #if HAVE_COLOR_PAIR static chtype current_color; #endif int is_delete_left(int c) { switch (c) { case '\b': case '\177': #if defined(KEY_BACKSPACE) case KEY_BACKSPACE: #endif #if defined(KEY_DC) case KEY_DC: #endif return TRUE; default: return FALSE; } } Bool is_down_char(int c) { switch (c) { case VI_DOWN: #ifdef KEY_DOWN case KEY_DOWN: #endif return TRUE; default: return FALSE; } } Bool is_down_page(int c) { switch (c) { case VI_NPAGE: #ifdef KEY_NPAGE case KEY_NPAGE: #endif return TRUE; default: return FALSE; } } Bool is_end_char(int c) { switch (c) { case CTL('E'): #ifdef KEY_END case KEY_END: #endif return TRUE; default: return FALSE; } } Bool is_left_char(int c) { switch (c) { case CTL('B'): /* only used in editing comments */ case VI_LEFT: #ifdef KEY_LEFT case KEY_LEFT: #endif return TRUE; default: return FALSE; } } Bool is_home_char(int c) { switch (c) { case CTL('A'): #ifdef KEY_HOME case KEY_HOME: #endif return TRUE; default: return FALSE; } } Bool is_right_char(int c) { switch (c) { case CTL('F'): /* only used in editing comments */ case VI_RIGHT: #ifdef KEY_RIGHT case KEY_RIGHT: #endif return TRUE; default: return FALSE; } } Bool is_up_char(int c) { switch (c) { case VI_UP: #ifdef KEY_UP case KEY_UP: #endif return TRUE; default: return FALSE; } } Bool is_up_page(int c) { switch (c) { case VI_PPAGE: #ifdef KEY_PPAGE case KEY_PPAGE: #endif return TRUE; default: return FALSE; } } /* * Beep (or flash, preferably) when we get a minor error. */ void screen_alarm(void) { #if HAVE_FLASH flash(); #elif HAVE_BEEP beep(); #else (void) write(2, "\007", 1); /* Real BSD-curses has 'beep()' */ #endif } void screen_clear_bottom(void) { clrtobot(); } void screen_clear_endline(void) { clrtoeol(); } /* * Returns current column */ int screen_col(void) { int y, x; getyx(stdscr, y, x); return x; } /* * Returns the columns left on the line, given a starting column */ int screen_cols_left(int col) { return COLS - 1 - col; } /* * Delete the character at the current position */ void screen_delete_char(void) { delch(); } void screen_finish(void) { nl(); /* does no harm, some curses don't do it */ endwin(); screen_active = FALSE; /* flag showing that curses is off */ } /* * Read a character from the terminal */ int screen_getc(void) { int c; refresh(); c = getch(); switch (c) { case PADSLASH: c = OP_DIV; break; case PADSTAR: c = OP_MUL; break; case PADPLUS: c = OP_ADD; break; case PADMINUS: c = OP_SUB; break; case PADENTER: c = '\n'; break; } return (c); } /* * Insert a character at the current position */ void screen_insert_char(int c) { insch(c); } /* * Show text in the status line */ void screen_message(const char *format,...) { char msg[BUFSIZ]; va_list ap; int y, x; getyx(stdscr, y, x); move(0, 0); va_start(ap, format); vsprintf(msg, format, ap); va_end(ap); addstr(msg); clrtoeol(); move(y, x); refresh(); } /* * Move left within the given buffer. */ int screen_move_left(int col, int limit) { if (col > limit) { register int y, x; getyx(stdscr, y, x); move(y, x - 1); col--; } else screen_alarm(); return col; } /* * Move right within the given buffer. */ int screen_move_right(int col, int limit) { if (col < limit) { register int y, x; getyx(stdscr, y, x); move(y, x + 1); col++; } else screen_alarm(); return col; } void screen_printf(const char *format,...) { char msg[BUFSIZ]; va_list ap; va_start(ap, format); vsprintf(msg, format, ap); va_end(ap); addstr(msg); } void screen_putc(int c) { addch(c); } void screen_puts(const char *string) { addstr(string); } /* * Returns current row */ int screen_row(void) { int y, x; getyx(stdscr, y, x); return y; } /* * Returns the rows left on the line, given a starting row */ int screen_rows_left(int row) { return LINES - 1 - row; } void screen_set_bold(Bool flag) { if (flag) BeginBold(); else EndOfBold(); } void screen_set_position(int row, int column) { move(row, column); } void screen_set_reverse(Bool flag) { if (flag) BeginHigh(); else EndOfHigh(); } /* * Setup and run the interactive portion of the program. */ void screen_start(void) { if (initscr() == 0) /* should return a "WINDOW *" */ exit(EXIT_FAILURE); #if HAVE_KEYPAD keypad(stdscr, TRUE); #endif #if defined(COLOR_BLUE) && defined(COLOR_WHITE) && HAVE_COLOR_PAIR if (has_colors()) { start_color(); init_pair(1, COLOR_WHITE, COLOR_BLUE); /* normal */ SetColors(1); #if HAVE_BKGD bkgd(CURRENT_COLOR); #endif } #endif #if HAVE_TYPEAHEAD typeahead(-1); /* disable typeahead */ #endif #if SYS_MSDOS && defined(F_GRAY) && defined(B_BLUE) wattrset(stdscr, F_GRAY | B_BLUE); /* patch for old PD-Curses */ #endif raw(); nonl(); noecho(); screen_full = LINES - 1; screen_half = (screen_full + 1) / 2; screen_active = TRUE; #if HAVE_WSETSCRREG setscrreg(2, screen_full); #endif } add-20070214.orig/install-sh0000755000175000017500000001572307762207755015405 0ustar azatothazatoth#! /bin/sh # # install - install a program, script, or datafile # # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "$0: no input file specified" >&2 exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d "$dst" ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else echo "$0: $src does not exist" >&2 exit 1 fi if [ x"$dst" = x ] then echo "$0: no destination specified" >&2 exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d "$dst" ] then dst=$dst/`basename "$src"` else : fi fi ## this sed command emulates the dirname command dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp='' while [ $# -ne 0 ] ; do pathcomp=$pathcomp$1 shift if [ ! -d "$pathcomp" ] ; then $mkdirprog "$pathcomp" else : fi pathcomp=$pathcomp/ done fi if [ x"$dir_arg" != x ] then $doit $instcmd "$dst" && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename "$dst"` else : fi # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/#inst.$$# rmtmp=$dstdir/#rm.$$# # Trap to clean up temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && # Now remove or move aside any old file at destination location. We try this # two ways since rm can't unlink itself on some systems and the destination # file might be busy for other reasons. In this case, the final cleanup # might fail but the new file should still install successfully. { if [ -f "$dstdir/$dstfile" ] then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } add-20070214.orig/makefile.in0000644000175000017500000000533610564723734015477 0ustar azatothazatoth# $Id: makefile.in,v 1.14 2007/02/15 00:22:52 tom Exp $ # Makefile-template for 'add' THIS = add RELEASE = t20070214 SCREEN = curses #### Start of system configuration section. #### srcdir = @srcdir@ VPATH = @srcdir@ CC = @CC@ LINK = $(CC) INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ LIBS = @LIBS@ CPPFLAGS = @CPPFLAGS@ -DHAVE_CONFIG_H -DRELEASE=\"$(RELEASE)\" -I. -I$(srcdir) CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@ LDFLAGS = @LDFLAGS@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = $(DESTDIR)@bindir@ mandir = $(DESTDIR)@mandir@/man1 manext = 1 x = @PROG_EXT@ #### End of system configuration section. #### SHELL = /bin/sh .c.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) $< OBJ = $(THIS).o $(SCREEN).o PROG = $(THIS)$x all: $(PROG) $(PROG): $(OBJ) $(LINK) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) $(OBJ): $(THIS).h screen.h install: all installdirs $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(PROG) $(INSTALL_PROGRAM) $(THIS).hlp $(bindir)/$(THIS).hlp $(INSTALL_DATA) $(srcdir)/$(THIS).1 $(mandir)/$(THIS).$(manext) installdirs: $(SHELL) ${srcdir}/mkdirs.sh $(bindir) $(mandir) uninstall: rm -f $(bindir)/$(PROG) rm -f $(bindir)/$(THIS).hlp rm -f $(mandir)/$(THIS).$(manext) mostlyclean: rm -f *.o core *~ *.BAK *.trace *.atac clean: mostlyclean rm -f $(PROG) distclean: clean rm -f makefile config.log config.cache config.status config.h realclean: distclean rm -f tags TAGS # don't remove configure! tags: ctags $(THIS).c $(HDRS) TAGS: etags $(THIS).c $(HDRS) # I keep my sources in RCS, and assign a symbolic release to the current patch # level. The 'manifest' script knows how to build a list of files for a given # revision. MANIFEST: manifest -r$(RELEASE) \ $(THIS).man testing/case*.dcl testing/case*.bat dist: MANIFEST - rm -f .fname .files echo $(THIS)-$(RELEASE) >.fname cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files rm -rf `cat .fname` TOP=`cat .fname`; mkdir $$TOP `cat .files | grep / | sed -e 's@/.*@@' | sed -e s@\^@$$TOP/@ | uniq` for file in `cat .files`; do \ ln $(srcdir)/$$file `cat .fname`/$$file \ || { echo copying $$file instead; cp $$file `cat .fname`/$$file; }; \ done tar cf - `cat .fname` | gzip >`cat .fname`.tgz rm -rf `cat .fname` .fname .files ls -l *.tgz # Some of the output will be uuencoded because the test scripts include # terminated ".bat" files for MS-DOS. dist-shar: MANIFEST - rm -f .fname .files echo $(THIS)-$(RELEASE) >.fname cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files shar -M -n`cat .fname` -opart -l50 `cat .files` - rm -f .fname .files ls -l part.* $(THIS).o: config.h check: $(PROG) cd testing; sh ./run_test.sh add-20070214.orig/mkdirs.sh0000755000175000017500000000150607507401011015175 0ustar azatothazatoth#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Last modified: 1994-03-25 # Public domain # errstatus=0 umask 022 for file in ${1+"$@"} ; do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 case "$pathcomp" in [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]: ) ;; # DOSISH systems * ) mkdir "$pathcomp" || errstatus=$? ;; esac fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here add-20070214.orig/porting/0000755000175000017500000000000010565172742015043 5ustar azatothazatothadd-20070214.orig/porting/descrip.mms0000644000175000017500000000215305463003042017176 0ustar azatothazatoth# VAX/VMS MMS (makefile) for ADD #####(LIBRARIES/INCLUDES)####################################################### #####(COMPILE/OPTIONS)########################################################## CFLAGS =- /G_FLOAT - /Listing - /Diagnostics /Debug ################################################################################ ALL = add.exe all : $(ALL) @ write sys$output "** made $@" clean : @- if f$search("*.lis") .nes. "" then delete *.lis;* @- if f$search("*.obj") .nes. "" then delete *.obj;* @- if f$search("*.out") .nes. "" then delete *.out;* @- if f$search("*.log") .nes. "" then delete *.log;* @- if f$search("*.map") .nes. "" then delete *.map;* clobber : clean @- if f$search("*.exe") .nes. "" then delete *.exe;* .first : @ define/nolog SYS SYS$LIBRARY .last : @- if f$search("*.dia") .nes. "" then delete *.dia;* @- if f$search("*.lis") .nes. "" then purge *.lis @- if f$search("*.map") .nes. "" then purge *.map @ ADD :== $SYS$DISK:'F$DIRECTORY()$(ALL) $(ALL) : add.obj LINK/map/debug ADD.OBJ, VMS_LINK.OPT/OPT .C.OBJ : $(CC) $(CFLAGS) $(MMS$SOURCE) @- delete $(MMS$TARGET_NAME).dia;* add-20070214.orig/porting/vms_link.opt0000644000175000017500000000003705463001330017372 0ustar azatothazatothsys$library:vaxcrtlg.exe/share add-20070214.orig/screen.h0000644000175000017500000000546610564724152015021 0ustar azatothazatoth/****************************************************************************** * Copyright 1995,2007 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * * that the above copyright notice appear in all copies and that both that * * copyright notice and this permission notice appear in supporting * * documentation, and that the name of the above listed copyright holder(s) * * not be used in advertising or publicity pertaining to distribution of the * * software without specific, written prior permission. * * * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD * * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE * * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ******************************************************************************/ /* $Id: screen.h,v 1.5 2007/02/15 00:25:14 tom Exp $ */ extern Bool screen_active; extern int screen_half; extern int screen_full; extern Bool is_delete_left(int c); extern Bool is_down_char(int c); extern Bool is_down_page(int c); extern Bool is_end_char(int c); extern Bool is_home_char(int c); extern Bool is_left_char(int c); extern Bool is_right_char(int c); extern Bool is_up_char(int c); extern Bool is_up_page(int c); extern void screen_alarm(void); extern void screen_clear_bottom(void); extern void screen_clear_endline(void); extern int screen_col(void); extern int screen_cols_left(int col); extern void screen_delete_char(void); extern void screen_finish(void); extern int screen_getc(void); extern void screen_insert_char(int c); extern void screen_message(const char *format, ...); extern int screen_move_left(int column, int limit); extern int screen_move_right(int column, int limit); extern void screen_printf(const char *format, ...); extern void screen_putc(int c); extern void screen_puts(const char *string); extern int screen_row(void); extern int screen_rows_left(int row); extern void screen_set_bold(Bool flag); extern void screen_set_position(int row, int column); extern void screen_set_reverse(Bool flag); extern void screen_start(void); add-20070214.orig/testing/0000755000175000017500000000000010565172742015036 5ustar azatothazatothadd-20070214.orig/testing/README0000644000175000017500000000033506070076077015717 0ustar azatothazatoth$Id: README,v 1.1 1995/12/26 22:50:39 tom Exp $ The test-scripts in this directory are designed to provide reasonably wide (but not exhaustive ;-) coverage of the logic in 'add'. I used 'atac' to tune the test scripts. add-20070214.orig/testing/case00.add0000644000175000017500000000000006063663475016557 0ustar azatothazatothadd-20070214.orig/testing/case00.opt0000644000175000017500000000000307603656163016631 0ustar azatothazatoth-h add-20070214.orig/testing/case00.ref0000644000175000017500000000056207603656327016617 0ustar azatothazatothUsage: add [options] [scripts] Options: -h print this message -i interval specify compounding-interval (default=12) -o script specify output-script name (default is the first input-script name) -p num specify precision (default=2) Description: Script-based adding machine that allows you to edit the operations and data. add-20070214.orig/testing/case01.add0000644000175000017500000000003006067625353016560 0ustar azatothazatoth:x 1 2 3 4 5 6 7 8 9 10 add-20070214.orig/testing/case01.ref0000644000175000017500000000016606063157453016613 0ustar azatothazatoth+1.00 1.00 +2.00 3.00 +3.00 6.00 +4.00 10.00 +5.00 15.00 +6.00 21.00 +7.00 28.00 +8.00 36.00 +9.00 45.00 +10.00 55.00 add-20070214.orig/testing/case02.add0000644000175000017500000000005106067625353016564 0ustar azatothazatoth:x 1 *2 *3 *4 *5 *6 *7 *8 *9 *10 *11 /12 add-20070214.orig/testing/case02.ref0000644000175000017500000000026306063157470016611 0ustar azatothazatoth+1.00 1.00 *2.00 2.00 *3.00 6.00 *4.00 24.00 *5.00 120.00 *6.00 720.00 *7.00 5,040.00 *8.00 40,320.00 *9.00 362,880.00 *10.00 3,628,800.00 *11.00 ** overflow /12.00 1,789,569.70 add-20070214.orig/testing/case03.add0000644000175000017500000000045406070020214016547 0ustar azatothazatoth:x +10000 # initial balance %10 # interest (annual, computed monthly) -100 # payment i # month 2 s i # month 3 s i # month 4 s i # month 5 s i # month 6 s i # month 7 s i # month 8 s i # month 9 s i # month 10 s i # month 11 s i # month 12 s z-z.z^JHz-z.z^JL :w unwritable :w case03.out :r :0 :1 :99 add-20070214.orig/testing/case03.ref0000644000175000017500000000124106063157475016614 0ustar azatothazatoth+10,000.00 10,000.00 # initial balance %10.00 10,083.34 83.34 # interest (annual, computed monthly) -100.00 9,983.34 # payment %10.00 10,066.54 83.20 # month 2 -100.00 9,966.54 %10.00 10,049.60 83.06 # month 3 -100.00 9,949.60 %10.00 10,032.52 82.92 # month 4 -100.00 9,932.52 %10.00 10,015.30 82.78 # month 5 -100.00 9,915.30 %10.00 9,997.93 82.63 # month 6 -100.00 9,897.93 %10.00 9,980.42 82.49 # month 7 -100.00 9,880.42 %10.00 9,962.76 82.34 # month 8 -100.00 9,862.76 %10.00 9,944.95 82.19 # month 9 -100.00 9,844.95 %10.00 9,927.00 82.05 # month 10 -100.00 9,827.00 %10.00 9,908.90 81.90 # month 11 -100.00 9,808.90 %10.00 9,890.65 81.75 # month 12 -100.00 9,790.65 add-20070214.orig/testing/case04.add0000644000175000017500000000005406067625353016571 0ustar azatothazatoth:x 1000000 /3 d d d d d d d d d d d d d d d add-20070214.orig/testing/case04.opt0000644000175000017500000000000406063153006016621 0ustar azatothazatoth-p3 add-20070214.orig/testing/case04.ref0000644000175000017500000000041506063157503016607 0ustar azatothazatoth+1,000,000.000 1,000,000.000 /3.000 333,333.333 /3.000 111,111.111 /3.000 37,037.037 /3.000 12,345.679 /3.000 4,115.226 /3.000 1,371.742 /3.000 457.247 /3.000 152.415 /3.000 50.805 /3.000 16.935 /3.000 5.645 /3.000 1.881 /3.000 .627 /3.000 .209 /3.000 .069 /3.000 .023 add-20070214.orig/testing/case05.add0000644000175000017500000000005406067625353016572 0ustar azatothazatoth:x 1 /( 1 + 1 /( 1 + 1 /( 1 + 1 / 2 ) ) ) a add-20070214.orig/testing/case05.ref0000644000175000017500000000020006067612473016606 0ustar azatothazatoth+1.00 1.00 /( +1.00 1.00 +1.00 2.00 /( +1.00 1.00 +1.00 2.00 /( +1.00 1.00 +1.00 2.00 +2.00 4.00 ) 4.00 ) 4.00 ) .25 +2.00 2.25 add-20070214.orig/testing/case06.add0000644000175000017500000000005406063671207016566 0ustar azatothazatoth:x -1 /.09 d d d d d d d d +1234567 a a a a add-20070214.orig/testing/case06.ref0000644000175000017500000000046306063670137016617 0ustar azatothazatoth-1.00 -1.00 /.09 -11.11 /.09 -123.44 /.09 -1,371.55 /.09 -15,239.44 /.09 -169,327.11 /.09 -1,881,412.33 /.09 -20,904,581.44 /.09 - ** overflow /.09 - ** overflow +1,234,567.00 -20,240,269.47 +1,234,567.00 -19,005,702.47 +1,234,567.00 -17,771,135.47 +1,234,567.00 -16,536,568.47 +1,234,567.00 -15,302,001.47 add-20070214.orig/testing/case07.add0000644000175000017500000000004506067625353016574 0ustar azatothazatoth:x 1,00 99 98 97 t $ 4.5 9.5 tkkkkjj add-20070214.orig/testing/case07.ref0000644000175000017500000000017706063672332016621 0ustar azatothazatoth+100.00 100.00 +99.00 199.00 +98.00 297.00 +97.00 394.00 $4.00 409.76 15.76 $4.50 428.20 18.44 +9.50 437.70 $4.50 457.40 19.70 add-20070214.orig/testing/case08.add0000644000175000017500000000000006063672773016570 0ustar azatothazatothadd-20070214.orig/testing/case08.opt0000644000175000017500000000000406063672753016644 0ustar azatothazatoth-i0 add-20070214.orig/testing/case08.ref0000644000175000017500000000061507603656040016616 0ustar azatothazatothOption i limited to 0..100 Usage: add [options] [scripts] Options: -h print this message -i interval specify compounding-interval (default=12) -o script specify output-script name (default is the first input-script name) -p num specify precision (default=2) Description: Script-based adding machine that allows you to edit the operations and data. add-20070214.orig/testing/case09.add0000644000175000017500000000040006070115257016560 0ustar azatothazatoth:x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 :3 z^J HLO^Jo^jHjMMMk /jjjXXo+32 OOHOOHO(xxHOaxx ooHo(xxHoaxx LOOLO(xxLOaxx LooLo(xxLoaxx o-31^I o/2 o*3 O+4 O-5 :1 : $ :5 *4^H^H^H *3 xuxxx= ?jj^Gjjjjjjjjjjjj^F^F^B^D^Uq :w case09.out q add-20070214.orig/testing/case09.ref0000644000175000017500000000064606070064435016621 0ustar azatothazatoth+1.00 1.00 +2.00 3.00 +3.00 6.00 *4.00 24.00 /5.00 4.80 *6.00 28.80 +7.00 35.80 *32.00 1,145.60 +10.00 1,155.60 +11.00 1,166.60 +12.00 1,178.60 +13.00 1,191.60 +14.00 1,205.60 +15.00 1,220.60 +16.00 1,236.60 +17.00 1,253.60 +18.00 1,271.60 +19.00 1,290.60 +20.00 1,310.60 +21.00 1,331.60 +22.00 1,353.60 +23.00 1,376.60 +24.00 1,400.60 +25.00 1,425.60 -31.00 1,394.60 /2.00 697.30 +4.00 701.30 -5.00 696.30 *3.00 2,088.90 add-20070214.orig/testing/case10.add0000644000175000017500000000012006067625353016560 0ustar azatothazatoth:x 1 *2 3 4 :x 5 6 7 8 9# comment ^J jhh^Hh.= +10 123456781hhhhl.hh^?1= add-20070214.orig/testing/case10.ref0000644000175000017500000000024706063700511016600 0ustar azatothazatoth+1.00 1.00 *2.00 2.00 *3.00 6.00 *4.00 24.00 *5.00 120.00 *6.00 720.00 *7.00 5,040.00 *8.00 40,320.00 *.90 36,288.00 # comment +10.00 36,298.00 +123,416.78 159,714.78 add-20070214.orig/testing/case11.add0000644000175000017500000000000006064140750016544 0ustar azatothazatothadd-20070214.orig/testing/case11.opt0000644000175000017500000000000606064140766016633 0ustar azatothazatoth-i200 add-20070214.orig/testing/case11.ref0000644000175000017500000000061507603656056016617 0ustar azatothazatothOption i limited to 0..100 Usage: add [options] [scripts] Options: -h print this message -i interval specify compounding-interval (default=12) -o script specify output-script name (default is the first input-script name) -p num specify precision (default=2) Description: Script-based adding machine that allows you to edit the operations and data. add-20070214.orig/testing/case12.add0000644000175000017500000000057606067651270016576 0ustar azatothazatoth:x 1000hh.=hhh.l.= a s m d i t#^J Aa Ss Mm# comment ^J#^J#^Alonger ^J Dd#one^J#^H^H^H^J Ii Tt HO+3#add fir^?^?^?top line 4(^I5^ILO?-4=^B^Bk^F^Fj S /0= +4#this is a long comment #this is a long comment #this is a long comment #this is a long comment^A^E^B^B^B(oo)^B^B^B^B^B(oo)^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^G^F^F^F(dd)^F^F^F^F^F^F(dd)^F^F^F^F^J +3 add-20070214.orig/testing/case12.ref0000644000175000017500000000046706070064506016613 0ustar azatothazatoth+3.00 3.00 #add top line -100.00 -97.00 +100.00 3.00 /1.00 3.00 /1.00 3.00 +4.00 7.00 #this is a long comment #this is a long comment #this is a long com(dd)ment #(dd)this is a long com(oo)m(oo)ent +4.00 11.00 +4.00 15.00 *4.00 60.00 /4.00 15.00 #longer comment %4.00 15.05 .05 $4.00 15.66 .61 $4.00 16.29 .63 add-20070214.orig/testing/case13.add0000644000175000017500000000000006070020363016540 0ustar azatothazatothadd-20070214.orig/testing/case13.opt0000644000175000017500000000000406070020374016620 0ustar azatothazatoth-p9 add-20070214.orig/testing/case13.ref0000644000175000017500000000061307603656070016613 0ustar azatothazatothOption p limited to 0..7 Usage: add [options] [scripts] Options: -h print this message -i interval specify compounding-interval (default=12) -o script specify output-script name (default is the first input-script name) -p num specify precision (default=2) Description: Script-based adding machine that allows you to edit the operations and data. add-20070214.orig/testing/case14.add0000644000175000017500000000005506070026560016560 0ustar azatothazatoth:x :r case01.add :e case01.add :r case04.add add-20070214.orig/testing/case14.opt0000644000175000017500000000000406070020423016614 0ustar azatothazatoth-i5 add-20070214.orig/testing/case14.ref0000644000175000017500000000054106070025500016575 0ustar azatothazatoth+1.00 1.00 +2.00 3.00 +3.00 6.00 +4.00 10.00 +5.00 15.00 +6.00 21.00 +7.00 28.00 +8.00 36.00 +9.00 45.00 +10.00 55.00 +1,000,000.00 1,000,055.00 /3.00 333,351.66 /3.00 111,117.22 /3.00 37,039.07 /3.00 12,346.35 /3.00 4,115.45 /3.00 1,371.81 /3.00 457.27 /3.00 152.42 /3.00 50.80 /3.00 16.93 /3.00 5.64 /3.00 1.88 /3.00 .62 /3.00 .20 /3.00 .06 /3.00 .02 add-20070214.orig/testing/run_test.sh0000755000175000017500000000250506070112517017230 0ustar azatothazatoth#!/bin/sh # $Id: run_test.sh,v 1.8 1995/12/27 00:37:35 tom Exp $ # regression script for 'add' if test $# = 0 then eval $0 *.add exit fi # PATH=`cd ..;pwd`:$PATH; export PATH # LINES=24;export LINES COLS=80;export COLS rm -f un*ble touch unwritable unreadable chmod 444 unwritable chmod 000 unreadable trap "rm -f un*ble" 0 1 2 5 15 # for i in $* do I=`basename $i .add` NUL=/dev/null OUT="$I.out" ERR="$I.err" REF="$I.ref" TMP="$I.tmp" OPT="" if test -f $I.opt then OPT=`cat $I.opt` fi rm -f $OUT $ERR $TMP # Build a script that's guaranteed to write an output. Some curses # implementations don't allow us to simply pipe to the application. cp $I.add $TMP chmod 644 $TMP echo ':w' >>$TMP echo 'Q' >>$TMP add $OPT -o $OUT $TMP >$NUL 2>$ERR rm -f $TMP if test -f $ERR then if ( fgrep 'Electric Fence' $ERR >/dev/null ) then cat $ERR \ | sed -e '1,/Electric Fence/d' \ | tr '\007' @ \ | sed -e 's/@//g' \ >>$OUT else cat $ERR \ | tr '\007' @ \ | sed -e 's/@//g' \ >>$OUT fi rm -f $ERR fi if test -f $OUT then if test -f $REF then if ( cmp -s $OUT $REF ) then echo '** ok: '$I rm -f $OUT else echo '?? fail: '$I diff $OUT $REF exit 1 fi else echo '...saving '$REF mv $OUT $REF fi else echo '? no output for '$I exit 1 fi done add-20070214.orig/testing/showCC0000755000175000017500000000021206071074622016140 0ustar azatothazatoth#!/bin/sh MORE=vile-pager; export MORE if test $# = 0 then atac -u add.trace ../*.atac else (atac $* add.trace ../*.atac) 2>&1 |vile fi add-20070214.orig/testing/testCC0000755000175000017500000000010306071104544016133 0ustar azatothazatoth#!/bin/sh rm *.trace run_test.sh *.add atac -u add.trace ../*.atac