mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	This patch partly (some stuff went in already) ports Python to Monterey.
- Fix bug in thread_pthread.h::PyThread_get_thread_ident() where sizeof(pthread) < sizeof(long). - Add 'configure' for: - SIZEOF_PTHREAD is pthread_t can be included via <pthread.h> - setting Monterey system name - appropriate CC,LINKCC,LDSHARED,OPT, and CCSHARED for Monterey - Add section in README for Monterey build
This commit is contained in:
		
							parent
							
								
									b745a0481b
								
							
						
					
					
						commit
						635f6fb0e9
					
				
					 6 changed files with 466 additions and 318 deletions
				
			
		|  | @ -171,6 +171,13 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) | ||||||
| 	return success != 0 ? 0 : 1; | 	return success != 0 ? 0 : 1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* XXX This implementation is considered (to quote Tim Peters) "inherently
 | ||||||
|  |    hosed" because: | ||||||
|  |      - It does not guanrantee the promise that a non-zero integer is returned. | ||||||
|  |      - The cast to long is inherently unsafe. | ||||||
|  |      - It is not clear that the 'volatile' (for AIX?) and ugly casting in the | ||||||
|  |        latter return statement (for Alpha OSF/1) are any longer necessary. | ||||||
|  | */ | ||||||
| long  | long  | ||||||
| PyThread_get_thread_ident(void) | PyThread_get_thread_ident(void) | ||||||
| { | { | ||||||
|  | @ -179,7 +186,11 @@ PyThread_get_thread_ident(void) | ||||||
| 		PyThread_init_thread(); | 		PyThread_init_thread(); | ||||||
| 	/* Jump through some hoops for Alpha OSF/1 */ | 	/* Jump through some hoops for Alpha OSF/1 */ | ||||||
| 	threadid = pthread_self(); | 	threadid = pthread_self(); | ||||||
|  | #if SIZEOF_PTHREAD_T <= SIZEOF_LONG | ||||||
|  | 	return (long) threadid; | ||||||
|  | #else | ||||||
| 	return (long) *(long *) &threadid; | 	return (long) *(long *) &threadid; | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void  | static void  | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								README
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								README
									
										
									
									
									
								
							|  | @ -307,6 +307,14 @@ OS/2:   If you are running Warp3 or Warp4 and have IBM's VisualAge C/C++ | ||||||
|         and type NMAKE.  Threading and sockets are supported by default |         and type NMAKE.  Threading and sockets are supported by default | ||||||
|         in the resulting binaries of PYTHON15.DLL and PYTHON.EXE. |         in the resulting binaries of PYTHON15.DLL and PYTHON.EXE. | ||||||
| 
 | 
 | ||||||
|  | Monterey (64-bit AIX): | ||||||
|  |     The current Monterey C compiler (Visual Age) uses the OBJECT_MODE={32|64} | ||||||
|  |     environment variable to set the compilation mode to either 32-bit or | ||||||
|  |     64-bit (32-bit mode is the default). Presumably you want 64-bit | ||||||
|  |     compilation mode for this 64-bit OS. As a result you must first set | ||||||
|  |     OBJECT_MODE=64 in you environment before configuring (./configure) or | ||||||
|  |     building (make) Python on Monterey. | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| Configuring threads | Configuring threads | ||||||
| ------------------- | ------------------- | ||||||
|  |  | ||||||
|  | @ -157,6 +157,9 @@ | ||||||
| /* The number of bytes in a time_t. */ | /* The number of bytes in a time_t. */ | ||||||
| #undef SIZEOF_TIME_T | #undef SIZEOF_TIME_T | ||||||
| 
 | 
 | ||||||
|  | /* The number of bytes in a pthread_t. */ | ||||||
|  | #undef SIZEOF_PTHREAD_T | ||||||
|  | 
 | ||||||
| /* Defined to enable large file support when an off_t is bigger than a long
 | /* Defined to enable large file support when an off_t is bigger than a long
 | ||||||
|    and long long is available and at least as big as an off_t. You may need |    and long long is available and at least as big as an off_t. You may need | ||||||
|    to add some flags for configuration and compilation to enable this mode. |    to add some flags for configuration and compilation to enable this mode. | ||||||
|  |  | ||||||
|  | @ -216,6 +216,9 @@ | ||||||
| /* The number of bytes in a time_t. */ | /* The number of bytes in a time_t. */ | ||||||
| #undef SIZEOF_TIME_T | #undef SIZEOF_TIME_T | ||||||
| 
 | 
 | ||||||
|  | /* The number of bytes in a pthread_t. */ | ||||||
|  | #undef SIZEOF_PTHREAD_T | ||||||
|  | 
 | ||||||
| /* Defined to enable large file support when an off_t is bigger than a long
 | /* Defined to enable large file support when an off_t is bigger than a long
 | ||||||
|    and long long is available and at least as big as an off_t. You may need |    and long long is available and at least as big as an off_t. You may need | ||||||
|    to add some flags for configuration and compilation to enable this mode. |    to add some flags for configuration and compilation to enable this mode. | ||||||
|  |  | ||||||
							
								
								
									
										42
									
								
								configure.in
									
										
									
									
									
								
							
							
						
						
									
										42
									
								
								configure.in
									
										
									
									
									
								
							|  | @ -43,7 +43,7 @@ AC_MSG_CHECKING(MACHDEP) | ||||||
| if test -z "$MACHDEP" | if test -z "$MACHDEP" | ||||||
| then | then | ||||||
| 	ac_sys_system=`uname -s` | 	ac_sys_system=`uname -s` | ||||||
| 	if test "$ac_sys_system" = "AIX" ; then | 	if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then | ||||||
| 		ac_sys_release=`uname -v` | 		ac_sys_release=`uname -v` | ||||||
| 	else | 	else | ||||||
| 		ac_sys_release=`uname -r` | 		ac_sys_release=`uname -r` | ||||||
|  | @ -148,6 +148,9 @@ AC_ARG_WITH(gcc, [  --without-gcc                   never use gcc], [ | ||||||
| 			;; | 			;; | ||||||
| 		esac | 		esac | ||||||
| 		;; | 		;; | ||||||
|  |     Monterey*) | ||||||
|  |         RANLIB=: | ||||||
|  |         without_gcc=;; | ||||||
| 	*)	without_gcc=no;; | 	*)	without_gcc=no;; | ||||||
| 	esac]) | 	esac]) | ||||||
| AC_MSG_RESULT($without_gcc) | AC_MSG_RESULT($without_gcc) | ||||||
|  | @ -207,6 +210,10 @@ BeOS*) | ||||||
| 	case $CC in | 	case $CC in | ||||||
| 	cc) CC=cc;; | 	cc) CC=cc;; | ||||||
| 	esac;; | 	esac;; | ||||||
|  | Monterey*) | ||||||
|  |     case $CC in | ||||||
|  |     cc) CC="$CC -Wl,-Bexport";; | ||||||
|  |     esac;; | ||||||
| esac | esac | ||||||
| 
 | 
 | ||||||
| # LDLIBRARY is the name of the library to link against (as opposed to the | # LDLIBRARY is the name of the library to link against (as opposed to the | ||||||
|  | @ -236,6 +243,8 @@ then | ||||||
| 	   LDLIBRARY='libpython$(VERSION).so';; | 	   LDLIBRARY='libpython$(VERSION).so';; | ||||||
| 	dgux*) | 	dgux*) | ||||||
| 	   LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";; | 	   LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";; | ||||||
|  | 	Monterey64*) | ||||||
|  | 	   LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";; | ||||||
| 	*) LINKCC="\$(PURIFY) \$(CC)";; | 	*) LINKCC="\$(PURIFY) \$(CC)";; | ||||||
| 	esac | 	esac | ||||||
| fi | fi | ||||||
|  | @ -308,6 +317,11 @@ then | ||||||
| 	esac | 	esac | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  | # The current (beta) Monterey compiler dies with optimizations | ||||||
|  | case $ac_sys_system in | ||||||
|  | Monterey*) OPT="";; | ||||||
|  | esac | ||||||
|  | 
 | ||||||
| if test "$ac_arch_flags" | if test "$ac_arch_flags" | ||||||
| then | then | ||||||
| 	OPT="$OPT $ac_arch_flags" | 	OPT="$OPT $ac_arch_flags" | ||||||
|  | @ -450,6 +464,30 @@ AC_MSG_RESULT($ac_cv_sizeof_time_t) | ||||||
| AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t) | AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | # if have pthread_t then define SIZEOF_PTHREAD_T | ||||||
|  | AC_MSG_CHECKING(for pthread_t) | ||||||
|  | have_pthread_t=no | ||||||
|  | AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = (pthread_t)0;], have_pthread_t=yes) | ||||||
|  | AC_MSG_RESULT($have_pthread_t) | ||||||
|  | if test "$have_pthread_t" = yes ; then | ||||||
|  |   # AC_CHECK_SIZEOF() doesn't include <pthread.h>. | ||||||
|  |   AC_MSG_CHECKING(size of pthread_t) | ||||||
|  |   AC_CACHE_VAL(ac_cv_sizeof_pthread_t, | ||||||
|  |   [AC_TRY_RUN([#include <stdio.h> | ||||||
|  |   #include <pthread.h> | ||||||
|  |   main() | ||||||
|  |   { | ||||||
|  |     FILE *f=fopen("conftestval", "w"); | ||||||
|  |     if (!f) exit(1); | ||||||
|  |     fprintf(f, "%d\n", sizeof(pthread_t)); | ||||||
|  |     exit(0); | ||||||
|  |   }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0) | ||||||
|  |   ]) | ||||||
|  |   AC_MSG_RESULT($ac_cv_sizeof_pthread_t) | ||||||
|  |   AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t) | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| # Minor variations in building a framework between NextStep versions 4 and 5 | # Minor variations in building a framework between NextStep versions 4 and 5 | ||||||
| AC_SUBST(LIBTOOL_CRUFT) | AC_SUBST(LIBTOOL_CRUFT) | ||||||
| case $ac_sys_system/$ac_sys_release in | case $ac_sys_system/$ac_sys_release in | ||||||
|  | @ -547,6 +585,7 @@ then | ||||||
| 			LDSHARED="ld -Bshareable" | 			LDSHARED="ld -Bshareable" | ||||||
| 		fi;; | 		fi;; | ||||||
| 	SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; | 	SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; | ||||||
|  | 	Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";; | ||||||
| 	*)	LDSHARED="ld";; | 	*)	LDSHARED="ld";; | ||||||
| 	esac | 	esac | ||||||
| fi | fi | ||||||
|  | @ -566,6 +605,7 @@ then | ||||||
| 	FreeBSD*|OpenBSD*) CCSHARED="-fpic";; | 	FreeBSD*|OpenBSD*) CCSHARED="-fpic";; | ||||||
| 	NetBSD*) CCSHARED="-fPIC";; | 	NetBSD*) CCSHARED="-fPIC";; | ||||||
| 	SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; | 	SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; | ||||||
|  | 	Monterey*) CCSHARED="-G";; | ||||||
| 	IRIX*/6*)  case $CC in | 	IRIX*/6*)  case $CC in | ||||||
| 		   *gcc*) CCSHARED="-shared";; | 		   *gcc*) CCSHARED="-shared";; | ||||||
| 		   *) CCSHARED="";; | 		   *) CCSHARED="";; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Trent Mick
						Trent Mick