# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Tue Mar 9 14:37:57 EET 1999 [metaconfig 3.0 PL70]
+# Generated on Mon Mar 15 18:36:13 EET 1999 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.com)
cat >/tmp/c1$$ <<EOF
useshrplib='true'
# Why does next4 have to be so different?
case "${osname}${osvers}" in
- next4*) xxx='DYLD_LIBRARY_PATH' ;;
+ next4*|rhapsody*)
+ xxx='DYLD_LIBRARY_PATH' ;;
os2*) xxx='' ;; # Nothing special needed.
beos*) xxx='' ;;
*) xxx='LD_LIBRARY_PATH' ;;
esac
case "$osname" in
-next) multiarch="$define" ;;
+next|rhapsody) multiarch="$define" ;;
esac
case "$multiarch" in
''|[nN]*) multiarch="$undef" ;;
# NeXT uses a different name.
ldlibpth="DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH"
;;
+ rhapsody*)
+ ldlibpth="DYLD_LIBRARY_PATH=`pwd`/Perl:$DYLD_LIBRARY_PATH"
+ ;;
os2*) # OS/2 doesn't need anything special for LD_LIBRARY_PATH.
ldlibpth=''
;;
*/
#define STDCHAR $stdchar /**/
-/* INTSIZE:
- * This symbol contains the value of sizeof(int) so that the C
- * preprocessor can make decisions based on it.
- */
-/* LONGSIZE:
- * This symbol contains the value of sizeof(long) so that the C
- * preprocessor can make decisions based on it.
- */
-/* SHORTSIZE:
- * This symbol contains the value of sizeof(short) so that the C
- * preprocessor can make decisions based on it.
- */
-#define INTSIZE $intsize /**/
-#define LONGSIZE $longsize /**/
-#define SHORTSIZE $shortsize /**/
-
/* HAS_ACCESSX:
* This symbol, if defined, indicates that the accessx routine is
* available to do extended access checks.
*/
#$crosscompile CROSSCOMPILE /**/
+/* INTSIZE:
+ * This symbol contains the value of sizeof(int) so that the C
+ * preprocessor can make decisions based on it.
+ */
+/* LONGSIZE:
+ * This symbol contains the value of sizeof(long) so that the C
+ * preprocessor can make decisions based on it.
+ */
+/* SHORTSIZE:
+ * This symbol contains the value of sizeof(short) so that the C
+ * preprocessor can make decisions based on it.
+ */
+#define INTSIZE $intsize /**/
+#define LONGSIZE $longsize /**/
+#define SHORTSIZE $shortsize /**/
+
/* MULTIARCH:
* This symbol, if defined, signifies that the build
* process will produce some binary files that are going to be
'') ;;
*) opts="$opts -Dccflags='$ccflags'";;
esac
+case "$LDFLAGS" in
+'') ;;
+*) ldflags="$ldflags $LDFLAGS";;
+esac
+case "$ldflags" in
+'') ;;
+*) opts="$opts -Dldflags='$ldflags'";;
+esac
# Don't use -s if they want verbose mode
case "$verbose" in
--- /dev/null
+/* dl_rhapsody.xs
+ *
+ * Platform: Apple Rhapsody 5.0
+ * Based on: dl_next.xs by Paul Marquess
+ * Based on: dl_dlopen.xs by Anno Siegel
+ * Created: Aug 15th, 1994
+ *
+ */
+
+/*
+ And Gandalf said: 'Many folk like to know beforehand what is to
+ be set on the table; but those who have laboured to prepare the
+ feast like to keep their secret; for wonder makes the words of
+ praise louder.'
+*/
+
+/* Porting notes:
+
+dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess. It
+should not be used as a base for further ports though it may be used
+as an example for how dl_dlopen.xs can be ported to other platforms.
+
+The method used here is just to supply the sun style dlopen etc.
+functions in terms of NeXTs rld_*. The xs code proper is unchanged
+from Paul's original.
+
+The port could use some streamlining. For one, error handling could
+be simplified.
+
+Anno Siegel
+
+*/
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#define DL_LOADONCEONLY
+
+#include "dlutils.c" /* SaveError() etc */
+
+#undef environ
+#import <mach-o/dyld.h>
+
+static char * dl_last_error = (char *) 0;
+static AV *dl_resolve_using = Nullav;
+
+static char *dlerror()
+{
+ return dl_last_error;
+}
+
+int dlclose(handle) /* stub only */
+void *handle;
+{
+ return 0;
+}
+
+enum dyldErrorSource
+{
+ OFImage,
+};
+
+static void TranslateError
+ (const char *path, enum dyldErrorSource type, int number)
+{
+ char *error;
+ unsigned int index;
+ static char *OFIErrorStrings[] =
+ {
+ "%s(%d): Object Image Load Failure\n",
+ "%s(%d): Object Image Load Success\n",
+ "%s(%d): Not an recognisable object file\n",
+ "%s(%d): No valid architecture\n",
+ "%s(%d): Object image has an invalid format\n",
+ "%s(%d): Invalid access (permissions?)\n",
+ "%s(%d): Unknown error code from NSCreateObjectFileImageFromFile\n",
+ };
+#define NUM_OFI_ERRORS (sizeof(OFIErrorStrings) / sizeof(OFIErrorStrings[0]))
+
+ switch (type)
+ {
+ case OFImage:
+ index = number;
+ if (index > NUM_OFI_ERRORS - 1)
+ index = NUM_OFI_ERRORS - 1;
+ error = form(OFIErrorStrings[index], path, number);
+ break;
+
+ default:
+ error = form("%s(%d): Totally unknown error type %d\n",
+ path, number, type);
+ break;
+ }
+ safefree(dl_last_error);
+ dl_last_error = savepv(error);
+}
+
+static char *dlopen(char *path, int mode /* mode is ignored */)
+{
+ int dyld_result;
+ NSObjectFileImage ofile;
+ NSModule handle = NULL;
+
+ dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
+ if (dyld_result != NSObjectFileImageSuccess)
+ TranslateError(path, OFImage, dyld_result);
+ else
+ {
+ // NSLinkModule will cause the run to abort on any link error's
+ // not very friendly but the error recovery functionality is limited.
+ handle = NSLinkModule(ofile, path, TRUE);
+ }
+
+ return handle;
+}
+
+void *
+dlsym(handle, symbol)
+void *handle;
+char *symbol;
+{
+ void *addr;
+
+ if (NSIsSymbolNameDefined(symbol))
+ addr = NSAddressOfSymbol(NSLookupAndBindSymbol(symbol));
+ else
+ addr = NULL;
+
+ return addr;
+}
+
+
+
+/* ----- code from dl_dlopen.xs below here ----- */
+
+
+static void
+dl_private_init()
+{
+ (void)dl_generic_private_init();
+ dl_resolve_using = perl_get_av("DynaLoader::dl_resolve_using", 0x4);
+}
+
+MODULE = DynaLoader PACKAGE = DynaLoader
+
+BOOT:
+ (void)dl_private_init();
+
+
+
+void *
+dl_load_file(filename, flags=0)
+ char * filename
+ int flags
+ PREINIT:
+ int mode = 1;
+ CODE:
+ DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s,%x):\n", filename,flags));
+ if (flags & 0x01)
+ warn("Can't make loaded symbols global on this platform while loading %s",filename);
+ RETVAL = dlopen(filename, mode) ;
+ DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), " libref=%x\n", RETVAL));
+ ST(0) = sv_newmortal() ;
+ if (RETVAL == NULL)
+ SaveError("%s",dlerror()) ;
+ else
+ sv_setiv( ST(0), (IV)RETVAL);
+
+
+void *
+dl_find_symbol(libhandle, symbolname)
+ void * libhandle
+ char * symbolname
+ CODE:
+ symbolname = form("_%s", symbolname);
+ DLDEBUG(2, PerlIO_printf(PerlIO_stderr(),
+ "dl_find_symbol(handle=%lx, symbol=%s)\n",
+ (unsigned long) libhandle, symbolname));
+ RETVAL = dlsym(libhandle, symbolname);
+ DLDEBUG(2, PerlIO_printf(PerlIO_stderr(),
+ " symbolref = %lx\n", (unsigned long) RETVAL));
+ ST(0) = sv_newmortal() ;
+ if (RETVAL == NULL)
+ SaveError("%s",dlerror()) ;
+ else
+ sv_setiv( ST(0), (IV)RETVAL);
+
+
+void
+dl_undef_symbols()
+ PPCODE:
+
+
+
+# These functions should not need changing on any platform:
+
+void
+dl_install_xsub(perl_name, symref, filename="$Package")
+ char * perl_name
+ void * symref
+ char * filename
+ CODE:
+ DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), "dl_install_xsub(name=%s, symref=%x)\n",
+ perl_name, symref));
+ ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)())symref, filename)));
+
+
+char *
+dl_error()
+ CODE:
+ RETVAL = LastError ;
+ OUTPUT:
+ RETVAL
+
++# end.
/* The NeXT dynamic loader headers will not build with the bool macro
So declare them now to clear confusion.
*/
-#ifdef NeXT
+#if defined(NeXT) || defined(__NeXT__)
# undef FALSE
# undef TRUE
typedef enum bool { FALSE = 0, TRUE = 1 } bool;
# ifndef HAS_BOOL
# define HAS_BOOL 1
# endif /* !HAS_BOOL */
-#endif /* NeXT */
+#endif /* NeXT || __NeXT__ */
#ifndef HAS_BOOL
# if defined(UTS) || defined(VMS)
--- /dev/null
+##
+# Rhapsody (Mac OS X Server) hints
+# Wilfredo Sanchez <wsanchez@apple.com>
+##
+
+# Since we can build fat, the archname doesn't need the processor type
+archname='rhapsody';
+
+# Perl5.003 precedes this platform
+d_bincompat3='undef';
+
+# Libc is in libsystem.
+libc='/System/Library/Frameworks/System.framework/System';
+
+# nm works.
+usenm='true';
+
+# Optimize.
+optimize='-O3';
+
+# We have a prototype for telldir.
+# We are not NeXTStep.
+ccflags="${ccflags} -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE -UNeXT -U__NeXT__";
+
+# Don't use /usr/local/lib; we may have junk there.
+libpth='/lib /usr/lib';
+
+# Shared library extension in .dylib.
+# Bundle extension in .bundle.
+ld='cc';
+so='dylib';
+dlext='bundle';
+dlsrc='dl_rhapsody.xs';
+cccdlflags='';
+lddlflags="${ldflags} -bundle -undefined suppress";
+useshrplib='true';
+libperl='Perl';
+framework_path='/System/Library/Frameworks/Perl.framework';
+base_address='0x4be00000';
+
+# 4BSD uses /usr/share/man, not /usr/man.
+# Don't put man pages in /usr/lib; that's goofy.
+man1dir='/usr/share/man/man1';
+man3dir='/usr/share/man/man3';
+
+# Where to put modules.
+privlib='/System/Library/Perl';
+sitelib='/Local/Library/Perl';
+
+# vfork works
+usevfork='true';
+
+# malloc works
+usemymalloc='n';
elsif ($^O ne 'dos') {
safe_unlink("$installbin/$perl$ver$exe_ext");
copy("perl$exe_ext", "$installbin/$perl$ver$exe_ext");
+ strip("$installbin/perl$ver$exe_ext") if $^O =~ /^(rhapsody)$;
chmod(0755, "$installbin/$perl$ver$exe_ext");
}
else {
foreach my $file (@corefiles) {
# HP-UX (at least) needs to maintain execute permissions
# on dynamically-loadable libraries. So we do it for all.
- copy_if_diff($file,"$installarchlib/CORE/$file")
- and chmod($file =~ /\.(so|\Q$dlext\E)$/ ? 0555 : 0444,
- "$installarchlib/CORE/$file");
+ if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
+ if ($file =~ /\.(so|\Q$dlext\E)$/) {
+ chmod(0555, "$installarchlib/CORE/$file");
+ strip("-S", "$installarchlib/CORE/$file") if $^O =~ /^(rhapsody)$;
+ } else {
+ chmod(0444, "$installarchlib/CORE/$file");
+ }
+ }
}
# Install main perl executables
1;
}
}
+
+sub strip
+{
+ my(@args) = @_;
+
+ my @opts;
+ while (@args && $args[0] =~ /^(-\w+)$/) {
+ push @opts, shift @args;
+ }
+
+ foreach my $file (@args) {
+ if (-f $file) {
+ print STDERR " strip $file\n";
+ system("strip", @opts, $file);
+ } else {
+ print STDERR "# file '$file' skipped\n";
+ }
+ }
+}
+
#ifdef USE_PERL_SBRK
-# if defined(__MACHTEN_PPC__) || defined(__NeXT__)
+# if defined(__MACHTEN_PPC__) || defined(NeXT) || defined(__NeXT__)
# define PERL_SBRK_VIA_MALLOC
/*
* MachTen's malloc() returns a buffer aligned on a two-byte boundary.
return 255;
#endif
-#if defined(NeXT) && defined(__DYNAMIC__)
+#if defined(__DYNAMIC__) && (defined(NeXT) || defined(__NeXT__))
_dyld_lookup_and_bind
("__environ", (unsigned long *) &environ_pointer, NULL);
#endif /* environ */
/* Configure already sets Direntry_t */
#if defined(I_DIRENT)
# include <dirent.h>
-# if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
+ /* NeXT needs dirent + sys/dir.h */
+# if defined(I_SYS_DIR) && (defined(NeXT) || defined(__NeXT__))
# include <sys/dir.h>
# endif
#else
# else
# ifdef I_MACH_CTHREADS
# include <mach/cthreads.h>
-# if defined(__NeXT__) && defined(PERL_POLLUTE_MALLOC)
+# if (defined(NeXT) || defined(__NeXT__)) && defined(PERL_POLLUTE_MALLOC)
# define MUTEX_INIT_CALLS_MALLOC
# endif
typedef cthread_t perl_os_thread;
#endif
#ifndef __cplusplus
-# ifdef __NeXT__ /* or whatever catches all NeXTs */
+# if defined(NeXT) || defined(__NeXT__) /* or whatever catches all NeXTs */
char *crypt (); /* Maybe more hosts will need the unprototyped version */
# else
# if !defined(WIN32) || !defined(HAVE_DES_FCRYPT)
char *crypt _((const char*, const char*));
# endif /* !WIN32 && !HAVE_CRYPT_SOURCE */
-# endif /* !__NeXT__ */
+# endif /* !NeXT && !__NeXT__ */
# ifndef DONT_DECLARE_STD
# ifndef getenv
char *getenv _((const char*));
#endif
#endif
-
/* _ (for $_) must be first in the following list (DEFSV requires it) */
#define THREADSV_NAMES "_123456789&`'+/.,\\\";^-%=|~:\001\005!@"
-/* VMS doesn't use environ array and NeXT has problems with crt0.o globals */
-#if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__))
-#if !defined(DONT_DECLARE_STD) \
- || (defined(__svr4__) && defined(__GNUC__) && defined(sun)) \
- || defined(__sgi) || defined(__DGUX)
-extern char ** environ; /* environment variables supplied via exec */
-#endif
-#else
-# if defined(NeXT) && defined(__DYNAMIC__)
-
-# include <mach-o/dyld.h>
+/* NeXT has problems with crt0.o globals */
+#if defined(__DYNAMIC__) && \
+ (defined(NeXT) || defined(__NeXT__) || defined(__APPLE__))
+# if defined(NeXT) || defined(__NeXT)
+# include <mach-o/dyld.h>
+# define environ (*environ_pointer)
EXT char *** environ_pointer;
-# define environ (*environ_pointer)
+# else
+# if defined(__APPLE__)
+# include <crt_externs.h> /* for the env array */
+# define environ (*_NSGetEnviron())
+# endif
# endif
-#endif /* environ processing */
-
+#else
+ /* VMS and some other platforms don't use the environ array */
+# if !defined(VMS) || \
+ !defined(DONT_DECLARE_STD) || \
+ (defined(__svr4__) && defined(__GNUC__) && defined(sun)) || \
+ defined(__sgi) || \
+ defined(__DGUX)
+extern char ** environ; /* environment variables supplied via exec */
+# endif
+#endif
/* handy constants */
EXTCONST char PL_warn_uninit[]
/* If SELECT_MIN_BITS is greater than one we most probably will want
* to align the sizes with SELECT_MIN_BITS/8 because for example
* in many little-endian (Intel, Alpha) systems (Linux, OS/2, Digital
- * UNIX, Solaris, NeXT) the smallest quantum select() operates on
- * (sets bit) is 32 bits. */
+ * UNIX, Solaris, NeXT, Rhapsody) the smallest quantum select() operates
+ * on (sets/tests/clears bits) is 32 bits. */
growsize = maxlen + (SELECT_MIN_BITS/8 - (maxlen % (SELECT_MIN_BITS/8)));
# else
growsize = sizeof(fd_set);
print "ok 37\n";
}
else {
- unless (open(tty,"/dev/tty")) {
- print STDERR "Can't open /dev/tty--run t/TEST outside of make.\n";
+ my $TTY = "/dev/tty";
+
+ $TTY = "/dev/ttyp0" if $^O eq 'rhapsody';
+
+ if (defined $TTY) {
+ unless (open(TTY, $TTY)) {
+ print STDERR "Can't open $TTY--run t/TEST outside of make.\n";
+ }
+ if (-t TTY) {print "ok 36\n";} else {print "not ok 36\n";}
+ if (-c TTY) {print "ok 37\n";} else {print "not ok 37\n";}
+ close(TTY);
}
- if (-t tty) {print "ok 36\n";} else {print "not ok 36\n";}
- if (-c tty) {print "ok 37\n";} else {print "not ok 37\n";}
- close(tty);
}
- if (! -t tty) {print "ok 38\n";} else {print "not ok 38\n";}
+ if (! -t TTY) {print "ok 38\n";} else {print "not ok 38\n";}
if (-t) {print "ok 39\n";} else {print "not ok 39\n";}
}
else {
exit(1);
}
+#if defined(__APPLE_CC__)
+__private_extern__ /* warn() conflicts with libc */
+#endif
void
warn(char *pat,...)
{