]> git.wh0rd.org - patches.git/blame - sqlite-cross-compile.patch
sync vapier-m
[patches.git] / sqlite-cross-compile.patch
CommitLineData
5e993f12 1Index: configure.ac
2===================================================================
3RCS file: /sqlite/sqlite/configure.ac,v
4retrieving revision 1.26
5diff -u -p -r1.26 configure.ac
6--- configure.ac 3 Jun 2006 18:02:18 -0000 1.26
7+++ configure.ac 16 Feb 2007 23:53:20 -0000
8@@ -45,18 +45,6 @@
9 # The filename extension for executables on the build
10 # platform. "" for Unix and ".exe" for Windows.
11 #
12-# TARGET_CC
13-#
14-# The name of a command that runs on the build platform
15-# and converts C source files into *.o files for the
16-# target platform. In other words, the cross-compiler.
17-#
18-# TARGET_CFLAGS
19-#
20-# Switches that the target compiler needs to turn C source files
21-# into *.o files. Do not include TARGET_TCL_INC in this list.
22-# Makefiles might add additional switches such as "-I.".
23-#
24 # TCL_*
25 #
26 # Lots of values are read in from the tclConfig.sh script,
27@@ -76,18 +64,6 @@
28 # files for the readline library. If the compiler is able
29 # to find <readline.h> on its own, then this can be blank.
30 #
31-# TARGET_LINK
32-#
33-# The name of the linker that combines *.o files generated
34-# by TARGET_CC into executables for the target platform.
35-#
36-# TARGET_LIBS
37-#
38-# Additional libraries or other switch that the target linker needs
39-# to build an executable on the target. Do not include
40-# on this list any libraries in TARGET_TCL_LIBS and
41-# TARGET_READLINE_LIBS, etc.
42-#
43 # TARGET_EXEEXT
44 #
45 # The filename extension for executables on the
46@@ -184,96 +160,19 @@ fi
47 # Locate a compiler for the build machine. This compiler should
48 # generate command-line programs that run on the build machine.
49 #
50-default_build_cflags="-g"
51-if test "$config_BUILD_CC" = ""; then
52- AC_PROG_CC
53- if test "$cross_compiling" = "yes"; then
54- AC_MSG_ERROR([unable to find a compiler for building build tools])
55- fi
56- BUILD_CC=$CC
57- default_build_cflags=$CFLAGS
58-else
59- BUILD_CC=$config_BUILD_CC
60- AC_MSG_CHECKING([host compiler])
61- CC=$BUILD_CC
62- AC_MSG_RESULT($BUILD_CC)
63-fi
64-AC_MSG_CHECKING([switches for the host compiler])
65-if test "$config_BUILD_CFLAGS" != ""; then
66- CFLAGS=$config_BUILD_CFLAGS
67- BUILD_CFLAGS=$config_BUILD_CFLAGS
68-else
69- BUILD_CFLAGS=$default_build_cflags
70-fi
71-AC_MSG_RESULT($BUILD_CFLAGS)
72-if test "$config_BUILD_LIBS" != ""; then
73- BUILD_LIBS=$config_BUILD_LIBS
74+if test x"$cross_compiling" = xno; then
75+ BUILD_CC=$CC
76+ BUILD_CFLAGS=$CFLAGS
77+else
78+ if test "${BUILD_CC+set}" != set; then
79+ AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
80+ fi
81+ if test "${BUILD_CFLAGS+set}" != set; then
82+ BUILD_CFLAGS="-g"
83+ fi
84 fi
85 AC_SUBST(BUILD_CC)
86 AC_SUBST(BUILD_CFLAGS)
87-AC_SUBST(BUILD_LIBS)
88-
89-##########
90-# Locate a compiler that converts C code into *.o files that run on
91-# the target machine.
92-#
93-AC_MSG_CHECKING([target compiler])
94-if test "$config_TARGET_CC" != ""; then
95- TARGET_CC=$config_TARGET_CC
96-else
97- TARGET_CC=$BUILD_CC
98-fi
99-AC_MSG_RESULT($TARGET_CC)
100-AC_MSG_CHECKING([switches on the target compiler])
101-if test "$config_TARGET_CFLAGS" != ""; then
102- TARGET_CFLAGS=$config_TARGET_CFLAGS
103-else
104- TARGET_CFLAGS=$BUILD_CFLAGS
105-fi
106-AC_MSG_RESULT($TARGET_CFLAGS)
107-AC_MSG_CHECKING([target linker])
108-if test "$config_TARGET_LINK" = ""; then
109- TARGET_LINK=$TARGET_CC
110-else
111- TARGET_LINK=$config_TARGET_LINK
112-fi
113-AC_MSG_RESULT($TARGET_LINK)
114-AC_MSG_CHECKING([switches on the target compiler])
115-if test "$config_TARGET_TFLAGS" != ""; then
116- TARGET_TFLAGS=$config_TARGET_TFLAGS
117-else
118- TARGET_TFLAGS=$BUILD_CFLAGS
119-fi
120-if test "$config_TARGET_RANLIB" != ""; then
121- TARGET_RANLIB=$config_TARGET_RANLIB
122-else
123- AC_PROG_RANLIB
124- TARGET_RANLIB=$RANLIB
125-fi
126-if test "$config_TARGET_AR" != ""; then
127- TARGET_AR=$config_TARGET_AR
128-else
129- TARGET_AR='ar cr'
130-fi
131-AC_MSG_RESULT($TARGET_TFLAGS)
132-AC_SUBST(TARGET_CC)
133-AC_SUBST(TARGET_CFLAGS)
134-AC_SUBST(TARGET_LINK)
135-AC_SUBST(TARGET_LFLAGS)
136-AC_SUBST(TARGET_RANLIB)
137-AC_SUBST(TARGET_AR)
138-
139-# Set the $cross variable if we are cross-compiling. Make
140-# it 0 if we are not.
141-#
142-AC_MSG_CHECKING([if host and target compilers are the same])
143-if test "$BUILD_CC" = "$TARGET_CC"; then
144- cross=0
145- AC_MSG_RESULT(yes)
146-else
147- cross=1
148- AC_MSG_RESULT(no)
149-fi
150
151 ##########
152 # Do we want to support multithreaded use of sqlite
153@@ -401,7 +300,7 @@ if test "$CYGWIN" = "yes"; then
154 else
155 BUILD_EXEEXT=$EXEEXT
156 fi
157-if test "$cross" = "0"; then
158+if test x"$cross_compiling" = xno; then
159 TARGET_EXEEXT=$BUILD_EXEEXT
160 else
161 TARGET_EXEEXT=$config_TARGET_EXEEXT
162@@ -438,15 +337,6 @@ AC_SUBST(OS_OS2)
163 AC_SUBST(TARGET_EXEEXT)
164
165 ##########
166-# Extract generic linker options from the environment.
167-#
168-if test "$config_TARGET_LIBS" != ""; then
169- TARGET_LIBS=$config_TARGET_LIBS
170-else
171- TARGET_LIBS=""
172-fi
173-
174-##########
175 # Figure out all the parameters needed to compile against Tcl.
176 #
177 # This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
178@@ -676,11 +574,6 @@ AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$T
179 AC_CHECK_FUNC(fdatasync, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_FDATASYNC=1"])
180
181 #########
182-# Put out accumulated miscellaneous LIBRARIES
183-#
184-AC_SUBST(TARGET_LIBS)
185-
186-#########
187 # Generate the output files.
188 #
189 AC_OUTPUT([
190Index: Makefile.in
191===================================================================
192RCS file: /sqlite/sqlite/Makefile.in,v
193retrieving revision 1.162
194diff -u -p -r1.162 Makefile.in
195--- Makefile.in 8 Jan 2007 13:40:36 -0000 1.162
196+++ Makefile.in 16 Feb 2007 23:53:21 -0000
197@@ -26,7 +26,7 @@ BCC = @BUILD_CC@ @BUILD_CFLAGS@
198 # will run on the target platform. (BCC and TCC are usually the
199 # same unless your are cross-compiling.)
200 #
201-TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src
202+TCC = @CC@ @CFLAGS@ -I. -I${TOP}/src
203
204 # Define -DNDEBUG to compile without debugging (i.e., for production usage)
205 # Omitting the define will cause extra debugging code to be inserted and
206@@ -63,7 +63,7 @@ LIBPTHREAD=@TARGET_THREAD_LIB@
207 TCC += -DSQLITE_THREAD_OVERRIDE_LOCK=@THREADSOVERRIDELOCKS@
208
209 # The fdatasync library
210-TLIBS = @TARGET_LIBS@
211+TLIBS = @LIBS@
212
213 # Flags controlling use of the in memory btree implementation
214 #
215@@ -107,7 +107,7 @@ LIBTOOL = ./libtool
216 ALLOWRELEASE = @ALLOWRELEASE@
217
218 # libtool compile/link/install
219-LTCOMPILE = $(LIBTOOL) --mode=compile $(TCC)
220+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(TCC)
221 LTLINK = $(LIBTOOL) --mode=link $(TCC)
222 LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
223