summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-09-05 18:07:34 +0200
committerTor Andersson <tor@ghostscript.com>2008-09-05 18:07:34 +0200
commit57c6583aeca0c5cd4ba425344c7eecc0db37ff91 (patch)
tree5311c88742c5fbac14c7d8d5319bc94983fa99cd
parentd861716137c216dee26b69b606d1189949d97f8d (diff)
downloadmupdf-57c6583aeca0c5cd4ba425344c7eecc0db37ff91.tar.xz
Put back the NEED_STRLCPY, NEED_STRSEP and NEED_GETOPT flags.
-rw-r--r--Jamrules18
-rw-r--r--include/fitz/base_sysdep.h43
2 files changed, 35 insertions, 26 deletions
diff --git a/Jamrules b/Jamrules
index 86e49995..d8915a4a 100644
--- a/Jamrules
+++ b/Jamrules
@@ -34,10 +34,9 @@ ALL_LOCATE_TARGET ?= [ FDirName $(TOP) build $(OS)-$(OSPLAT) ] ;
if $(HAVE_JBIG2DEC) { DEFINES += HAVE_JBIG2DEC ; }
if $(HAVE_JASPER) { DEFINES += HAVE_JASPER ; }
-# NEED_GETOPT = true ;
-# NEED_STRLCAT = true ;
-# NEED_STRLCPY = true ;
-# NEED_STRSEP = true ;
+# NEED_STRLCPY = true ;
+# NEED_STRSEP = true ;
+# NEED_GETOPT = true ;
if $(OS) = LINUX
{
@@ -46,6 +45,9 @@ if $(OS) = LINUX
THIRDPARTYINC ?= "`freetype-config --cflags`" ;
THIRDPARTYLIB ?= "`freetype-config --libs`" ;
+ NEED_STRLCPY = true ;
+ NEED_STRSEP = true ;
+
BUILD_X11APP = true ;
CCFLAGS = -Wall -std=c99 $(THIRDPARTYINC) ;
@@ -87,6 +89,10 @@ if $(OS) = MINGW
THIRDPARTYINC ?= -Ic:/local/include ;
THIRDPARTYLIB ?= -Lc:/local/lib ;
+ NEED_STRLCPY = true ;
+ NEED_STRSEP = true ;
+ NEED_GETOPT = true ;
+
CCFLAGS = -Wall -std=c99 $(THIRDPARTYINC) ;
LINKFLAGS = $(THIRDPARTYLIB) ;
LINKLIBS = -lfreetype -ljpeg -lz ;
@@ -109,6 +115,10 @@ if $(OS) = NT
THIRDPARTYINC ?= /Ic:/local/include ;
THIRDPARTYLIB ?= /LIBPATH:c:/local/lib ;
+ NEED_STRLCPY = true ;
+ NEED_STRSEP = true ;
+ NEED_GETOPT = true ;
+
CCFLAGS = $(THIRDPARTYINC) ;
LINKFLAGS = $(THIRDPARTYLIB) ;
LINKLIBS = freetype.lib jpeg.lib z.lib ;
diff --git a/include/fitz/base_sysdep.h b/include/fitz/base_sysdep.h
index 49a7786a..7fd4094d 100644
--- a/include/fitz/base_sysdep.h
+++ b/include/fitz/base_sysdep.h
@@ -16,33 +16,36 @@
#include <errno.h>
#include <fcntl.h> /* O_RDONLY & co */
-/* Some useful (but not C99 standard) functions */
+/* Stupid macros that don't exist everywhere */
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#ifndef M_SQRT2
+#define M_SQRT2 1.41421356237309504880
+#endif
+
+/* Some useful semi-standard functions */
+
+#ifdef NEED_STRLCPY
extern int strlcpy(char *dst, const char *src, int n);
extern int strlcat(char *dst, const char *src, int n);
+#endif
+#ifdef NEED_STRSEP
extern char *strsep(char **stringp, const char *delim);
+#endif
+#ifdef NEED_GETOPT
extern int getopt(int nargc, char * const * nargv, const char *ostr);
extern int opterr, optind, optopt;
extern char *optarg;
-
-/* Some useful (but not C99 standard) math macros */
-
-#define M_E 2.71828182845904523536
-#define M_LOG2E 1.44269504088896340736
-#define M_LOG10E 0.434294481903251827651
-#define M_LN2 0.693147180559945309417
-#define M_LN10 2.30258509299404568402
-#define M_PI 3.14159265358979323846
-#define M_PI_2 1.57079632679489661923
-#define M_PI_4 0.785398163397448309616
-#define M_1_PI 0.318309886183790671538
-#define M_2_PI 0.636619772367581343076
-#define M_1_SQRTPI 0.564189583547756286948
-#define M_2_SQRTPI 1.12837916709551257390
-#define M_SQRT2 1.41421356237309504880
-#define M_SQRT_2 0.707106781186547524401
+#endif
/*
* MSVC section
@@ -81,10 +84,6 @@ extern int gettimeofday(struct timeval *tv, struct timezone *tz);
#define R_OK 4
#endif
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
/*
* C99 section
*/