Rebase
[platform/upstream/libffi.git] / patches / debug-build
1 Index: libffi/ChangeLog
2 ===================================================================
3 --- libffi.orig/ChangeLog
4 +++ libffi/ChangeLog
5 @@ -65,6 +65,13 @@
6         * testsuite/libffi.call/cls_longdouble.c: Likewise.
7         * testsuite/libffi.call/huge_struct.c: Likewise.
8  
9 +2010-08-05  Dan Witte  <dwitte@mozilla.com>
10 +
11 +        * Makefile.am: Pass FFI_DEBUG define to msvcc.sh for linking to the
12 +        debug CRT when --enable-debug is given.
13 +        * configure.ac: Define it.
14 +        * msvcc.sh: Translate -g and -DFFI_DEBUG appropriately.
15 +
16  2010-08-04  Dan Witte  <dwitte@mozilla.com>
17  
18         * src/x86/ffitarget.h: Add X86_ANY define for all x86/x86_64
19 Index: libffi/Makefile.am
20 ===================================================================
21 --- libffi.orig/Makefile.am
22 +++ libffi/Makefile.am
23 @@ -177,6 +177,14 @@ libffi_convenience_la_SOURCES = $(libffi
24  nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
25  
26  AM_CFLAGS = -Wall -g -fexceptions
27 +if FFI_DEBUG
28 +# Build debug. Define FFI_DEBUG on the commandline so that, when building with
29 +# MSVC, it can link against the debug CRT.
30 +AM_CFLAGS += -DFFI_DEBUG
31 +else
32 +# Build opt.
33 +AM_CFLAGS += -O2
34 +endif
35  
36  libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS)
37  
38 Index: libffi/configure.ac
39 ===================================================================
40 --- libffi.orig/configure.ac
41 +++ libffi/configure.ac
42 @@ -16,10 +16,14 @@ AM_INIT_AUTOMAKE
43  # We must force CC to /not/ be precious variables; otherwise
44  # the wrong, non-multilib-adjusted value will be used in multilibs.
45  # As a side effect, we have to subst CFLAGS ourselves.
46 +# Also save and restore CFLAGS, since AC_PROG_CC will come up with
47 +# defaults of its own if none are provided.
48  
49  m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
50  m4_define([_AC_ARG_VAR_PRECIOUS],[])
51 +save_CFLAGS=$CFLAGS
52  AC_PROG_CC
53 +CFLAGS=$save_CFLAGS
54  m4_undefine([_AC_ARG_VAR_PRECIOUS])
55  m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
56  
57 @@ -399,6 +403,7 @@ AC_ARG_ENABLE(debug,
58    if test "$enable_debug" = "yes"; then
59      AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.])
60    fi)
61 +AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
62  
63  AC_ARG_ENABLE(structs,
64  [  --disable-structs       omit code for struct support],
65 Index: libffi/Makefile.in
66 ===================================================================
67 --- libffi.orig/Makefile.in
68 +++ libffi/Makefile.in
69 @@ -61,6 +61,11 @@ target_triplet = @target@
70  @SH64_TRUE@am__append_23 = src/sh64/sysv.S src/sh64/ffi.c
71  @PA_LINUX_TRUE@am__append_24 = src/pa/linux.S src/pa/ffi.c
72  @PA_HPUX_TRUE@am__append_25 = src/pa/hpux32.S src/pa/ffi.c
73 +# Build debug. Define FFI_DEBUG on the commandline so that, when building with
74 +# MSVC, it can link against the debug CRT.
75 +@FFI_DEBUG_TRUE@am__append_26 = -DFFI_DEBUG
76 +# Build opt.
77 +@FFI_DEBUG_FALSE@am__append_27 = -O2
78  subdir = .
79  DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
80         $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \
81 @@ -481,7 +486,7 @@ nodist_libffi_la_SOURCES = $(am__append_
82         $(am__append_24) $(am__append_25)
83  libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
84  nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
85 -AM_CFLAGS = -Wall -g -fexceptions
86 +AM_CFLAGS = -Wall -g -fexceptions $(am__append_26) $(am__append_27)
87  libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS)
88  AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
89  AM_CCASFLAGS = $(AM_CPPFLAGS)
90 Index: libffi/configure
91 ===================================================================
92 --- libffi.orig/configure
93 +++ libffi/configure
94 @@ -791,6 +791,8 @@ LTLIBOBJS
95  LIBOBJS
96  toolexeclibdir
97  toolexecdir
98 +FFI_DEBUG_FALSE
99 +FFI_DEBUG_TRUE
100  TARGETDIR
101  TARGET
102  HAVE_LONG_DOUBLE
103 @@ -2763,9 +2765,12 @@ am__tar='${AMTAR} chof - "$$tardir"'; am
104  # We must force CC to /not/ be precious variables; otherwise
105  # the wrong, non-multilib-adjusted value will be used in multilibs.
106  # As a side effect, we have to subst CFLAGS ourselves.
107 +# Also save and restore CFLAGS, since AC_PROG_CC will come up with
108 +# defaults of its own if none are provided.
109  
110  
111  
112 +save_CFLAGS=$CFLAGS
113  ac_ext=c
114  ac_cpp='$CPP $CPPFLAGS'
115  ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
116 @@ -3888,6 +3893,7 @@ else
117  fi
118  
119  
120 +CFLAGS=$save_CFLAGS
121  
122  
123  
124 @@ -4776,13 +4782,13 @@ if test "${lt_cv_nm_interface+set}" = se
125  else
126    lt_cv_nm_interface="BSD nm"
127    echo "int some_variable = 0;" > conftest.$ac_ext
128 -  (eval echo "\"\$as_me:4779: $ac_compile\"" >&5)
129 +  (eval echo "\"\$as_me:4785: $ac_compile\"" >&5)
130    (eval "$ac_compile" 2>conftest.err)
131    cat conftest.err >&5
132 -  (eval echo "\"\$as_me:4782: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
133 +  (eval echo "\"\$as_me:4788: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
134    (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
135    cat conftest.err >&5
136 -  (eval echo "\"\$as_me:4785: output\"" >&5)
137 +  (eval echo "\"\$as_me:4791: output\"" >&5)
138    cat conftest.out >&5
139    if $GREP 'External.*some_variable' conftest.out > /dev/null; then
140      lt_cv_nm_interface="MS dumpbin"
141 @@ -5988,7 +5994,7 @@ ia64-*-hpux*)
142    ;;
143  *-*-irix6*)
144    # Find out which ABI we are using.
145 -  echo '#line 5991 "configure"' > conftest.$ac_ext
146 +  echo '#line 5997 "configure"' > conftest.$ac_ext
147    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
148    (eval $ac_compile) 2>&5
149    ac_status=$?
150 @@ -7841,11 +7847,11 @@ else
151     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
152     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
153     -e 's:$: $lt_compiler_flag:'`
154 -   (eval echo "\"\$as_me:7844: $lt_compile\"" >&5)
155 +   (eval echo "\"\$as_me:7850: $lt_compile\"" >&5)
156     (eval "$lt_compile" 2>conftest.err)
157     ac_status=$?
158     cat conftest.err >&5
159 -   echo "$as_me:7848: \$? = $ac_status" >&5
160 +   echo "$as_me:7854: \$? = $ac_status" >&5
161     if (exit $ac_status) && test -s "$ac_outfile"; then
162       # The compiler can only warn and ignore the option if not recognized
163       # So say no if there are warnings other than the usual output.
164 @@ -8180,11 +8186,11 @@ else
165     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
166     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
167     -e 's:$: $lt_compiler_flag:'`
168 -   (eval echo "\"\$as_me:8183: $lt_compile\"" >&5)
169 +   (eval echo "\"\$as_me:8189: $lt_compile\"" >&5)
170     (eval "$lt_compile" 2>conftest.err)
171     ac_status=$?
172     cat conftest.err >&5
173 -   echo "$as_me:8187: \$? = $ac_status" >&5
174 +   echo "$as_me:8193: \$? = $ac_status" >&5
175     if (exit $ac_status) && test -s "$ac_outfile"; then
176       # The compiler can only warn and ignore the option if not recognized
177       # So say no if there are warnings other than the usual output.
178 @@ -8285,11 +8291,11 @@ else
179     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
180     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
181     -e 's:$: $lt_compiler_flag:'`
182 -   (eval echo "\"\$as_me:8288: $lt_compile\"" >&5)
183 +   (eval echo "\"\$as_me:8294: $lt_compile\"" >&5)
184     (eval "$lt_compile" 2>out/conftest.err)
185     ac_status=$?
186     cat out/conftest.err >&5
187 -   echo "$as_me:8292: \$? = $ac_status" >&5
188 +   echo "$as_me:8298: \$? = $ac_status" >&5
189     if (exit $ac_status) && test -s out/conftest2.$ac_objext
190     then
191       # The compiler can only warn and ignore the option if not recognized
192 @@ -8340,11 +8346,11 @@ else
193     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
194     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
195     -e 's:$: $lt_compiler_flag:'`
196 -   (eval echo "\"\$as_me:8343: $lt_compile\"" >&5)
197 +   (eval echo "\"\$as_me:8349: $lt_compile\"" >&5)
198     (eval "$lt_compile" 2>out/conftest.err)
199     ac_status=$?
200     cat out/conftest.err >&5
201 -   echo "$as_me:8347: \$? = $ac_status" >&5
202 +   echo "$as_me:8353: \$? = $ac_status" >&5
203     if (exit $ac_status) && test -s out/conftest2.$ac_objext
204     then
205       # The compiler can only warn and ignore the option if not recognized
206 @@ -11143,7 +11149,7 @@ else
207    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
208    lt_status=$lt_dlunknown
209    cat > conftest.$ac_ext <<_LT_EOF
210 -#line 11146 "configure"
211 +#line 11152 "configure"
212  #include "confdefs.h"
213  
214  #if HAVE_DLFCN_H
215 @@ -11239,7 +11245,7 @@ else
216    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
217    lt_status=$lt_dlunknown
218    cat > conftest.$ac_ext <<_LT_EOF
219 -#line 11242 "configure"
220 +#line 11248 "configure"
221  #include "confdefs.h"
222  
223  #if HAVE_DLFCN_H
224 @@ -14766,6 +14772,14 @@ _ACEOF
225    fi
226  fi
227  
228 + if test "$enable_debug" = "yes"; then
229 +  FFI_DEBUG_TRUE=
230 +  FFI_DEBUG_FALSE='#'
231 +else
232 +  FFI_DEBUG_TRUE='#'
233 +  FFI_DEBUG_FALSE=
234 +fi
235 +
236  
237  # Check whether --enable-structs was given.
238  if test "${enable_structs+set}" = set; then
239 @@ -15166,6 +15180,13 @@ Usually this means the macro was only in
240     { (exit 1); exit 1; }; }
241  fi
242  
243 +if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then
244 +  { { $as_echo "$as_me:$LINENO: error: conditional \"FFI_DEBUG\" was never defined.
245 +Usually this means the macro was only invoked conditionally." >&5
246 +$as_echo "$as_me: error: conditional \"FFI_DEBUG\" was never defined.
247 +Usually this means the macro was only invoked conditionally." >&2;}
248 +   { (exit 1); exit 1; }; }
249 +fi
250  
251  : ${CONFIG_STATUS=./config.status}
252  ac_write_fail=0