From 7eb65edae91d64b4d60961184403215b204fdd35 Mon Sep 17 00:00:00 2001 From: wlemb Date: Fri, 20 Apr 2001 23:53:47 +0000 Subject: * configure.in: Move check for mkstemp() to... * aclocal.m4 (GROFF_MKSTEMP): This new function. * configure: Regenerated. * src/include/groff-getopt.h: Don't use variable names in declarations. * configure.in: Add special check for mkstemp(). * src/libs/libgroff/tmpfile.cc: Use it. * src/utils/indxbib/indxbib.cc: Ditto. * src/utils/pfbtops/pfbtops.c (main): Don't use C++ comment style. * src/devices/grolbp/lbp.h (lbpprintf, lbpputs, vdmprintf): Use `const'. --- ChangeLog | 18 ++++++++ aclocal.m4 | 12 +++++ configure | 107 +++++++++++++++++++++++++++++++++++-------- configure.in | 3 +- src/devices/grolbp/lbp.h | 8 ++-- src/include/groff-getopt.h | 28 +++++------ src/libs/libgroff/tmpfile.cc | 7 ++- src/utils/indxbib/indxbib.cc | 10 ++-- src/utils/pfbtops/pfbtops.c | 2 +- src/xditview/Imakefile.in | 11 +++++ 10 files changed, 159 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae6baefe..706c2bb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2001-04-21 Werner LEMBERG + + * configure.in: Add special check for mkstemp(). + * src/libs/libgroff/tmpfile.cc: Use it. + * src/utils/indxbib/indxbib.cc: Ditto. + * src/utils/pfbtops/pfbtops.c (main): Don't use C++ comment style. + * src/devices/grolbp/lbp.h (lbpprintf, lbpputs, vdmprintf): Use + `const'. + 2001-04-20 Bruce Lilly `Version_string' as C++ object was not visible to linker from C diff --git a/aclocal.m4 b/aclocal.m4 index 34ee4f1f..53e09ae7 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -514,3 +514,15 @@ if test $groff_cv_decl_needed_$1 = yes; then AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z])) fi AC_LANG_RESTORE])dnl +dnl +dnl +dnl Check for mkstemp() and its function prototype. +dnl +AC_DEFUN(GROFF_MKSTEMP, +[AC_CHECK_FUNC(mkstemp, +[AC_DEFINE(HAVE_MKSTEMP) +AC_MSG_CHECKING([for mkstemp prototype in ]) +AC_EGREP_CPP(mkstemp, +[#include ], +AC_MSG_RESULT(yes);AC_DEFINE(HAVE_MKSTEMP_PROTO), +AC_MSG_RESULT(no))])]) diff --git a/configure b/configure index 061a6581..667491c0 100755 --- a/configure +++ b/configure @@ -2532,7 +2532,7 @@ done LIBS="$saved_libs" -for ac_func in rename mkstemp strcasecmp strncasecmp strsep strdup +for ac_func in rename strcasecmp strncasecmp strsep strdup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2539: checking for $ac_func" >&5 @@ -2587,13 +2587,84 @@ else fi done +echo $ac_n "checking for mkstemp""... $ac_c" 1>&6 +echo "configure:2592: checking for mkstemp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mkstemp'+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 mkstemp(); + +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_mkstemp) || defined (__stub___mkstemp) +choke me +#else +mkstemp(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_mkstemp=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_mkstemp=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'mkstemp`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_MKSTEMP 1 +EOF + +echo $ac_n "checking for mkstemp prototype in ""... $ac_c" 1>&6 +echo "configure:2639: checking for mkstemp prototype in " >&5 +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "mkstemp" >/dev/null 2>&1; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF +#define HAVE_MKSTEMP_PROTO 1 +EOF + +else + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +else + echo "$ac_t""no" 1>&6 +fi + echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:2592: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "configure:2663: checking for sys_siglist declaration in signal.h or unistd.h" >&5 if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2605,7 +2676,7 @@ int main() { char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:2609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else @@ -2634,16 +2705,16 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether ANSI array delete syntax supported""... $ac_c" 1>&6 -echo "configure:2638: checking whether ANSI array delete syntax supported" >&5 +echo "configure:2709: checking whether ANSI array delete syntax supported" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2672,16 +2743,16 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking traditional preprocessor""... $ac_c" 1>&6 -echo "configure:2676: checking traditional preprocessor" >&5 +echo "configure:2747: checking traditional preprocessor" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF #define TRADITIONAL_CPP 1 @@ -2702,12 +2773,12 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking w_coredump""... $ac_c" 1>&6 -echo "configure:2706: checking w_coredump" >&5 +echo "configure:2777: checking w_coredump" >&5 if test "$cross_compiling" = yes; then echo "$ac_t""no" 1>&6 else cat > conftest.$ac_ext < #include @@ -2722,7 +2793,7 @@ main() #endif } EOF -if { (eval echo configure:2726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF #define WCOREFLAG 0200 @@ -2738,12 +2809,12 @@ rm -fr conftest* fi echo $ac_n "checking default value for grops -b option""... $ac_c" 1>&6 -echo "configure:2742: checking default value for grops -b option" >&5 +echo "configure:2813: checking default value for grops -b option" >&5 test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7 echo "$ac_t""$BROKEN_SPOOLER_FLAGS" 1>&6 echo $ac_n "checking default paper size""... $ac_c" 1>&6 -echo "configure:2747: checking default paper size" >&5 +echo "configure:2818: checking default paper size" >&5 if test -z "$PAGE"; then descfile= if test -r $prefix/share/groff/font/devps/DESC; then @@ -2785,7 +2856,7 @@ test -n "$PAGE" || PAGE=letter echo "$ac_t""$PAGE" 1>&6 echo $ac_n "checking for existing troff installation""... $ac_c" 1>&6 -echo "configure:2789: checking for existing troff installation" >&5 +echo "configure:2860: checking for existing troff installation" >&5 if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then echo "$ac_t""yes" 1>&6 g=g @@ -2795,7 +2866,7 @@ else fi echo $ac_n "checking for prefix of system macro packages""... $ac_c" 1>&6 -echo "configure:2799: checking for prefix of system macro packages" >&5 +echo "configure:2870: checking for prefix of system macro packages" >&5 sys_tmac_prefix= sys_tmac_file_prefix= for d in /usr/share/lib/tmac /usr/lib/tmac; do @@ -2815,7 +2886,7 @@ echo "$ac_t""$sys_tmac_prefix" 1>&6 tmac_wrap= echo $ac_n "checking which system macro packages should be made available""... $ac_c" 1>&6 -echo "configure:2819: checking which system macro packages should be made available" >&5 +echo "configure:2890: checking which system macro packages should be made available" >&5 if test "x$sys_tmac_file_prefix" = "xtmac."; then for f in $sys_tmac_prefix*; do suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` diff --git a/configure.in b/configure.in index 92024e03..3000a805 100755 --- a/configure.in +++ b/configure.in @@ -46,7 +46,8 @@ saved_libs="$LIBS" LIBS="$LIBS -lc $LIBM" AC_REPLACE_FUNCS(fmod strtol getcwd strerror putenv) LIBS="$saved_libs" -AC_CHECK_FUNCS(rename mkstemp strcasecmp strncasecmp strsep strdup) +AC_CHECK_FUNCS(rename strcasecmp strncasecmp strsep strdup) +GROFF_MKSTEMP AC_DECL_SYS_SIGLIST dnl checks for compiler characteristics GROFF_ARRAY_DELETE diff --git a/src/devices/grolbp/lbp.h b/src/devices/grolbp/lbp.h index 6a11b198..cacf3eaf 100644 --- a/src/devices/grolbp/lbp.h +++ b/src/devices/grolbp/lbp.h @@ -36,7 +36,7 @@ lbpinit(FILE *outfile) static inline void -lbpprintf(char *format, ... ) +lbpprintf(const char *format, ... ) { /* Taken from cjet */ va_list stuff; @@ -46,7 +46,7 @@ lbpprintf(char *format, ... ) }; static inline void -lbpputs(char *data) +lbpputs(const char *data) { fputs(data,lbpoutput); }; @@ -123,7 +123,7 @@ lbpruleabs(int x, int y, int hsize, int vsize) fprintf(lbpoutput,"\033[9r"); }; -static inline void vdmprintf(char *format, ... ); +static inline void vdmprintf(const char *format, ... ); static inline char * vdmnum(int num,char *result) @@ -179,7 +179,7 @@ vdmend() }; static inline void -vdmprintf(char *format, ... ) +vdmprintf(const char *format, ... ) { /* Taken from cjet */ va_list stuff; diff --git a/src/include/groff-getopt.h b/src/include/groff-getopt.h index 1807fc7c..a30e1974 100644 --- a/src/include/groff-getopt.h +++ b/src/include/groff-getopt.h @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. Written by Werner Lemberg (wl@gnu.org) This file is part of groff. @@ -47,19 +47,19 @@ struct option #define required_argument 1 #define optional_argument 2 -extern int getopt(int __argc, - char *const *__argv, - const char *__shortopts); -extern int getopt_long(int __argc, - char *const *__argv, - const char *__shortopts, - const struct option *__longopts, - int *__longind); -extern int getopt_long_only(int __argc, - char *const *__argv, - const char *__shortopts, - const struct option *__longopts, - int *__longind); +extern int getopt(int, // __argc + char *const *, // __argv + const char *); // __shortopts +extern int getopt_long(int, // __argc + char *const *, // __argv + const char *, // __shortopts + const struct option *, // __longopts + int *); // __longind +extern int getopt_long_only(int, // __argc + char *const *, // __argv + const char *, // __shortopts + const struct option *, // __longopts + int *); // __longind #ifdef __cplusplus } diff --git a/src/libs/libgroff/tmpfile.cc b/src/libs/libgroff/tmpfile.cc index a6c20101..d06a82bd 100644 --- a/src/libs/libgroff/tmpfile.cc +++ b/src/libs/libgroff/tmpfile.cc @@ -29,12 +29,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "error.h" #include "nonposix.h" +#ifndef HAVE_MKSTEMP_PROTO extern "C" { - // Solaris 2.5.1 has these functions, - // but its stdlib.h fails to declare them. - char *mktemp(char *); - int mkstemp(char *); + extern int mkstemp (char *); } +#endif // If this is set, create temporary files there #define GROFF_TMPDIR_ENVVAR "GROFF_TMPDIR" diff --git a/src/utils/indxbib/indxbib.cc b/src/utils/indxbib/indxbib.cc index 403aa6fe..358c8353 100644 --- a/src/utils/indxbib/indxbib.cc +++ b/src/utils/indxbib/indxbib.cc @@ -37,13 +37,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "nonposix.h" +extern "C" const char *Version_string; + +#ifndef HAVE_MKSTEMP_PROTO extern "C" { - const char *Version_string; - // Solaris 2.5.1 has these functions, - // but its stdlib.h fails to declare them. - char *mktemp(char *); - int mkstemp(char *); + extern int mkstemp(char *); } +#endif #define DEFAULT_HASH_TABLE_SIZE 997 #define TEMP_INDEX_TEMPLATE "indxbibXXXXXX" diff --git a/src/utils/pfbtops/pfbtops.c b/src/utils/pfbtops/pfbtops.c index 03fc4b41..0964edec 100644 --- a/src/utils/pfbtops/pfbtops.c +++ b/src/utils/pfbtops/pfbtops.c @@ -66,7 +66,7 @@ int main(argc, argv) exit(0); break; } - case CHAR_MAX + 1: // --help + case CHAR_MAX + 1: /* --help */ usage(stdout); exit(0); break; diff --git a/src/xditview/Imakefile.in b/src/xditview/Imakefile.in index 3ad244d6..01fab4f1 100644 --- a/src/xditview/Imakefile.in +++ b/src/xditview/Imakefile.in @@ -19,7 +19,11 @@ PROGRAMS = \ gxditview \ xtotroff DEPLIBS = XawClientDepLibs +#if defined(HPArchitecture) && (OSMajorVersion > 9) +LOCAL_LIBRARIES = -L/usr/contrib/X11R6/lib XawClientLibs +#else LOCAL_LIBRARIES = XawClientLibs +#endif SRCS1 = \ $(srcdir)/xditview.c \ $(srcdir)/Dvi.c \ @@ -50,9 +54,16 @@ OBJS2 = \ xtotroff.o \ XFontName.o \ DviChar.o +#if defined(HPArchitecture) && (OSMajorVersion > 9) INCLUDES = \ + -I/usr/contrib/X11R6/include \ -I$(TOOLKITSRC) \ -I$(TOP) +#else +INCLUDES = \ + -I$(TOOLKITSRC) \ + -I$(TOP) +#endif MATHLIB = -lm DEFINES = \ $(SIGNAL_DEFINES) \ -- cgit v1.2.1