Merge pull request #184 from rofl0r/no_pthread

allow pspsdk to be built without pthread-embedded
This commit is contained in:
Wouter Wijsman
2024-03-10 11:07:35 +01:00
committed by GitHub
4 changed files with 17 additions and 3 deletions

View File

@@ -33,6 +33,8 @@ AC_CHECK_LIB([z], [compress])
AC_C_CONST
AC_C_BIGENDIAN
AC_ARG_WITH(pthread, [ --with-pthread build with pthread support], [], [with_pthread=yes])
# Checks for library functions.
AC_FUNC_MEMCMP
AC_CHECK_FUNCS([getcwd strchr])
@@ -72,6 +74,10 @@ AC_SUBST(PSPSDK_LIBDIR)
# CFLAGS and CXXFLAGS used to build pspsdk libraries.
PSPSDK_CFLAGS="$CFLAGS -mno-gpopt -Wall"
PSPSDK_CXXFLAGS="$PSPSDK_CFLAGS -fno-exceptions -fno-rtti"
if test "$with_pthread" = no ; then
PSPSDK_CFLAGS="$PSPSDK_CFLAGS -DPSP_WITHOUT_PTHREAD"
fi
AC_SUBST(PSPSDK_CFLAGS)
AC_SUBST(PSPSDK_CXXFLAGS)

View File

@@ -29,7 +29,7 @@ void __deinit_mutex();
extern int sce_newlib_nocreate_thread_in_start __attribute__((weak));
#ifdef F___libpthreadglue_init
#if defined(F___libpthreadglue_init) && !defined(PSP_WITHOUT_PTHREAD)
/* Note: This function is being called from __libcglue_init.
* It is a weak function because can be override by user program
*/
@@ -38,6 +38,8 @@ void __libpthreadglue_init()
{
pthread_init();
}
#elif defined(PSP_WITHOUT_PTHREAD)
#define __libpthreadglue_init() do{}while(0)
#else
void __libpthreadglue_init();
#endif
@@ -113,4 +115,4 @@ void exit(int retval)
{
_exit(retval);
}
#endif
#endif

View File

@@ -9,6 +9,7 @@
*
*/
#ifndef PSP_WITHOUT_PTHREAD
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
@@ -786,3 +787,5 @@ int pte_osAtomicIncrement(int *pdest)
return val;
}
#endif
#endif /* PSP_WITHOUT_PTHREAD */

View File

@@ -9,6 +9,7 @@
*
*/
#ifndef PSP_WITHOUT_PTHREAD
#include <stdio.h>
#include <stdlib.h>
@@ -251,4 +252,6 @@ pte_osResult pte_osTlsFree(unsigned int index)
{
return pteTlsFree(index);
}
#endif
#endif
#endif /* PSP_WITHOUT_PTHREAD */