Index: config.sub ================================================================== --- config.sub +++ config.sub @@ -732,10 +732,14 @@ ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; + psp) + basic_machine=mipsallegrexel-psp + os=-elf + ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,7 +1,12 @@ AC_INIT(ObjFW, 0.4-dev, js@webkeks.org) AC_CONFIG_SRCDIR(src) + +AS_IF([test x"$host" = x"psp"], [ + LIBS="$LIBS -lc -lpspkernel -lpspuser" + LIBS="$LIBS -lpspnet -lpspnet_inet -lpspnet_resolver" +]) AC_CANONICAL_HOST AC_LANG([Objective C]) AC_PROG_OBJC @@ -114,26 +119,26 @@ ObjFW-RT) AC_DEFINE(OF_OBJFW_RUNTIME, 1, [Whether we use the ObjFW runtime]) AC_SUBST(GNU_RUNTIME, "-fgnu-runtime") OBJCFLAGS="$OBJCFLAGS -fgnu-runtime" - LIBS="$LIBS -lobjfw-rt" + LIBS="-lobjfw-rt $LIBS" ;; Apple) AC_DEFINE(OF_APPLE_RUNTIME, 1, [Whether we use the Apple ObjC runtime]) - LIBS="$LIBS -lobjc" + LIBS="-lobjc $LIBS" ;; GNU) AC_DEFINE(OF_GNU_RUNTIME, 1, [Whether we use the GNU ObjC runtime]) - LIBS="$LIBS -lobjc" + LIBS="-lobjc $LIBS" ;; "old GNU") AC_DEFINE(OF_OLD_GNU_RUNTIME, 1, [Whether we use the old GNU ObjC runtime]) - LIBS="$LIBS -lobjc" + LIBS="-lobjc $LIBS" ;; *) AC_MSG_RESULT(none) AC_MSG_ERROR(No ObjC runtime found! Please install ObjFW-RT!) ;; Index: src/OFExceptions.m ================================================================== --- src/OFExceptions.m +++ src/OFExceptions.m @@ -46,11 +46,11 @@ # define GET_AT_ERRNO errno # endif # define GET_SOCK_ERRNO errno # define ERRFMT "Error string was: %s" # define ERRPARAM strerror(errNo) -# ifndef HAVE_THREADSAFE_GETADDRINFO +# if !defined(HAVE_THREADSAFE_GETADDRINFO) && !defined(_PSP) # define AT_ERRPARAM hstrerror(errNo) # else # define AT_ERRPARAM strerror(errNo) # endif #else Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -178,11 +178,13 @@ * \param src The path to the file of which should be linked as a string * \param dest The path to where the file should be linked as a string */ + (void)linkFileAtPath: (OFString*)src toPath: (OFString*)dest; +#endif +#if !defined(_WIN32) && !defined(_PSP) /** * Symlinks a file. * * Not available on Windows. * Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -592,11 +592,13 @@ if (link([src cString], [dest cString]) != 0) @throw [OFLinkFailedException newWithClass: self sourcePath: src destinationPath: dest]; } +#endif +#if !defined(_WIN32) && !defined(_PSP) + (void)symlinkFileAtPath: (OFString*)src toPath: (OFString*)dest { if ([self directoryExistsAtPath: dest]) { OFString *filename = [self lastComponentOfPath: src]; Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -103,11 +103,13 @@ freeaddrinfo(res0); #else BOOL connected = NO; struct hostent *he; +# ifndef _PSP struct servent *se; +# endif struct sockaddr_in addr; uint16_t port; char **ip; # ifdef OF_THREADS OFDataArray *addrlist; @@ -125,13 +127,15 @@ newWithClass: isa node: node service: service]; } +# ifndef _PSP if ((se = getservbyname([service cString], "tcp")) != NULL) port = se->s_port; else { +# endif @try { intmax_t p = [service decimalValue]; if (p < 1 || p > 65535) @throw [OFOutOfRangeException @@ -153,11 +157,13 @@ [addrlist release]; [mutex unlock]; # endif @throw e; } +# ifndef _PSP } +# endif memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = port; @@ -250,11 +256,13 @@ } freeaddrinfo(res); #else struct hostent *he; +# ifndef _PSP struct servent *se; +# endif struct sockaddr_in addr; uint16_t port; # ifdef OF_THREADS [mutex lock]; @@ -268,13 +276,15 @@ newWithClass: isa node: node service: service]; } +# ifndef _PSP if ((se = getservbyname([service cString], "tcp")) != NULL) port = se->s_port; else { +# endif @try { intmax_t p = [service decimalValue]; if (p < 1 || p > 65535) @throw [OFOutOfRangeException @@ -294,11 +304,13 @@ # ifdef OF_THREADS [mutex unlock]; # endif @throw e; } +# ifndef _PSP } +# endif memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = port; Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -23,10 +23,14 @@ # define __STDC_CONSTANT_MACROS #endif #include #include + +#ifdef _PSP +# define INTMAX_MAX LONG_LONG_MAX +#endif #ifdef __GNUC__ # define OF_INLINE inline __attribute__((always_inline)) # define OF_LIKELY(cond) __builtin_expect(!!(cond), 1) # define OF_UNLIKELY(cond) __builtin_expect(!!(cond), 0)