make build work on Mac OS 10.6

svn: r15927
This commit is contained in:
Matthew Flatt 2009-09-09 01:06:30 +00:00
parent 390145821a
commit 8958f1893a
6 changed files with 134 additions and 26 deletions

View File

@ -43,7 +43,9 @@
[link-edit-pos #f]
[link-edit-addr 0]
[link-edit-offset 0]
[link-edit-len 0])
[link-edit-len 0]
[dyld-info-pos #f]
[dyld-info-offs #f])
;; (printf "~a cmds, length 0x~x\n" cnt cmdssz)
(read-ulong p)
(let loop ([cnt cnt])
@ -98,6 +100,20 @@
[(#x16)
;; 2-level hints table
(set! hints-pos pos)]
[(#x22 #x80000022)
;; LC_DYLD_INFO
(let ([rebaseoff (read-ulong p)]
[rebasesize (read-ulong p)]
[bindoff (read-ulong p)]
[bindsize (read-ulong p)]
[weakbindoff (read-ulong p)]
[weakbindsize (read-ulong p)]
[lazybindoff (read-ulong p)]
[lazybindsize (read-ulong p)]
[exportbindoff (read-ulong p)]
[exportbindsize (read-ulong p)])
(set! dyld-info-pos pos)
(set! dyld-info-offs (vector bindoff weakbindoff lazybindoff exportbindoff)))]
[else
(void)])
(file-position p (+ pos sz))
@ -181,7 +197,17 @@
(file-position p (+ hints-pos 8))
(let ([hints-offset (read-ulong p)])
(file-position out (+ hints-pos 8))
(write-ulong (+ hints-offset outlen) out))))
(write-ulong (+ hints-offset outlen) out)))
;; Shift dyld-info offs
(when dyld-info-pos
(let ([update (lambda (n)
(unless (< (vector-ref dyld-info-offs n) out-offset)
(file-position out (+ dyld-info-pos 56 16 (* n 8)))
(write-ulong (+ (vector-ref dyld-info-offs n) outlen) out)))])
(update 0)
(update 1)
(update 2)
(update 3))))
;; Write segdata to former link-data offset:
(file-position out out-offset)
(display segdata out)

View File

@ -45,8 +45,8 @@
(define-struct tok (n line file) (make-inspector))
(define-struct (sysheader-tok tok) ())
(define-struct (seq tok) (close in))
(define-struct (parens seq) ())
(define-struct (seq tok) (close in) (make-inspector))
(define-struct (parens seq) () (make-inspector))
(define-struct (brackets seq) ())
(define-struct (braces seq) ())
(define-struct (callstage-parens parens) ())
@ -830,9 +830,9 @@
\| \|\| & && |:| ? % + - * / ^ >> << ~
#csXFORM_OK_PLUS #csXFORM_OK_MINUS #csXFORM_TRUST_PLUS #csXFORM_TRUST_MINUS
= >>= <<= ^= += *= /= -= %= \|= &= ++ --
return sizeof if for while else switch case
return if for while else switch case
asm __asm __asm__ __volatile __volatile__ volatile __extension__
__typeof
__typeof sizeof __builtin_object_size
;; These don't act like functions:
setjmp longjmp _longjmp scheme_longjmp_setjmp scheme_mz_longjmp scheme_jit_longjmp
@ -849,7 +849,7 @@
isalpha isdigit isspace tolower toupper
fread fwrite socket fcntl setsockopt connect send recv close
__builtin_next_arg __builtin_saveregs
__builtin_constant_p __builtin_memset
__builtin_constant_p
__builtin___CFStringMakeConstantString
__error __errno_location __toupper __tolower
__attribute__ __mode__ ; not really functions in gcc
@ -867,13 +867,26 @@
(hash-table-put! ht s #f))
non-functions)
ht))
(define args-unevaled '(sizeof __typeof __builtin_object_size))
(define args-unevaled-table
(let ([ht (make-hash-table)])
(for-each (lambda (s)
(hash-table-put! ht s #t))
args-unevaled)
ht))
(define non-gcing-builtin-functions
;; The following don't need wrappers, but we need to check for
;; nested function calls because it takes more than one argument:
(append
'(memcpy memmove memcmp
strcmp strcoll strcpy _mzstrcpy strcat memset
'(memcpy memmove memcmp memset
__builtin___memmove_chk __inline_memmove_chk
__builtin___memcpy_chk __inline_memcpy_chk
__builtin___memset_chk __inline_memset_chk
__builtin___memcmp_chk __inline_memcmp_chk
strcmp strcoll strcpy _mzstrcpy strcat
__builtin_memset
printf sprintf vsprintf vprintf
strncmp
read write)
@ -2930,14 +2943,14 @@
(lookup-pointer-type (tok-n (car e)))
(assq (tok-n (car e)) c++-classes))))
(define (looks-like-call? e-)
(define (looks-like-call? e- nf?)
;; e- is a reversed expression
(and (pair? e-)
(parens? (car e-))
;; Something precedes
(not (null? (cdr e-)))
;; Not an assignment, sizeof, if, string
(hash-table-get non-functions-table (tok-n (cadr e-)) (lambda () #t))
(or nf? (hash-table-get non-functions-table (tok-n (cadr e-)) #t))
(not (string? (tok-n (cadr e-))))
;; Look back one more for if, etc. if preceding is paren
(not (and (parens? (cadr e-))
@ -3023,7 +3036,7 @@
(if (null? (cdr el))
e-
(cdr e-)))]) ; skip comma
(and (looks-like-call? e-)
(and (looks-like-call? e- #f)
(cast-or-call e-
(lambda () #f)
(lambda ()
@ -3265,14 +3278,14 @@
live-vars
converted-sub?)]
[else (rloop (cdr result) (cons (car result) l))]))]
[(looks-like-call? e-)
[(looks-like-call? e- #f)
;; Looks like a function call, maybe a cast:
(cast-or-call
e-
(lambda ()
;; It's a cast:
(let-values ([(v live-vars)
(convert-paren-interior (car e-) vars &-vars c++-class live-vars complain-not-in #f)])
(convert-paren-interior (car e-) vars &-vars c++-class live-vars complain-not-in memcpy?)])
(loop (cddr e-)
(list* (cadr e-) v result)
live-vars
@ -3335,7 +3348,7 @@
[(sub-memcpy?)
;; memcpy, etc. call?
(and (pair? (cdr e-))
(hash-table-get non-gcing-functions (tok-n (cadr e-)) (lambda () #f)))]
(hash-table-get non-gcing-functions (tok-n (cadr e-)) #f))]
[(args live-vars)
(convert-paren-interior args vars &-vars
c++-class
@ -3469,6 +3482,9 @@
(or converted-sub?
(null? rest-)
(not (memq (tok-n (car rest-)) '(return else)))))))))))]
[(and (looks-like-call? e- #t)
(hash-table-get args-unevaled-table (tok-n (cadr e-)) #f))
(loop (cddr e-) (cons (cadr e-) (cons (car e-) result)) live-vars converted-sub?)]
[(eq? 'goto (tok-n (car e-)))
;; Goto - assume all vars are live
(loop (cdr e-) (cons (car e-) result)
@ -3662,7 +3678,7 @@
(or complain-not-in
(and (brackets? (car e-))
"array access"))
#f)])
memcpy?)])
(loop (cdr e-) (cons v result) live-vars #t)))]
[(and (assq (tok-n (car e-)) vars)
(not (assq (tok-n (car e-)) (live-var-info-vars live-vars))))

37
src/configure vendored
View File

@ -2357,6 +2357,12 @@ fi
COMPFLAGS=""
ORIG_CC="${CC}"
ORIG_CPP="${CPP}"
ORIG_CXX="${CXX}"
ORIG_CXXCPP="${CXXCPP}"
SUB_CONFIGURE_EXTRAS=""
if test "${enable_oskit}" = "no" ; then
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@ -4319,7 +4325,7 @@ _ACEOF
eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
done
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
for ac_extension in a so sl; do
for ac_extension in a so sl dylib la dll; do
if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
test -f "$ac_im_libdir/libX11.$ac_extension"; then
ac_im_usrlibdir=$ac_im_libdir; break
@ -4472,7 +4478,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
# Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
for ac_extension in a so sl dylib la dll; do
if test -r "$ac_dir/libX11.$ac_extension"; then
ac_x_libraries=$ac_dir
break 2
@ -5766,6 +5772,7 @@ else
WBUILD="sh \$(PLTSRCDIR)/wxxt/src/XWidgets/dummy.wbuild"
fi
ORIG_CC_FOR_BUILD="${CC_FOR_BUILD}"
if test "$CC_FOR_BUILD" = "" ; then
CC_FOR_BUILD="$CC"
fi
@ -5925,6 +5932,27 @@ case $OS in
fi
fi
# Force 32-bit build, for now
if test "${ORIG_CC}" = "" ; then
CC="${CC} -m32"
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CC="'"'"${CC}"'"'
fi
if test "${ORIG_CPP}" = "" ; then
CPP="${CPP} -m32"
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CPP="'"'"${CPP}"'"'
fi
if test "${ORIG_CXX}" = "" ; then
CXX="${CXX} -m32"
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CXX="'"'"${CXX}"'"'
fi
if test "${ORIG_CXXCPP}" = "" ; then
CXXCPP="${CXXCPP} -m32"
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CPPCXX="'"'"${CPPCXX}"'"'
fi
if test "${ORIG_CC_FOR_BUILD}" = "" ; then
CC_FOR_BUILD="${CC_FOR_BUILD} -m32"
fi
if test "${enable_quartz}" = "yes" ; then
WXVARIANT="wx_mac"
MROPTIONS="$MROPTIONS -fpascal-strings"
@ -6525,7 +6553,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
ac_cv_header_stdc=no
fi
rm -f conftest*
rm -f -r conftest*
fi
@ -6546,7 +6574,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
ac_cv_header_stdc=no
fi
rm -f conftest*
rm -f -r conftest*
fi
@ -12022,6 +12050,7 @@ else
FOREIGNTARGET="foreign-nothing"
MZOPTIONS="$MZOPTIONS -DDONT_USE_FOREIGN"
fi
ac_configure_args="$ac_configure_args$SUB_CONFIGURE_EXTRAS"
if test "${enable_mred}" = "yes" ; then
if test "${enable_quartz}" = "yes" ; then

View File

@ -410,6 +410,12 @@ fi
COMPFLAGS=""
ORIG_CC="${CC}"
ORIG_CPP="${CPP}"
ORIG_CXX="${CXX}"
ORIG_CXXCPP="${CXXCPP}"
SUB_CONFIGURE_EXTRAS=""
if test "${enable_oskit}" = "no" ; then
AC_PROG_CC
AC_PROG_CPP
@ -495,6 +501,7 @@ else
WBUILD="sh \$(PLTSRCDIR)/wxxt/src/XWidgets/dummy.wbuild"
fi
ORIG_CC_FOR_BUILD="${CC_FOR_BUILD}"
if test "$CC_FOR_BUILD" = "" ; then
CC_FOR_BUILD="$CC"
fi
@ -654,6 +661,27 @@ case $OS in
fi
fi
# Force 32-bit build, for now
if test "${ORIG_CC}" = "" ; then
CC="${CC} -m32"
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CC="'"'"${CC}"'"'
fi
if test "${ORIG_CPP}" = "" ; then
CPP="${CPP} -m32"
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CPP="'"'"${CPP}"'"'
fi
if test "${ORIG_CXX}" = "" ; then
CXX="${CXX} -m32"
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CXX="'"'"${CXX}"'"'
fi
if test "${ORIG_CXXCPP}" = "" ; then
CXXCPP="${CXXCPP} -m32"
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CPPCXX="'"'"${CPPCXX}"'"'
fi
if test "${ORIG_CC_FOR_BUILD}" = "" ; then
CC_FOR_BUILD="${CC_FOR_BUILD} -m32"
fi
if test "${enable_quartz}" = "yes" ; then
WXVARIANT="wx_mac"
MROPTIONS="$MROPTIONS -fpascal-strings"
@ -1455,6 +1483,7 @@ else
FOREIGNTARGET="foreign-nothing"
MZOPTIONS="$MZOPTIONS -DDONT_USE_FOREIGN"
fi
ac_configure_args="$ac_configure_args$SUB_CONFIGURE_EXTRAS"
if test "${enable_mred}" = "yes" ; then
if test "${enable_quartz}" = "yes" ; then

View File

@ -2148,7 +2148,7 @@ Scheme_Object *scheme_tl_id_sym(Scheme_Env *env, Scheme_Object *id, Scheme_Objec
/* The dot here is significant; it might gets stripped away when
printing the symbol */
sprintf(buf + len, ".%d", env->id_counter);
sprintf(buf XFORM_OK_PLUS len, ".%d", env->id_counter);
best_match = scheme_intern_exact_parallel_symbol(buf, strlen(buf));

View File

@ -136,11 +136,17 @@ static CGSize sizes_buf[QUICK_UBUF_SIZE];
static CGFontRef prev_cgf;
static short cgf_txFont, cgf_txFace;
/* This undocumented Quartz function controls how fonts are anti-aliased.
(I discovered it by running `nm' on the "QD" framework.)
Mode 0 is normal anti-aliasing, mode 1 is no anti-aliasing, and mode 2 is
4-bit pixel-aligned anti-aliasing (the old QuickDraw standard). */
#if 0
/* This undocumented Quartz function used to control how fonts are
anti-aliased. (I discovered it by running `nm' on the "QD" framework.)
Mode 0 was normal anti-aliasing, mode 1 was no anti-aliasing, and mode 2 was
4-bit pixel-aligned anti-aliasing (the old QuickDraw standard).
But with 10.5, mode 2 stopped working; with 10.6, this function was
replaced by CGContextSetFontRenderingStyle --- which is also undocumented,
and I didn't manage to guess how it works, and it's probably not in older
versions anyway. */
extern "C" void CGContextSetFontRenderingMode(CGContextRef cg, int v);
#endif
//-----------------------------------------------------------------------------
@ -309,8 +315,10 @@ void wxCanvasDC::DrawText(const char* text, double x, double y, Bool combine, Bo
if (smoothing == wxSMOOTHING_OFF)
CGContextSetShouldAntialias(cg, FALSE);
#if 0
else if (smoothing == wxSMOOTHING_PARTIAL)
CGContextSetFontRenderingMode(cg, 2);
#endif
qdp = cMacDC->macGrafPort();
SyncCGContextOriginWithPort(cg, qdp);