From b4e8cb2c6cf06e08c55b5f7a78b91c4a65df7ea1 Mon Sep 17 00:00:00 2001 From: Werner LEMBERG Date: Wed, 15 Oct 2003 05:27:22 +0000 Subject: [PATCH] * aclocal.m4 (GROFF_SYS_NERR): Check stdlib.h also. (GROFF_LIBC): New function. * configure.ac: Call GROFF_LIBC. Check for `kill'. * configure: Regenerated. * src/include/lib.h: Handle __MINGW32__. * src/include/nonposix.h [_MSC_VER]: Handle __MINGW32__. Add macro for `pipe'. Define P_tmpdir. * src/roff/groff/pipeline.c (run_pipeline): Handle `no_pipe' correctly. * src/utils/indxbib/signal.c (handle_fatal_signal) [!HAVE_KILL]: Implement. --- ChangeLog | 19 ++++++++++++++ aclocal.m4 | 23 +++++++++++----- configure | 65 +++++++++++++++++++++++++++++++++++++++++----- configure.ac | 5 ++-- src/include/lib.h | 5 ++-- src/include/nonposix.h | 12 ++++++++- src/roff/groff/pipeline.c | 2 +- src/utils/indxbib/signal.c | 8 +++++- 8 files changed, 118 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1345ac5b..3f60095d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2003-10-14 Keith Marshall + + * aclocal.m4 (GROFF_SYS_NERR): Check stdlib.h also. + (GROFF_LIBC): New function. + * configure.ac: Call GROFF_LIBC. + Check for `kill'. + * configure: Regenerated. + + * src/include/lib.h: Handle __MINGW32__. + * src/include/nonposix.h [_MSC_VER]: Handle __MINGW32__. + Add macro for `pipe'. + Define P_tmpdir. + + * src/roff/groff/pipeline.c (run_pipeline): Handle `no_pipe' + correctly. + + * src/utils/indxbib/signal.c (handle_fatal_signal) [!HAVE_KILL]: + Implement. + 2003-10-13 Werner LEMBERG Finally fix change 2003-08-26, based on ideas from Chuck Silvers diff --git a/aclocal.m4 b/aclocal.m4 index af9543e2..f2fb403b 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,5 +1,5 @@ dnl Autoconf macros for groff. -dnl Copyright (C) 1989-1995, 2001, 2002 Free Software Foundation, Inc. +dnl Copyright (C) 1989-1995, 2001, 2002, 2003 Free Software Foundation, Inc. dnl dnl This file is part of groff. dnl @@ -201,12 +201,13 @@ dnl dnl AC_DEFUN(GROFF_SYS_NERR, [AC_LANG_PUSH(C++) -AC_MSG_CHECKING([for sys_nerr in or ]) +AC_MSG_CHECKING([for sys_nerr in , , or ]) AC_TRY_COMPILE([#include -#include ], +#include +#include ], [int k; k = sys_nerr;], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_NERR, 1, - [Define if you have sysnerr in or + [Define if you have sys_nerr in or .]), AC_MSG_RESULT(no)) AC_LANG_POP(C++)])dnl @@ -280,7 +281,7 @@ dnl dnl AC_DEFUN(GROFF_ARRAY_DELETE, [AC_LANG_PUSH(C++) -AC_MSG_CHECKING([whether ANSI array delete syntax supported]) +AC_MSG_CHECKING([whether ANSI array delete syntax is supported]) AC_TRY_COMPILE(, [char *p = new char[5]; delete [] p;], AC_MSG_RESULT(yes), AC_MSG_RESULT(no);AC_DEFINE(ARRAY_DELETE_NEEDS_SIZE, 1, @@ -512,13 +513,21 @@ AC_DEFUN(GROFF_INSTALL_INFO, dnl dnl dnl At least one UNIX system, Apple Macintosh Rhapsody 5.5, -dnl does not have -lm. +dnl does not have -lm ... dnl AC_DEFUN(GROFF_LIBM, [AC_CHECK_LIB(m,sin,LIBM=-lm) AC_SUBST(LIBM)])dnl dnl dnl +dnl ... while the MinGW implementation of GCC for Microsoft Win32 +dnl does not seem to have -lc. +dnl +AC_DEFUN(GROFF_LIBC, +[AC_CHECK_LIB(c,main,LIBC=-lc) +AC_SUBST(LIBC)])dnl +dnl +dnl dnl We need top_srcdir to be absolute. dnl AC_DEFUN(GROFF_SRCDIR, @@ -533,7 +542,7 @@ AC_DEFUN(GROFF_BUILDDIR, AC_SUBST(groff_top_builddir)])dnl dnl dnl -dnl Check for EBCDIC - stolen from the OS390 Unix LYNX port +dnl Check for EBCDIC -- stolen from the OS390 Unix LYNX port dnl AC_DEFUN(GROFF_EBCDIC, [AC_MSG_CHECKING([whether character set is EBCDIC]) diff --git a/configure b/configure index f156ba37..c15d2557 100755 --- a/configure +++ b/configure @@ -305,7 +305,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS groff_top_builddir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX TTYDEVDIRS OTHERDEVDIRS LPR LP LPQ PSPRINT DVIPRINT PERLPATH YACC RANLIB ac_ct_RANLIB INSTALL_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SH_SCRIPT_SED_CMD CPP EGREP LIBM LIBOBJS BROKEN_SPOOLER_FLAGS PAGE g sys_tmac_prefix tmac_wrap pnmcut pnmcrop pnmtopng gs psselect pnmtops make_html make_install_html pnmtops_nosetpage LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS groff_top_builddir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX TTYDEVDIRS OTHERDEVDIRS LPR LP LPQ PSPRINT DVIPRINT PERLPATH YACC RANLIB ac_ct_RANLIB INSTALL_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SH_SCRIPT_SED_CMD CPP EGREP LIBC LIBM LIBOBJS BROKEN_SPOOLER_FLAGS PAGE g sys_tmac_prefix tmac_wrap pnmcut pnmcrop pnmtopng gs psselect pnmtops make_html make_install_html pnmtops_nosetpage LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -4498,13 +4498,14 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -echo "$as_me:$LINENO: checking for sys_nerr in or " >&5 -echo $ECHO_N "checking for sys_nerr in or ... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for sys_nerr in , , or " >&5 +echo $ECHO_N "checking for sys_nerr in , , or ... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include #include +#include int main () { @@ -4991,6 +4992,54 @@ echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: checking for main in -lc" >&5 +echo $ECHO_N "checking for main in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_c_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_main" >&5 +echo "${ECHO_T}$ac_cv_lib_c_main" >&6 +if test $ac_cv_lib_c_main = yes; then + LIBC=-lc +fi + + echo "$as_me:$LINENO: checking for sin in -lm" >&5 echo $ECHO_N "checking for sin in -lm... $ECHO_C" >&6 if test "${ac_cv_lib_m_sin+set}" = set; then @@ -5402,7 +5451,7 @@ fi rm -f conftest.mmap saved_libs="$LIBS" -LIBS="$LIBS -lc $LIBM" +LIBS="$LIBS $LIBC $LIBM" @@ -5490,7 +5539,8 @@ LIBS="$saved_libs" -for ac_func in gettimeofday isatty rename setlocale strsep + +for ac_func in gettimeofday isatty kill rename setlocale strsep do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -5672,8 +5722,8 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -echo "$as_me:$LINENO: checking whether ANSI array delete syntax supported" >&5 -echo $ECHO_N "checking whether ANSI array delete syntax supported... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking whether ANSI array delete syntax is supported" >&5 +echo $ECHO_N "checking whether ANSI array delete syntax is supported... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" @@ -6869,6 +6919,7 @@ s,@LN_S@,$LN_S,;t t s,@SH_SCRIPT_SED_CMD@,$SH_SCRIPT_SED_CMD,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t +s,@LIBC@,$LIBC,;t t s,@LIBM@,$LIBM,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@BROKEN_SPOOLER_FLAGS@,$BROKEN_SPOOLER_FLAGS,;t t diff --git a/configure.ac b/configure.ac index c5079633..e4d0d6ae 100644 --- a/configure.ac +++ b/configure.ac @@ -51,15 +51,16 @@ GROFF_TIME_T AC_TYPE_SIGNAL GROFF_STRUCT_EXCEPTION dnl checks for libraries +GROFF_LIBC GROFF_LIBM dnl checks for functions AC_FUNC_MMAP saved_libs="$LIBS" -LIBS="$LIBS -lc $LIBM" +LIBS="$LIBS $LIBC $LIBM" AC_REPLACE_FUNCS(fmod getcwd putenv snprintf strcasecmp \ strerror strncasecmp strtol) LIBS="$saved_libs" -AC_CHECK_FUNCS(gettimeofday isatty rename setlocale strsep) +AC_CHECK_FUNCS(gettimeofday isatty kill rename setlocale strsep) GROFF_MKSTEMP AC_DECL_SYS_SIGLIST dnl checks for compiler characteristics diff --git a/src/include/lib.h b/src/include/lib.h index bebad98e..30ccf4de 100644 --- a/src/include/lib.h +++ b/src/include/lib.h @@ -31,14 +31,15 @@ extern "C" { const char *if_to_a(int, int); } -/* stdio.h on IRIX, OSF/1, emx, and UWIN include getopt.h */ +/* stdio.h on IRIX, OSF/1, emx, UWIN, and MinGW include getopt.h */ /* unistd.h on CYGWIN includes getopt.h */ #if !(defined(__sgi) \ || (defined(__osf__) && defined(__alpha)) \ || defined(_UWIN) \ || defined(__EMX__) \ - || defined(__CYGWIN__)) + || defined(__CYGWIN__) \ + || defined(__MINGW32__)) #include #else #include diff --git a/src/include/nonposix.h b/src/include/nonposix.h index 73422d92..08eb3b0c 100644 --- a/src/include/nonposix.h +++ b/src/include/nonposix.h @@ -36,11 +36,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # ifdef HAVE_UNISTD_H # include # endif -# ifdef _MSC_VER +# if defined(_MSC_VER) || defined(__MINGW32__) # define POPEN_RT "rt" # define POPEN_WT "wt" # define popen(c,m) _popen(c,m) # define pclose(p) _pclose(p) +# define pipe(pfd) _pipe((pfd),0,_O_BINARY|_O_NOINHERIT) # define getpid() (1) # define mkdir(p,m) _mkdir(p) # define setmode(f,m) _setmode(f,m) @@ -85,6 +86,15 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* The system null device. */ # define NULL_DEV "NUL" +/* The default place to create temporary files. */ +# ifndef P_tmpdir +# ifdef _P_tmpdir +# define P_tmpdir _P_tmpdir +# else +# define P_tmpdir "c:/temp" +# endif +# endif + /* Prototypes. */ # ifdef __cplusplus extern "C" { diff --git a/src/roff/groff/pipeline.c b/src/roff/groff/pipeline.c index a2db14bc..ed6c17ee 100644 --- a/src/roff/groff/pipeline.c +++ b/src/roff/groff/pipeline.c @@ -321,7 +321,7 @@ run_pipeline(int ncommands, char ***commands, int no_pipe) int exit_status; RETSIGTYPE (*prev_handler)(int); - if (i) { + if (i && !no_pipe) { /* redirect stdin from temp file */ f = open(tmpfiles[infile], O_RDONLY|O_BINARY, 0666); if (f < 0) diff --git a/src/utils/indxbib/signal.c b/src/utils/indxbib/signal.c index fccd2892..2f7886ad 100644 --- a/src/utils/indxbib/signal.c +++ b/src/utils/indxbib/signal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1992, 2001, 2003 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -41,7 +41,13 @@ static RETSIGTYPE handle_fatal_signal(signum) { signal(signum, SIG_DFL); cleanup(); +#ifdef HAVE_KILL kill(getpid(), signum); +#else + /* MS-DOS and Win32 don't have kill(); the best compromise is + probably to use exit() instead. */ + exit(signum); +#endif } void catch_fatal_signals() -- 2.11.4.GIT