summaryrefslogtreecommitdiff
path: root/build/jlibtool.c
diff options
context:
space:
mode:
authorJean-Frederic Clere <jfclere@apache.org>2004-06-29 15:25:56 +0000
committerJean-Frederic Clere <jfclere@apache.org>2004-06-29 15:25:56 +0000
commitad0837e3b4dd55a1b0d65182f0f9e78f8950d844 (patch)
tree985757aae081a0df5943cc1cf214b955a3834f10 /build/jlibtool.c
parent848717778791ef131381d9eb1b5bf0224acc7bf8 (diff)
downloadapr-ad0837e3b4dd55a1b0d65182f0f9e78f8950d844.tar.gz
Add support for BS2000 (_OSD_POSIX).
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65234 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build/jlibtool.c')
-rw-r--r--build/jlibtool.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/build/jlibtool.c b/build/jlibtool.c
index a3fd9138b..0d49cce9e 100644
--- a/build/jlibtool.c
+++ b/build/jlibtool.c
@@ -53,6 +53,9 @@
*/
#include <stdio.h>
+#if defined(_OSD_POSIX)
+#include <stdarg.h>
+#endif
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
@@ -123,6 +126,18 @@
# define LINKER_FLAG_PREFIX "-Wl,"
#endif
+#if defined(_OSD_POSIX)
+# define SHELL_CMD "/usr/bin/sh"
+# define DYNAMIC_LIB_EXT "so"
+# define MODULE_LIB_EXT "so"
+# define STATIC_LIB_EXT "a"
+# define OBJECT_EXT "o"
+# define LIBRARIAN "ar"
+# define LIBRARIAN_OPTS "cr"
+# define DYNAMIC_LINK_OPTS "-G"
+# define LINKER_FLAG_PREFIX "-Wl,"
+#endif
+
#ifndef SHELL_CMD
#error Unsupported platform: Please add defines for SHELL_CMD etc. for your platform.
#endif
@@ -217,6 +232,44 @@ typedef struct {
const char *version_info;
} command_t;
+#if defined(_OSD_POSIX)
+/* Write at most n characters to the buffer in str, return the
+ * number of chars written or -1 if the buffer would have been
+ * overflowed.
+ *
+ * This is portable to any POSIX-compliant system has /dev/null
+ */
+static FILE *f=NULL;
+static int vsnprintf( char *str, size_t n, const char *fmt, va_list ap )
+{
+ int res;
+
+ if (f == NULL)
+ f = fopen("/dev/null","w");
+ if (f == NULL)
+ return -1;
+
+ setvbuf( f, str, _IOFBF, n );
+
+ res = vfprintf( f, fmt, ap );
+
+ if ( res > 0 && res < n ) {
+ res = vsprintf( str, fmt, ap );
+ }
+ return res;
+}
+static int snprintf( char *str, size_t n, const char *fmt, ... )
+{
+ va_list ap;
+ int res;
+
+ va_start( ap, fmt );
+ res = vsnprintf( str, n, fmt, ap );
+ va_end( ap );
+ return res;
+}
+#endif
+
void init_count_chars(count_chars *cc)
{
cc->vals = (const char**)malloc(PATH_MAX);
@@ -859,6 +912,9 @@ int parse_output_file_name(char *arg, command_t *cmd_data)
if (!ext) {
cmd_data->basename = arg;
cmd_data->output = otProgram;
+#if defined(_OSD_POSIX)
+ cmd_data->options.pic_mode = AVOID;
+#endif
newarg = (char *)malloc(strlen(arg) + 5);
strcpy(newarg, arg);
#ifdef EXE_EXT