[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] [PATCH] compiling error on grolbp with latest CVS update
From: |
Gael Queri |
Subject: |
Re: [Groff] [PATCH] compiling error on grolbp with latest CVS update |
Date: |
Sat, 10 Jun 2000 15:39:45 +0200 |
User-agent: |
Mutt/1.1.11i |
On Sat, Jun 10, 2000 at 10:32:41AM +0000, Werner LEMBERG wrote:
> This is the wrong patch. The very problem is that certain old
> versions of Sun's compiler actually has strncasecmp() but no prototype
> for it.
>
> The right fix would be to use `size_t' instead of `int'. Ken, can you
> please check whether `size_t' works?
Well, there will certainly be an OS where the prototype doesn't work.
>
> Or is there a better solution?
Yes, I think it's better to use autoconf to wheck whether
strncasecmp is declared, like the tests for putenv(), hypot() etc
So I took from GNU bfd a generic test for that and I replaced
the previous checks.
Regards, gael
diff -x Makefile -x configure -x Imakefile -ur groff-1.16/Makefile.in
groff-1.16.gael/Makefile.in
--- groff-1.16/Makefile.in Sat Jun 10 15:26:43 2000
+++ groff-1.16.gael/Makefile.in Sat Jun 10 15:22:59 2000
@@ -170,14 +170,16 @@
# -DHAVE_STRDUP if you have strdup()
# -DHAVE_STRSEP if you have strsep()
# -DHAVE_STRCASECMP if you have strcasecmp()
-# -DSTDLIB_H_DECLARES_PUTENV if your C++ <stdlib.h> declares putenv()
-# -DSTDIO_H_DECLARES_POPEN if your C++ <stdio.h> declares popen()
-# -DSTDIO_H_DECLARES_PCLOSE if your C++ <stdio.h> declares pclose()
+# -DNEED_DECLARATION_HYPOT if your C++ <math.h> doesn't declare hypot()
+# -DNEED_DECLARATION_PUTENV if your C++ <stdlib.h> doesn't declare putenv()
+# -DNEED_DECLARATION_POPEN if your C++ <stdio.h> doesn't declare popen()
+# -DNEED_DECLARATION_PCLOSE if your C++ <stdio.h> doesn't declare pclose()
+# -DNEED_DECLARATION_STRNCASECMP
+# if your C++ <string.h> doesn't declare strncasecmp()
# -DRET_TYPE_SRAND_IS_VOID if your srand() returns void or int
# -DHAVE_SYS_NERR if you have sysnerr in <errno.h> or <stdio.h>
# -DHAVE_SYS_ERRLIST if you have sys_errlist in <errno.h> or
# <stdio.h>
-# -DMATH_H_DECLARES_HYPOT if you have hypot() in <math.h>
# -DTRADITIONAL_CPP if your C++ compiler uses a traditional
# (Reiser) preprocessor
# -DLONG_FOR_TIME_T if localtime() takes a long * not a time_t *
diff -x Makefile -x configure -x Imakefile -ur groff-1.16/aclocal.m4
groff-1.16.gael/aclocal.m4
--- groff-1.16/aclocal.m4 Sat Jun 10 15:26:43 2000
+++ groff-1.16.gael/aclocal.m4 Sat Jun 10 15:16:10 2000
@@ -517,3 +517,37 @@
fi
rm -f conftest.defs
])
+
+dnl See whether we need a declaration for a function.
+dnl stolen from GNU bfd
+AC_DEFUN(GROFF_NEED_DECLARATION,
+[AC_MSG_CHECKING([whether $1 must be declared])
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_CACHE_VAL(groff_cv_decl_needed_$1,
+[AC_TRY_COMPILE([
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif],
+[char *(*pfn) = (char *(*)) $1],
+groff_cv_decl_needed_$1=no, groff_cv_decl_needed_$1=yes)])
+AC_MSG_RESULT($groff_cv_decl_needed_$1)
+if test $groff_cv_decl_needed_$1 = yes; then
+ AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]))
+fi
+AC_LANG_RESTORE])dnl
+
diff -x Makefile -x configure -x Imakefile -ur groff-1.16/configure.in
groff-1.16.gael/configure.in
--- groff-1.16/configure.in Sat Jun 10 15:26:43 2000
+++ groff-1.16.gael/configure.in Sat Jun 10 14:27:35 2000
@@ -18,16 +18,18 @@
GROFF_CSH_HACK(SH_SCRIPT_SED_CMD='1s/.*/:/', SH_SCRIPT_SED_CMD='')
AC_SUBST(SH_SCRIPT_SED_CMD)
dnl checks for headers
-AC_CHECK_HEADERS(unistd.h dirent.h limits.h sys/dir.h stdlib.h strings.h)
+AC_CHECK_HEADERS(stdlib.h unistd.h dirent.h limits.h sys/dir.h stdlib.h \
+ string.h strings.h math.h)
GROFF_ISC_SYSV3
GROFF_POSIX
-GROFF_PUTENV
-GROFF_POPEN
-GROFF_PCLOSE
GROFF_SRAND
+GROFF_NEED_DECLARATION(hypot)
+GROFF_NEED_DECLARATION(popen)
+GROFF_NEED_DECLARATION(pclose)
+GROFF_NEED_DECLARATION(putenv)
+GROFF_NEED_DECLARATION(strncasecmp)
GROFF_SYS_NERR
GROFF_SYS_ERRLIST
-GROFF_HYPOT
GROFF_OSFCN_H
GROFF_LIMITS_H
dnl checks for typedefs
diff -x Makefile -x configure -x Imakefile -ur
groff-1.16/src/devices/grolbp/lbp.cc groff-1.16.gael/src/devices/grolbp/lbp.cc
--- groff-1.16/src/devices/grolbp/lbp.cc Sat Jun 10 15:26:44 2000
+++ groff-1.16.gael/src/devices/grolbp/lbp.cc Sat Jun 10 15:32:43 2000
@@ -32,11 +32,13 @@
#include "charset.h"
#ifdef HAVE_STRNCASECMP
+#ifdef NEED_DECLARATION_STRNCASECMP
extern "C" {
// SunOS's string.h fails to declare this.
int strncasecmp(const char *, const char *, int);
}
-#endif
+#endif /* NEED_DECLARATION_STRNCASECMP */
+#endif /* HAVE_STRNCASECMP */
static short int papersize = -1, // papersize
orientation = -1 , // orientation
diff -x Makefile -x configure -x Imakefile -ur groff-1.16/src/include/lib.h
groff-1.16.gael/src/include/lib.h
--- groff-1.16/src/include/lib.h Sat Jun 10 15:26:44 2000
+++ groff-1.16.gael/src/include/lib.h Sat Jun 10 15:19:19 2000
@@ -36,17 +36,17 @@
FILE *xtmpfile(char **namep=0, char *postfix=0, int do_unlink=1);
char *xtmptemplate(char *extension=0);
-#ifndef STDIO_H_DECLARES_POPEN
+#ifdef NEED_DECLARATION_POPEN
extern "C" { FILE *popen(const char *, const char *); }
-#endif /* not STDIO_H_DECLARES_POPEN */
+#endif /* NEED_DECLARATION_POPEN */
-#ifndef STDIO_H_DECLARES_PCLOSE
+#ifdef NEED_DECLARATION_PCLOSE
extern "C" { int pclose (FILE *); }
-#endif /* not STDIO_H_DECLARES_PCLOSE */
+#endif /* NEED_DECLARATION_PCLOSE */
int interpret_lf_args(const char *p);
diff -x Makefile -x configure -x Imakefile -ur
groff-1.16/src/preproc/grn/hgraph.cc groff-1.16.gael/src/preproc/grn/hgraph.cc
--- groff-1.16/src/preproc/grn/hgraph.cc Sat May 13 01:27:29 2000
+++ groff-1.16.gael/src/preproc/grn/hgraph.cc Sat Jun 10 15:33:07 2000
@@ -6,11 +6,11 @@
#include "gprint.h"
-#ifndef MATH_H_DECLARES_HYPOT
+#ifdef NEED_DECLARATION_HYPOT
extern "C" {
double hypot(double, double);
}
-#endif
+#endif /* NEED_DECLARATION_HYPOT */
#define MAXVECT 40
#define MAXPOINTS 200
diff -x Makefile -x configure -x Imakefile -ur groff-1.16/src/preproc/pic/pic.h
groff-1.16.gael/src/preproc/pic/pic.h
--- groff-1.16/src/preproc/pic/pic.h Sun Feb 6 10:38:00 2000
+++ groff-1.16.gael/src/preproc/pic/pic.h Sat Jun 10 15:33:31 2000
@@ -24,11 +24,11 @@
#include <stdlib.h>
#include <errno.h>
-#ifndef MATH_H_DECLARES_HYPOT
+#ifdef NEED_DECLARATION_HYPOT
extern "C" {
double hypot(double, double);
}
-#endif
+#endif /* NEED_DECLARATION_HYPOT */
#include "assert.h"
#include "cset.h"
diff -x Makefile -x configure -x Imakefile -ur
groff-1.16/src/roff/groff/groff.cc groff-1.16.gael/src/roff/groff/groff.cc
--- groff-1.16/src/roff/groff/groff.cc Tue May 2 01:47:24 2000
+++ groff-1.16.gael/src/roff/groff/groff.cc Sat Jun 10 14:32:14 2000
@@ -44,11 +44,11 @@
// specified
#define XREG ".X"
-#ifndef STDLIB_H_DECLARES_PUTENV
+#ifdef NEED_DECLARATION_PUTENV
extern "C" {
int putenv(const char *);
}
-#endif /* not STDLIB_H_DECLARES_PUTENV */
+#endif /* NEED_DECLARATION_PUTENV */
const int SOELIM_INDEX = 0;
const int REFER_INDEX = SOELIM_INDEX + 1;
- [Groff] [PATCH] compiling error on grolbp with latest CVS update, Nicola Bernardini, 2000/06/09
- Re: [Groff] [PATCH] compiling error on grolbp with latest CVS update, Werner LEMBERG, 2000/06/10
- Re: [Groff] [PATCH] compiling error on grolbp with latest CVS update,
Gael Queri <=
- Re: [Groff] [PATCH] compiling error on grolbp with latest CVS update, Werner LEMBERG, 2000/06/10
- Re: [Groff] [PATCH] compiling error on grolbp with latest CVS update, Gael Queri, 2000/06/10
- Re: [Groff] [PATCH] compiling error on grolbp with latest CVS update, Werner LEMBERG, 2000/06/11
- The mess of charsets (was Re: [Groff] [PATCH] compiling error on grolbp with latest CVS update), Gael Queri, 2000/06/13
- [Groff] Re: The mess of charsets, Werner LEMBERG, 2000/06/13
Re: [Groff] [PATCH] compiling error on grolbp with latest CVS, Keith Thompson, 2000/06/10