summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-06-21 15:14:37 +0200
committerobo <obo@openoffice.org>2010-06-21 15:14:37 +0200
commit86909c184b8ba2cf96e468e1e7f81c8b9ec7d1bc (patch)
tree79e2168a2e1d835ed11bacf15f7a811c2df2b377
parent0d85448c7b1471ca0dd0a0db3fa866a989b5903b (diff)
parente1c983602eb7e448f6154024da6bbd5a3398d319 (diff)
CWS-TOOLING: integrate CWS systemlibc
-rw-r--r--configure.in15
-rw-r--r--set_soenv.in3
-rw-r--r--soltools/cpp/_nlist.c3
-rw-r--r--soltools/cpp/_unix.c12
-rw-r--r--soltools/cpp/makefile.mk10
-rw-r--r--soltools/javadep/javadep.c9
6 files changed, 45 insertions, 7 deletions
diff --git a/configure.in b/configure.in
index 0f658c8cbde6..048bdc37d924 100644
--- a/configure.in
+++ b/configure.in
@@ -5134,6 +5134,21 @@ if test "$_os" = "Linux"; then
fi
fi
+if test "$_os" != "WNT"; then
+ AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
+ AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
+ if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
+ SYSTEM_LIBC=YES
+ fi
+else
+ HAVE_GETOPT=NO
+ HAVE_READDIR_R=NO
+ SYSTEM_LIBC=YES
+fi
+AC_SUBST(HAVE_GETOPT)
+AC_SUBST(HAVE_READDIR_R)
+AC_SUBST(SYSTEM_LIBC)
+
dnl =========================================
dnl Check for the Microsoft Platform SDK.
dnl =========================================
diff --git a/set_soenv.in b/set_soenv.in
index 7983933c655e..8b6d6f1a7724 100644
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1916,6 +1916,9 @@ ToFile( "SYSTEM_HUNSPELL", "@SYSTEM_HUNSPELL@", "e" );
ToFile( "HUNSPELL_CFLAGS", "@HUNSPELL_CFLAGS@", "e" );
ToFile( "HUNSPELL_LIBS", "@HUNSPELL_LIBS@", "e" );
ToFile( "SYSTEM_LPSOLVE", "@SYSTEM_LPSOLVE@", "e" );
+ToFile( "HAVE_GETOPT", "@HAVE_GETOPT@", "e" );
+ToFile( "HAVE_READDIR_R", "@HAVE_READDIR_R@", "e" );
+ToFile( "SYSTEM_LIBC", "@SYSTEM_LIBC@", "e" );
ToFile( "SYSTEM_HYPH", "@SYSTEM_HYPH@", "e" );
ToFile( "HYPHEN_LIB", "@HYPHEN_LIB@", "e" );
ToFile( "SYSTEM_MYTHES", "@SYSTEM_MYTHES@", "e" );
diff --git a/soltools/cpp/_nlist.c b/soltools/cpp/_nlist.c
index 9144f2b7e15e..a71085bfbbf9 100644
--- a/soltools/cpp/_nlist.c
+++ b/soltools/cpp/_nlist.c
@@ -3,9 +3,6 @@
#include <string.h>
#include "cpp.h"
-extern int stgetopt(int, char *const *, const char *);
-extern char *optarg;
-extern int optind;
extern int Cplusplus;
Nlist *kwdefined;
char wd[128];
diff --git a/soltools/cpp/_unix.c b/soltools/cpp/_unix.c
index 5574bb3ecef7..5352f6f1f5f9 100644
--- a/soltools/cpp/_unix.c
+++ b/soltools/cpp/_unix.c
@@ -12,9 +12,15 @@
#include "cpp.h"
+#if defined MACOSX || !defined HAVE_GETOPT
extern int stgetopt(int, char *const *, const char *);
-extern char *optarg, rcsid[];
+extern char *optarg;
extern int optind;
+#else
+#include <getopt.h>
+#endif
+
+extern char rcsid[];
int Pflag = 0; /* print no line information */
int Iflag = 0; /* print includes */
@@ -36,7 +42,11 @@ void
Tokenrow tr;
setup_kwtab();
+#if defined MACOSX || !defined HAVE_GETOPT
while ((c = stgetopt(argc, argv, "NOPV:I:D:U:F:A:X:u:l:+")) != -1)
+#else
+ while ((c = getopt(argc, argv, "NOPV:I:D:U:F:A:X:u:l:+")) != -1)
+#endif
switch (c)
{
case 'N':
diff --git a/soltools/cpp/makefile.mk b/soltools/cpp/makefile.mk
index 818c27028345..11f04b0a3630 100644
--- a/soltools/cpp/makefile.mk
+++ b/soltools/cpp/makefile.mk
@@ -45,7 +45,6 @@ LIBSALCPPRT=$(0)
OBJFILES= \
$(OBJ)$/_cpp.obj \
$(OBJ)$/_eval.obj \
- $(OBJ)$/_getopt.obj \
$(OBJ)$/_include.obj \
$(OBJ)$/_lex.obj \
$(OBJ)$/_macro.obj \
@@ -54,6 +53,15 @@ OBJFILES= \
$(OBJ)$/_tokens.obj \
$(OBJ)$/_unix.obj
+# nonstandard cpp options needed for Mac (-isysroot),
+# needs the custom stgetopt defined here :/
+.IF "$(OS)" == "MACOSX" || "$(HAVE_GETOPT)" == "NO"
+OBJFILES += $(OBJ)$/_getopt.obj
+.ENDIF
+.IF "$(HAVE_GETOPT)" == "YES"
+CDEFS += -DHAVE_GETOPT
+.ENDIF
+
APP1TARGET = $(TARGET)
.IF "$(GUI)" != "OS2"
APP1STACK = 1000000
diff --git a/soltools/javadep/javadep.c b/soltools/javadep/javadep.c
index d840e6606689..a573d78eed75 100644
--- a/soltools/javadep/javadep.c
+++ b/soltools/javadep/javadep.c
@@ -138,12 +138,14 @@ void usage(void);
void err_quit(const char *, ...);
void silent_quit(void);
+#ifdef WNT
/* poor man's getopt() */
int simple_getopt(char *pargv[], const char *poptstring);
char *optarg = NULL;
int optind = 1;
int optopt = 0;
int opterr = 0;
+#endif
uint8
read_uint8(const file_t *pfile)
@@ -748,7 +750,7 @@ int simple_getopt(char *pargv[], const char *poptstring)
char *popt;
int c = parg[1];
if ( (popt = strchr(poptstring, c)) == NULL ) {
- optopt = c;
+ optopt = c;
if ( opterr )
fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
return '?';
@@ -769,7 +771,6 @@ int simple_getopt(char *pargv[], const char *poptstring)
return -1;
}
-
int CDECL
main(int argc, char *argv[])
{
@@ -817,7 +818,11 @@ main(int argc, char *argv[])
opterr = 0;
pincs = allocate_growable();
+#ifdef WNT
while( (c = simple_getopt(pall_argv, ":i:I:s:S:o:OhHvV")) != -1 ) {
+#else
+ while( (c = getopt(nall_argc, pall_argv, ":i:I:s:S:o:OhHvV")) != -1 ) {
+#endif
switch(c) {
case 'i':
case 'I':