]>
Commit | Line | Data |
---|---|---|
1 | dnl | |
2 | dnl This file is part of Bakefile (http://www.bakefile.org) | |
3 | dnl | |
4 | dnl Copyright (C) 2003-2007 Vaclav Slavik and others | |
5 | dnl | |
6 | dnl Permission is hereby granted, free of charge, to any person obtaining a | |
7 | dnl copy of this software and associated documentation files (the "Software"), | |
8 | dnl to deal in the Software without restriction, including without limitation | |
9 | dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | dnl and/or sell copies of the Software, and to permit persons to whom the | |
11 | dnl Software is furnished to do so, subject to the following conditions: | |
12 | dnl | |
13 | dnl The above copyright notice and this permission notice shall be included in | |
14 | dnl all copies or substantial portions of the Software. | |
15 | dnl | |
16 | dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
21 | dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
22 | dnl DEALINGS IN THE SOFTWARE. | |
23 | dnl | |
24 | dnl $Id$ | |
25 | dnl | |
26 | dnl Support macros for makefiles generated by BAKEFILE. | |
27 | dnl | |
28 | ||
29 | ||
30 | dnl --------------------------------------------------------------------------- | |
31 | dnl Lots of compiler & linker detection code contained here was taken from | |
32 | dnl wxWidgets configure.in script (see http://www.wxwidgets.org) | |
33 | dnl --------------------------------------------------------------------------- | |
34 | ||
35 | ||
36 | ||
37 | dnl --------------------------------------------------------------------------- | |
38 | dnl AC_BAKEFILE_GNUMAKE | |
39 | dnl | |
40 | dnl Detects GNU make | |
41 | dnl --------------------------------------------------------------------------- | |
42 | ||
43 | AC_DEFUN([AC_BAKEFILE_GNUMAKE], | |
44 | [ | |
45 | dnl does make support "-include" (only GNU make does AFAIK)? | |
46 | AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu, | |
47 | [ | |
48 | if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null | | |
49 | egrep -s GNU > /dev/null); then | |
50 | bakefile_cv_prog_makeisgnu="yes" | |
51 | else | |
52 | bakefile_cv_prog_makeisgnu="no" | |
53 | fi | |
54 | ]) | |
55 | ||
56 | if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then | |
57 | IF_GNU_MAKE="" | |
58 | else | |
59 | IF_GNU_MAKE="#" | |
60 | fi | |
61 | AC_SUBST(IF_GNU_MAKE) | |
62 | ]) | |
63 | ||
64 | dnl --------------------------------------------------------------------------- | |
65 | dnl AC_BAKEFILE_PLATFORM | |
66 | dnl | |
67 | dnl Detects platform and sets PLATFORM_XXX variables accordingly | |
68 | dnl --------------------------------------------------------------------------- | |
69 | ||
70 | AC_DEFUN([AC_BAKEFILE_PLATFORM], | |
71 | [ | |
72 | PLATFORM_UNIX=0 | |
73 | PLATFORM_WIN32=0 | |
74 | PLATFORM_MSDOS=0 | |
75 | PLATFORM_MAC=0 | |
76 | PLATFORM_MACOS=0 | |
77 | PLATFORM_MACOSX=0 | |
78 | PLATFORM_OS2=0 | |
79 | PLATFORM_BEOS=0 | |
80 | ||
81 | if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then | |
82 | case "${BAKEFILE_HOST}" in | |
83 | *-*-mingw32* ) | |
84 | PLATFORM_WIN32=1 | |
85 | ;; | |
86 | *-pc-msdosdjgpp ) | |
87 | PLATFORM_MSDOS=1 | |
88 | ;; | |
89 | *-pc-os2_emx | *-pc-os2-emx ) | |
90 | PLATFORM_OS2=1 | |
91 | ;; | |
92 | *-*-darwin* ) | |
93 | PLATFORM_MAC=1 | |
94 | PLATFORM_MACOSX=1 | |
95 | ;; | |
96 | *-*-beos* ) | |
97 | PLATFORM_BEOS=1 | |
98 | ;; | |
99 | powerpc-apple-macos* ) | |
100 | PLATFORM_MAC=1 | |
101 | PLATFORM_MACOS=1 | |
102 | ;; | |
103 | * ) | |
104 | PLATFORM_UNIX=1 | |
105 | ;; | |
106 | esac | |
107 | else | |
108 | case "$BAKEFILE_FORCE_PLATFORM" in | |
109 | win32 ) | |
110 | PLATFORM_WIN32=1 | |
111 | ;; | |
112 | msdos ) | |
113 | PLATFORM_MSDOS=1 | |
114 | ;; | |
115 | os2 ) | |
116 | PLATFORM_OS2=1 | |
117 | ;; | |
118 | darwin ) | |
119 | PLATFORM_MAC=1 | |
120 | PLATFORM_MACOSX=1 | |
121 | ;; | |
122 | unix ) | |
123 | PLATFORM_UNIX=1 | |
124 | ;; | |
125 | beos ) | |
126 | PLATFORM_BEOS=1 | |
127 | ;; | |
128 | * ) | |
129 | AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM]) | |
130 | ;; | |
131 | esac | |
132 | fi | |
133 | ||
134 | AC_SUBST(PLATFORM_UNIX) | |
135 | AC_SUBST(PLATFORM_WIN32) | |
136 | AC_SUBST(PLATFORM_MSDOS) | |
137 | AC_SUBST(PLATFORM_MAC) | |
138 | AC_SUBST(PLATFORM_MACOS) | |
139 | AC_SUBST(PLATFORM_MACOSX) | |
140 | AC_SUBST(PLATFORM_OS2) | |
141 | AC_SUBST(PLATFORM_BEOS) | |
142 | ]) | |
143 | ||
144 | ||
145 | dnl --------------------------------------------------------------------------- | |
146 | dnl AC_BAKEFILE_PLATFORM_SPECIFICS | |
147 | dnl | |
148 | dnl Sets misc platform-specific settings | |
149 | dnl --------------------------------------------------------------------------- | |
150 | ||
151 | AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS], | |
152 | [ | |
153 | AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf], | |
154 | [use OMF object format (OS/2)]), | |
155 | [bk_os2_use_omf="$enableval"]) | |
156 | ||
157 | case "${BAKEFILE_HOST}" in | |
158 | *-*-darwin* ) | |
159 | dnl For Unix to MacOS X porting instructions, see: | |
160 | dnl http://fink.sourceforge.net/doc/porting/porting.html | |
161 | if test "x$GCC" = "xyes"; then | |
162 | CFLAGS="$CFLAGS -fno-common" | |
163 | CXXFLAGS="$CXXFLAGS -fno-common" | |
164 | fi | |
165 | if test "x$XLCC" = "xyes"; then | |
166 | CFLAGS="$CFLAGS -qnocommon" | |
167 | CXXFLAGS="$CXXFLAGS -qnocommon" | |
168 | fi | |
169 | ;; | |
170 | ||
171 | *-pc-os2_emx | *-pc-os2-emx ) | |
172 | if test "x$bk_os2_use_omf" = "xyes" ; then | |
173 | AR=emxomfar | |
174 | RANLIB=: | |
175 | LDFLAGS="-Zomf $LDFLAGS" | |
176 | CFLAGS="-Zomf $CFLAGS" | |
177 | CXXFLAGS="-Zomf $CXXFLAGS" | |
178 | OS2_LIBEXT="lib" | |
179 | else | |
180 | OS2_LIBEXT="a" | |
181 | fi | |
182 | ;; | |
183 | ||
184 | i*86-*-beos* ) | |
185 | LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS" | |
186 | ;; | |
187 | esac | |
188 | ]) | |
189 | ||
190 | dnl --------------------------------------------------------------------------- | |
191 | dnl AC_BAKEFILE_SUFFIXES | |
192 | dnl | |
193 | dnl Detects shared various suffixes for shared libraries, libraries, programs, | |
194 | dnl plugins etc. | |
195 | dnl --------------------------------------------------------------------------- | |
196 | ||
197 | AC_DEFUN([AC_BAKEFILE_SUFFIXES], | |
198 | [ | |
199 | SO_SUFFIX="so" | |
200 | SO_SUFFIX_MODULE="so" | |
201 | EXEEXT="" | |
202 | LIBPREFIX="lib" | |
203 | LIBEXT=".a" | |
204 | DLLPREFIX="lib" | |
205 | DLLPREFIX_MODULE="" | |
206 | DLLIMP_SUFFIX="" | |
207 | dlldir="$libdir" | |
208 | ||
209 | case "${BAKEFILE_HOST}" in | |
210 | dnl PA-RISC HP systems used .sl but IA64 use ELF-64 and so use the | |
211 | dnl standard .so extension | |
212 | ia64-hp-hpux* ) | |
213 | ;; | |
214 | *-hp-hpux* ) | |
215 | SO_SUFFIX="sl" | |
216 | SO_SUFFIX_MODULE="sl" | |
217 | ;; | |
218 | *-*-aix* ) | |
219 | dnl quoting from | |
220 | dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html: | |
221 | dnl Both archive libraries and shared libraries on AIX have an | |
222 | dnl .a extension. This will explain why you can't link with an | |
223 | dnl .so and why it works with the name changed to .a. | |
224 | SO_SUFFIX="a" | |
225 | SO_SUFFIX_MODULE="a" | |
226 | ;; | |
227 | *-*-cygwin* ) | |
228 | SO_SUFFIX="dll" | |
229 | SO_SUFFIX_MODULE="dll" | |
230 | DLLIMP_SUFFIX="dll.a" | |
231 | EXEEXT=".exe" | |
232 | DLLPREFIX="cyg" | |
233 | dlldir="$bindir" | |
234 | ;; | |
235 | *-*-mingw32* ) | |
236 | SO_SUFFIX="dll" | |
237 | SO_SUFFIX_MODULE="dll" | |
238 | DLLIMP_SUFFIX="dll.a" | |
239 | EXEEXT=".exe" | |
240 | DLLPREFIX="" | |
241 | dlldir="$bindir" | |
242 | ;; | |
243 | *-pc-msdosdjgpp ) | |
244 | EXEEXT=".exe" | |
245 | DLLPREFIX="" | |
246 | dlldir="$bindir" | |
247 | ;; | |
248 | *-pc-os2_emx | *-pc-os2-emx ) | |
249 | SO_SUFFIX="dll" | |
250 | SO_SUFFIX_MODULE="dll" | |
251 | DLLIMP_SUFFIX=$OS2_LIBEXT | |
252 | EXEEXT=".exe" | |
253 | DLLPREFIX="" | |
254 | LIBPREFIX="" | |
255 | LIBEXT=".$OS2_LIBEXT" | |
256 | dlldir="$bindir" | |
257 | ;; | |
258 | *-*-darwin* ) | |
259 | SO_SUFFIX="dylib" | |
260 | SO_SUFFIX_MODULE="bundle" | |
261 | ;; | |
262 | esac | |
263 | ||
264 | if test "x$DLLIMP_SUFFIX" = "x" ; then | |
265 | DLLIMP_SUFFIX="$SO_SUFFIX" | |
266 | fi | |
267 | ||
268 | AC_SUBST(SO_SUFFIX) | |
269 | AC_SUBST(SO_SUFFIX_MODULE) | |
270 | AC_SUBST(DLLIMP_SUFFIX) | |
271 | AC_SUBST(EXEEXT) | |
272 | AC_SUBST(LIBPREFIX) | |
273 | AC_SUBST(LIBEXT) | |
274 | AC_SUBST(DLLPREFIX) | |
275 | AC_SUBST(DLLPREFIX_MODULE) | |
276 | AC_SUBST(dlldir) | |
277 | ]) | |
278 | ||
279 | ||
280 | dnl --------------------------------------------------------------------------- | |
281 | dnl AC_BAKEFILE_SHARED_LD | |
282 | dnl | |
283 | dnl Detects command for making shared libraries, substitutes SHARED_LD_CC | |
284 | dnl and SHARED_LD_CXX. | |
285 | dnl --------------------------------------------------------------------------- | |
286 | ||
287 | AC_DEFUN([AC_BAKEFILE_SHARED_LD], | |
288 | [ | |
289 | dnl the extra compiler flags needed for compilation of shared library | |
290 | PIC_FLAG="" | |
291 | if test "x$GCC" = "xyes"; then | |
292 | dnl the switch for gcc is the same under all platforms | |
293 | PIC_FLAG="-fPIC" | |
294 | fi | |
295 | ||
296 | dnl Defaults for GCC and ELF .so shared libs: | |
297 | SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o" | |
298 | SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o" | |
299 | WINDOWS_IMPLIB=0 | |
300 | ||
301 | case "${BAKEFILE_HOST}" in | |
302 | *-hp-hpux* ) | |
303 | dnl default settings are good for gcc but not for the native HP-UX | |
304 | if test "x$GCC" != "xyes"; then | |
305 | dnl no idea why it wants it, but it does | |
306 | LDFLAGS="$LDFLAGS -L/usr/lib" | |
307 | ||
308 | SHARED_LD_CC="${CC} -b -o" | |
309 | SHARED_LD_CXX="${CXX} -b -o" | |
310 | PIC_FLAG="+Z" | |
311 | fi | |
312 | ;; | |
313 | ||
314 | *-*-linux* ) | |
315 | dnl newer icc versions use -fPIC just as gcc does and, in fact, the | |
316 | dnl newest (v10+) ones don't even understand -KPIC any longer | |
317 | if test "$INTELCC" = "yes" -a "$INTELCC8" != "yes"; then | |
318 | PIC_FLAG="-KPIC" | |
319 | elif test "x$SUNCXX" = "xyes"; then | |
320 | SHARED_LD_CC="${CC} -G -o" | |
321 | SHARED_LD_CXX="${CXX} -G -o" | |
322 | PIC_FLAG="-KPIC" | |
323 | fi | |
324 | ;; | |
325 | ||
326 | *-*-solaris2* ) | |
327 | if test "x$SUNCXX" = xyes ; then | |
328 | SHARED_LD_CC="${CC} -G -o" | |
329 | SHARED_LD_CXX="${CXX} -G -o" | |
330 | PIC_FLAG="-KPIC" | |
331 | fi | |
332 | ;; | |
333 | ||
334 | *-*-darwin* ) | |
335 | AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH | |
336 | chmod +x shared-ld-sh | |
337 | ||
338 | SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o" | |
339 | SHARED_LD_MODULE_CXX="CXX=\"\$(CXX)\" $SHARED_LD_MODULE_CC" | |
340 | ||
341 | dnl Most apps benefit from being fully binded (its faster and static | |
342 | dnl variables initialized at startup work). | |
343 | dnl This can be done either with the exe linker flag -Wl,-bind_at_load | |
344 | dnl or with a double stage link in order to create a single module | |
345 | dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved | |
346 | ||
347 | dnl If using newer dev tools then there is a -single_module flag that | |
348 | dnl we can use to do this for dylibs, otherwise we'll need to use a helper | |
349 | dnl script. Check the version of gcc to see which way we can go: | |
350 | AC_CACHE_CHECK([for gcc 3.1 or later], bakefile_cv_gcc31, [ | |
351 | AC_TRY_COMPILE([], | |
352 | [ | |
353 | #if (__GNUC__ < 3) || \ | |
354 | ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) | |
355 | This is old gcc | |
356 | #endif | |
357 | ], | |
358 | [ | |
359 | bakefile_cv_gcc31=yes | |
360 | ], | |
361 | [ | |
362 | bakefile_cv_gcc31=no | |
363 | ] | |
364 | ) | |
365 | ]) | |
366 | if test "$bakefile_cv_gcc31" = "no"; then | |
367 | dnl Use the shared-ld-sh helper script | |
368 | SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o" | |
369 | SHARED_LD_CXX="$SHARED_LD_CC" | |
370 | else | |
371 | dnl Use the -single_module flag and let the linker do it for us | |
372 | SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o" | |
373 | SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o" | |
374 | fi | |
375 | ||
376 | if test "x$GCC" == "xyes"; then | |
377 | PIC_FLAG="-dynamic -fPIC" | |
378 | fi | |
379 | if test "x$XLCC" = "xyes"; then | |
380 | PIC_FLAG="-dynamic -DPIC" | |
381 | fi | |
382 | ;; | |
383 | ||
384 | *-*-aix* ) | |
385 | if test "x$GCC" = "xyes"; then | |
386 | dnl at least gcc 2.95 warns that -fPIC is ignored when | |
387 | dnl compiling each and every file under AIX which is annoying, | |
388 | dnl so don't use it there (it's useless as AIX runs on | |
389 | dnl position-independent architectures only anyhow) | |
390 | PIC_FLAG="" | |
391 | ||
392 | dnl -bexpfull is needed by AIX linker to export all symbols (by | |
393 | dnl default it doesn't export any and even with -bexpall it | |
394 | dnl doesn't export all C++ support symbols, e.g. vtable | |
395 | dnl pointers) but it's only available starting from 5.1 (with | |
396 | dnl maintenance pack 2, whatever this is), see | |
397 | dnl http://www-128.ibm.com/developerworks/eserver/articles/gnu.html | |
398 | case "${BAKEFILE_HOST}" in | |
399 | *-*-aix5* ) | |
400 | LD_EXPFULL="-Wl,-bexpfull" | |
401 | ;; | |
402 | esac | |
403 | ||
404 | SHARED_LD_CC="\$(CC) -shared $LD_EXPFULL -o" | |
405 | SHARED_LD_CXX="\$(CXX) -shared $LD_EXPFULL -o" | |
406 | else | |
407 | dnl FIXME: makeC++SharedLib is obsolete, what should we do for | |
408 | dnl recent AIX versions? | |
409 | AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, | |
410 | makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) | |
411 | SHARED_LD_CC="$AIX_CC_LD -p 0 -o" | |
412 | SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o" | |
413 | fi | |
414 | ;; | |
415 | ||
416 | *-*-beos* ) | |
417 | dnl can't use gcc under BeOS for shared library creation because it | |
418 | dnl complains about missing 'main' | |
419 | SHARED_LD_CC="${LD} -nostart -o" | |
420 | SHARED_LD_CXX="${LD} -nostart -o" | |
421 | ;; | |
422 | ||
423 | *-*-irix* ) | |
424 | dnl default settings are ok for gcc | |
425 | if test "x$GCC" != "xyes"; then | |
426 | PIC_FLAG="-KPIC" | |
427 | fi | |
428 | ;; | |
429 | ||
430 | *-*-cygwin* | *-*-mingw32* ) | |
431 | PIC_FLAG="" | |
432 | SHARED_LD_CC="\$(CC) -shared -o" | |
433 | SHARED_LD_CXX="\$(CXX) -shared -o" | |
434 | WINDOWS_IMPLIB=1 | |
435 | ;; | |
436 | ||
437 | *-pc-os2_emx | *-pc-os2-emx ) | |
438 | SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o" | |
439 | SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o" | |
440 | PIC_FLAG="" | |
441 | AC_BAKEFILE_CREATE_FILE_DLLAR_SH | |
442 | chmod +x dllar.sh | |
443 | ;; | |
444 | ||
445 | powerpc-apple-macos* | \ | |
446 | *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | *-*-k*bsd*-gnu | \ | |
447 | *-*-mirbsd* | \ | |
448 | *-*-sunos4* | \ | |
449 | *-*-osf* | \ | |
450 | *-*-dgux5* | \ | |
451 | *-*-sysv5* | \ | |
452 | *-pc-msdosdjgpp ) | |
453 | dnl defaults are ok | |
454 | ;; | |
455 | ||
456 | *) | |
457 | AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.) | |
458 | esac | |
459 | ||
460 | if test "x$PIC_FLAG" != "x" ; then | |
461 | PIC_FLAG="$PIC_FLAG -DPIC" | |
462 | fi | |
463 | ||
464 | if test "x$SHARED_LD_MODULE_CC" = "x" ; then | |
465 | SHARED_LD_MODULE_CC="$SHARED_LD_CC" | |
466 | fi | |
467 | if test "x$SHARED_LD_MODULE_CXX" = "x" ; then | |
468 | SHARED_LD_MODULE_CXX="$SHARED_LD_CXX" | |
469 | fi | |
470 | ||
471 | AC_SUBST(SHARED_LD_CC) | |
472 | AC_SUBST(SHARED_LD_CXX) | |
473 | AC_SUBST(SHARED_LD_MODULE_CC) | |
474 | AC_SUBST(SHARED_LD_MODULE_CXX) | |
475 | AC_SUBST(PIC_FLAG) | |
476 | AC_SUBST(WINDOWS_IMPLIB) | |
477 | ]) | |
478 | ||
479 | ||
480 | dnl --------------------------------------------------------------------------- | |
481 | dnl AC_BAKEFILE_SHARED_VERSIONS | |
482 | dnl | |
483 | dnl Detects linker options for attaching versions (sonames) to shared libs. | |
484 | dnl --------------------------------------------------------------------------- | |
485 | ||
486 | AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS], | |
487 | [ | |
488 | USE_SOVERSION=0 | |
489 | USE_SOVERLINUX=0 | |
490 | USE_SOVERSOLARIS=0 | |
491 | USE_SOVERCYGWIN=0 | |
492 | USE_SOTWOSYMLINKS=0 | |
493 | USE_MACVERSION=0 | |
494 | SONAME_FLAG= | |
495 | ||
496 | case "${BAKEFILE_HOST}" in | |
497 | *-*-linux* | *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \ | |
498 | *-*-k*bsd*-gnu | *-*-mirbsd* ) | |
499 | if test "x$SUNCXX" = "xyes"; then | |
500 | SONAME_FLAG="-h " | |
501 | else | |
502 | SONAME_FLAG="-Wl,-soname," | |
503 | fi | |
504 | USE_SOVERSION=1 | |
505 | USE_SOVERLINUX=1 | |
506 | USE_SOTWOSYMLINKS=1 | |
507 | ;; | |
508 | ||
509 | *-*-solaris2* ) | |
510 | SONAME_FLAG="-h " | |
511 | USE_SOVERSION=1 | |
512 | USE_SOVERSOLARIS=1 | |
513 | ;; | |
514 | ||
515 | *-*-darwin* ) | |
516 | USE_MACVERSION=1 | |
517 | USE_SOVERSION=1 | |
518 | USE_SOTWOSYMLINKS=1 | |
519 | ;; | |
520 | ||
521 | *-*-cygwin* ) | |
522 | USE_SOVERSION=1 | |
523 | USE_SOVERCYGWIN=1 | |
524 | ;; | |
525 | esac | |
526 | ||
527 | AC_SUBST(USE_SOVERSION) | |
528 | AC_SUBST(USE_SOVERLINUX) | |
529 | AC_SUBST(USE_SOVERSOLARIS) | |
530 | AC_SUBST(USE_SOVERCYGWIN) | |
531 | AC_SUBST(USE_MACVERSION) | |
532 | AC_SUBST(USE_SOTWOSYMLINKS) | |
533 | AC_SUBST(SONAME_FLAG) | |
534 | ]) | |
535 | ||
536 | ||
537 | dnl --------------------------------------------------------------------------- | |
538 | dnl AC_BAKEFILE_DEPS | |
539 | dnl | |
540 | dnl Detects available C/C++ dependency tracking options | |
541 | dnl --------------------------------------------------------------------------- | |
542 | ||
543 | AC_DEFUN([AC_BAKEFILE_DEPS], | |
544 | [ | |
545 | AC_ARG_ENABLE([dependency-tracking], | |
546 | AS_HELP_STRING([--disable-dependency-tracking], | |
547 | [don't use dependency tracking even if the compiler can]), | |
548 | [bk_use_trackdeps="$enableval"]) | |
549 | ||
550 | AC_MSG_CHECKING([for dependency tracking method]) | |
551 | ||
552 | BK_DEPS="" | |
553 | if test "x$bk_use_trackdeps" = "xno" ; then | |
554 | DEPS_TRACKING=0 | |
555 | AC_MSG_RESULT([disabled]) | |
556 | else | |
557 | DEPS_TRACKING=1 | |
558 | ||
559 | if test "x$GCC" = "xyes"; then | |
560 | DEPSMODE=gcc | |
561 | DEPSFLAG="-MMD" | |
562 | AC_MSG_RESULT([gcc]) | |
563 | elif test "x$MWCC" = "xyes"; then | |
564 | DEPSMODE=mwcc | |
565 | DEPSFLAG="-MM" | |
566 | AC_MSG_RESULT([mwcc]) | |
567 | elif test "x$SUNCC" = "xyes"; then | |
568 | DEPSMODE=unixcc | |
569 | DEPSFLAG="-xM1" | |
570 | AC_MSG_RESULT([Sun cc]) | |
571 | elif test "x$SGICC" = "xyes"; then | |
572 | DEPSMODE=unixcc | |
573 | DEPSFLAG="-M" | |
574 | AC_MSG_RESULT([SGI cc]) | |
575 | elif test "x$HPCC" = "xyes"; then | |
576 | DEPSMODE=unixcc | |
577 | DEPSFLAG="+make" | |
578 | AC_MSG_RESULT([HP cc]) | |
579 | elif test "x$COMPAQCC" = "xyes"; then | |
580 | DEPSMODE=gcc | |
581 | DEPSFLAG="-MD" | |
582 | AC_MSG_RESULT([Compaq cc]) | |
583 | else | |
584 | DEPS_TRACKING=0 | |
585 | AC_MSG_RESULT([none]) | |
586 | fi | |
587 | ||
588 | if test $DEPS_TRACKING = 1 ; then | |
589 | AC_BAKEFILE_CREATE_FILE_BK_DEPS | |
590 | chmod +x bk-deps | |
591 | dnl FIXME: make this $(top_builddir)/bk-deps once autoconf-2.60 | |
592 | dnl is required (and so top_builddir is never empty): | |
593 | BK_DEPS="`pwd`/bk-deps" | |
594 | fi | |
595 | fi | |
596 | ||
597 | AC_SUBST(DEPS_TRACKING) | |
598 | AC_SUBST(BK_DEPS) | |
599 | ]) | |
600 | ||
601 | dnl --------------------------------------------------------------------------- | |
602 | dnl AC_BAKEFILE_CHECK_BASIC_STUFF | |
603 | dnl | |
604 | dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib" | |
605 | dnl or "install" | |
606 | dnl --------------------------------------------------------------------------- | |
607 | ||
608 | AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF], | |
609 | [ | |
610 | AC_PROG_RANLIB | |
611 | AC_PROG_INSTALL | |
612 | AC_PROG_LN_S | |
613 | ||
614 | AC_PROG_MAKE_SET | |
615 | AC_SUBST(MAKE_SET) | |
616 | ||
617 | if test "x$SUNCXX" = "xyes"; then | |
618 | dnl Sun C++ compiler requires special way of creating static libs; | |
619 | dnl see here for more details: | |
620 | dnl https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1229751&group_id=9863 | |
621 | AR=$CXX | |
622 | AROPTIONS="-xar -o" | |
623 | AC_SUBST(AR) | |
624 | elif test "x$SGICC" = "xyes"; then | |
625 | dnl Almost the same as above for SGI mipsPro compiler | |
626 | AR=$CXX | |
627 | AROPTIONS="-ar -o" | |
628 | AC_SUBST(AR) | |
629 | else | |
630 | AC_CHECK_TOOL(AR, ar, ar) | |
631 | AROPTIONS=rcu | |
632 | fi | |
633 | AC_SUBST(AROPTIONS) | |
634 | ||
635 | AC_CHECK_TOOL(STRIP, strip, :) | |
636 | AC_CHECK_TOOL(NM, nm, :) | |
637 | ||
638 | dnl Don't use `install -d`, see http://trac.wxwidgets.org/ticket/13452 | |
639 | INSTALL_DIR="mkdir -p" | |
640 | AC_SUBST(INSTALL_DIR) | |
641 | ||
642 | LDFLAGS_GUI= | |
643 | case ${BAKEFILE_HOST} in | |
644 | *-*-cygwin* | *-*-mingw32* ) | |
645 | LDFLAGS_GUI="-mwindows" | |
646 | esac | |
647 | AC_SUBST(LDFLAGS_GUI) | |
648 | ]) | |
649 | ||
650 | ||
651 | dnl --------------------------------------------------------------------------- | |
652 | dnl AC_BAKEFILE_RES_COMPILERS | |
653 | dnl | |
654 | dnl Checks for presence of resource compilers for win32 or mac | |
655 | dnl --------------------------------------------------------------------------- | |
656 | ||
657 | AC_DEFUN([AC_BAKEFILE_RES_COMPILERS], | |
658 | [ | |
659 | case ${BAKEFILE_HOST} in | |
660 | *-*-cygwin* | *-*-mingw32* ) | |
661 | dnl Check for win32 resources compiler: | |
662 | AC_CHECK_TOOL(WINDRES, windres) | |
663 | ;; | |
664 | ||
665 | *-*-darwin* | powerpc-apple-macos* ) | |
666 | AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez) | |
667 | AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) | |
668 | ;; | |
669 | esac | |
670 | ||
671 | AC_SUBST(WINDRES) | |
672 | AC_SUBST(REZ) | |
673 | AC_SUBST(SETFILE) | |
674 | ]) | |
675 | ||
676 | dnl --------------------------------------------------------------------------- | |
677 | dnl AC_BAKEFILE_PRECOMP_HEADERS | |
678 | dnl | |
679 | dnl Check for precompiled headers support (GCC >= 3.4) | |
680 | dnl --------------------------------------------------------------------------- | |
681 | ||
682 | AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], | |
683 | [ | |
684 | ||
685 | AC_ARG_ENABLE([precomp-headers], | |
686 | AS_HELP_STRING([--disable-precomp-headers], | |
687 | [don't use precompiled headers even if compiler can]), | |
688 | [bk_use_pch="$enableval"]) | |
689 | ||
690 | GCC_PCH=0 | |
691 | ICC_PCH=0 | |
692 | USE_PCH=0 | |
693 | BK_MAKE_PCH="" | |
694 | ||
695 | case ${BAKEFILE_HOST} in | |
696 | *-*-cygwin* ) | |
697 | dnl PCH support is broken in cygwin gcc because of unportable | |
698 | dnl assumptions about mmap() in gcc code which make PCH generation | |
699 | dnl fail erratically; disable PCH completely until this is fixed | |
700 | bk_use_pch="no" | |
701 | ;; | |
702 | esac | |
703 | ||
704 | if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then | |
705 | if test "x$GCC" = "xyes"; then | |
706 | dnl test if we have gcc-3.4: | |
707 | AC_MSG_CHECKING([if the compiler supports precompiled headers]) | |
708 | AC_TRY_COMPILE([], | |
709 | [ | |
710 | #if !defined(__GNUC__) || !defined(__GNUC_MINOR__) | |
711 | There is no PCH support | |
712 | #endif | |
713 | #if (__GNUC__ < 3) | |
714 | There is no PCH support | |
715 | #endif | |
716 | #if (__GNUC__ == 3) && \ | |
717 | ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \ | |
718 | ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3))) || \ | |
719 | ( defined(__INTEL_COMPILER) ) | |
720 | There is no PCH support | |
721 | #endif | |
722 | ], | |
723 | [ | |
724 | AC_MSG_RESULT([yes]) | |
725 | GCC_PCH=1 | |
726 | ], | |
727 | [ | |
728 | if test "$INTELCXX8" = "yes"; then | |
729 | AC_MSG_RESULT([yes]) | |
730 | ICC_PCH=1 | |
731 | if test "$INTELCXX10" = "yes"; then | |
732 | ICC_PCH_CREATE_SWITCH="-pch-create" | |
733 | ICC_PCH_USE_SWITCH="-pch-use" | |
734 | else | |
735 | ICC_PCH_CREATE_SWITCH="-create-pch" | |
736 | ICC_PCH_USE_SWITCH="-use-pch" | |
737 | fi | |
738 | else | |
739 | AC_MSG_RESULT([no]) | |
740 | fi | |
741 | ]) | |
742 | if test $GCC_PCH = 1 -o $ICC_PCH = 1 ; then | |
743 | USE_PCH=1 | |
744 | AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH | |
745 | chmod +x bk-make-pch | |
746 | dnl FIXME: make this $(top_builddir)/bk-make-pch once | |
747 | dnl autoconf-2.60 is required (and so top_builddir is | |
748 | dnl never empty): | |
749 | BK_MAKE_PCH="`pwd`/bk-make-pch" | |
750 | fi | |
751 | fi | |
752 | fi | |
753 | ||
754 | AC_SUBST(GCC_PCH) | |
755 | AC_SUBST(ICC_PCH) | |
756 | AC_SUBST(ICC_PCH_CREATE_SWITCH) | |
757 | AC_SUBST(ICC_PCH_USE_SWITCH) | |
758 | AC_SUBST(BK_MAKE_PCH) | |
759 | ]) | |
760 | ||
761 | ||
762 | ||
763 | dnl --------------------------------------------------------------------------- | |
764 | dnl AC_BAKEFILE([autoconf_inc.m4 inclusion]) | |
765 | dnl | |
766 | dnl To be used in configure.in of any project using Bakefile-generated mks | |
767 | dnl | |
768 | dnl Behaviour can be modified by setting following variables: | |
769 | dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to | |
770 | dnl to perform check for basic tools like ranlib | |
771 | dnl BAKEFILE_HOST set this to override host detection, defaults | |
772 | dnl to ${host} | |
773 | dnl BAKEFILE_FORCE_PLATFORM set to override platform detection | |
774 | dnl | |
775 | dnl Example usage: | |
776 | dnl | |
777 | dnl AC_BAKEFILE([FOO(autoconf_inc.m4)]) | |
778 | dnl | |
779 | dnl (replace FOO with m4_include above, aclocal would die otherwise) | |
780 | dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing | |
781 | dnl we can do...) | |
782 | dnl --------------------------------------------------------------------------- | |
783 | ||
784 | AC_DEFUN([AC_BAKEFILE], | |
785 | [ | |
786 | AC_PREREQ([2.58]) | |
787 | ||
788 | dnl We need to always run C/C++ compiler tests, but it's also possible | |
789 | dnl for the user to call these macros manually, hence this instead of | |
790 | dnl simply calling these macros. See http://www.bakefile.org/ticket/64 | |
791 | AC_REQUIRE([AC_BAKEFILE_PROG_CC]) | |
792 | AC_REQUIRE([AC_BAKEFILE_PROG_CXX]) | |
793 | ||
794 | if test "x$BAKEFILE_HOST" = "x"; then | |
795 | if test "x${host}" = "x" ; then | |
796 | AC_MSG_ERROR([You must call the autoconf "CANONICAL_HOST" macro in your configure.ac (or .in) file.]) | |
797 | fi | |
798 | ||
799 | BAKEFILE_HOST="${host}" | |
800 | fi | |
801 | ||
802 | if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then | |
803 | AC_BAKEFILE_CHECK_BASIC_STUFF | |
804 | fi | |
805 | AC_BAKEFILE_GNUMAKE | |
806 | AC_BAKEFILE_PLATFORM | |
807 | AC_BAKEFILE_PLATFORM_SPECIFICS | |
808 | AC_BAKEFILE_SUFFIXES | |
809 | AC_BAKEFILE_SHARED_LD | |
810 | AC_BAKEFILE_SHARED_VERSIONS | |
811 | AC_BAKEFILE_DEPS | |
812 | AC_BAKEFILE_RES_COMPILERS | |
813 | ||
814 | dnl OBJCFLAGS is set by Autoconf, but OBJCXXFLAGS is not: | |
815 | AC_SUBST(OBJCXXFLAGS) | |
816 | ||
817 | ||
818 | BAKEFILE_BAKEFILE_M4_VERSION="0.2.9" | |
819 | ||
820 | dnl includes autoconf_inc.m4: | |
821 | $1 | |
822 | ||
823 | if test "$BAKEFILE_AUTOCONF_INC_M4_VERSION" = "" ; then | |
824 | AC_MSG_ERROR([No version found in autoconf_inc.m4 - bakefile macro was changed to take additional argument, perhaps configure.in wasn't updated (see the documentation)?]) | |
825 | fi | |
826 | ||
827 | if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then | |
828 | AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.]) | |
829 | fi | |
830 | ]) | |
831 | ||
832 | ||
833 | dnl --------------------------------------------------------------------------- | |
834 | dnl Embedded copies of helper scripts follow: | |
835 | dnl --------------------------------------------------------------------------- | |
836 | ||
837 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS], | |
838 | [ | |
839 | dnl ===================== bk-deps begins here ===================== | |
840 | dnl (Created by merge-scripts.py from bk-deps | |
841 | dnl file do not edit here!) | |
842 | D='$' | |
843 | cat <<EOF >bk-deps | |
844 | #!/bin/sh | |
845 | ||
846 | # This script is part of Bakefile (http://www.bakefile.org) autoconf | |
847 | # script. It is used to track C/C++ files dependencies in portable way. | |
848 | # | |
849 | # Permission is given to use this file in any way. | |
850 | ||
851 | DEPSMODE=${DEPSMODE} | |
852 | DEPSFLAG="${DEPSFLAG}" | |
853 | DEPSDIRBASE=.deps | |
854 | ||
855 | if test ${D}DEPSMODE = gcc ; then | |
856 | ${D}* ${D}{DEPSFLAG} | |
857 | status=${D}? | |
858 | ||
859 | # determine location of created files: | |
860 | while test ${D}# -gt 0; do | |
861 | case "${D}1" in | |
862 | -o ) | |
863 | shift | |
864 | objfile=${D}1 | |
865 | ;; | |
866 | -* ) | |
867 | ;; | |
868 | * ) | |
869 | srcfile=${D}1 | |
870 | ;; | |
871 | esac | |
872 | shift | |
873 | done | |
874 | objfilebase=\`basename ${D}objfile\` | |
875 | builddir=\`dirname ${D}objfile\` | |
876 | depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\` | |
877 | depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\` | |
878 | depsdir=${D}builddir/${D}DEPSDIRBASE | |
879 | mkdir -p ${D}depsdir | |
880 | ||
881 | # if the compiler failed, we're done: | |
882 | if test ${D}{status} != 0 ; then | |
883 | rm -f ${D}depfile | |
884 | exit ${D}{status} | |
885 | fi | |
886 | ||
887 | # move created file to the location we want it in: | |
888 | if test -f ${D}depfile ; then | |
889 | sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{depsdir}/${D}{objfilebase}.d | |
890 | rm -f ${D}depfile | |
891 | else | |
892 | # "g++ -MMD -o fooobj.o foosrc.cpp" produces fooobj.d | |
893 | depfile=\`echo "${D}objfile" | sed -e 's/\\..*${D}/.d/g'\` | |
894 | if test ! -f ${D}depfile ; then | |
895 | # "cxx -MD -o fooobj.o foosrc.cpp" creates fooobj.o.d (Compaq C++) | |
896 | depfile="${D}objfile.d" | |
897 | fi | |
898 | if test -f ${D}depfile ; then | |
899 | sed -e "\\,^${D}objfile,!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{depsdir}/${D}{objfilebase}.d | |
900 | rm -f ${D}depfile | |
901 | fi | |
902 | fi | |
903 | exit 0 | |
904 | ||
905 | elif test ${D}DEPSMODE = mwcc ; then | |
906 | ${D}* || exit ${D}? | |
907 | # Run mwcc again with -MM and redirect into the dep file we want | |
908 | # NOTE: We can't use shift here because we need ${D}* to be valid | |
909 | prevarg= | |
910 | for arg in ${D}* ; do | |
911 | if test "${D}prevarg" = "-o"; then | |
912 | objfile=${D}arg | |
913 | else | |
914 | case "${D}arg" in | |
915 | -* ) | |
916 | ;; | |
917 | * ) | |
918 | srcfile=${D}arg | |
919 | ;; | |
920 | esac | |
921 | fi | |
922 | prevarg="${D}arg" | |
923 | done | |
924 | ||
925 | objfilebase=\`basename ${D}objfile\` | |
926 | builddir=\`dirname ${D}objfile\` | |
927 | depsdir=${D}builddir/${D}DEPSDIRBASE | |
928 | mkdir -p ${D}depsdir | |
929 | ||
930 | ${D}* ${D}DEPSFLAG >${D}{depsdir}/${D}{objfilebase}.d | |
931 | exit 0 | |
932 | ||
933 | elif test ${D}DEPSMODE = unixcc; then | |
934 | ${D}* || exit ${D}? | |
935 | # Run compiler again with deps flag and redirect into the dep file. | |
936 | # It doesn't work if the '-o FILE' option is used, but without it the | |
937 | # dependency file will contain the wrong name for the object. So it is | |
938 | # removed from the command line, and the dep file is fixed with sed. | |
939 | cmd="" | |
940 | while test ${D}# -gt 0; do | |
941 | case "${D}1" in | |
942 | -o ) | |
943 | shift | |
944 | objfile=${D}1 | |
945 | ;; | |
946 | * ) | |
947 | eval arg${D}#=\\${D}1 | |
948 | cmd="${D}cmd \\${D}arg${D}#" | |
949 | ;; | |
950 | esac | |
951 | shift | |
952 | done | |
953 | ||
954 | objfilebase=\`basename ${D}objfile\` | |
955 | builddir=\`dirname ${D}objfile\` | |
956 | depsdir=${D}builddir/${D}DEPSDIRBASE | |
957 | mkdir -p ${D}depsdir | |
958 | ||
959 | eval "${D}cmd ${D}DEPSFLAG" | sed "s|.*:|${D}objfile:|" >${D}{depsdir}/${D}{objfilebase}.d | |
960 | exit 0 | |
961 | ||
962 | else | |
963 | ${D}* | |
964 | exit ${D}? | |
965 | fi | |
966 | EOF | |
967 | dnl ===================== bk-deps ends here ===================== | |
968 | ]) | |
969 | ||
970 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH], | |
971 | [ | |
972 | dnl ===================== shared-ld-sh begins here ===================== | |
973 | dnl (Created by merge-scripts.py from shared-ld-sh | |
974 | dnl file do not edit here!) | |
975 | D='$' | |
976 | cat <<EOF >shared-ld-sh | |
977 | #!/bin/sh | |
978 | #----------------------------------------------------------------------------- | |
979 | #-- Name: distrib/mac/shared-ld-sh | |
980 | #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X | |
981 | #-- Author: Gilles Depeyrot | |
982 | #-- Copyright: (c) 2002 Gilles Depeyrot | |
983 | #-- Licence: any use permitted | |
984 | #----------------------------------------------------------------------------- | |
985 | ||
986 | verbose=0 | |
987 | args="" | |
988 | objects="" | |
989 | linking_flag="-dynamiclib" | |
990 | ldargs="-r -keep_private_externs -nostdlib" | |
991 | ||
992 | if test "x${D}CXX" = "x"; then | |
993 | CXX="c++" | |
994 | fi | |
995 | ||
996 | while test ${D}# -gt 0; do | |
997 | case ${D}1 in | |
998 | ||
999 | -v) | |
1000 | verbose=1 | |
1001 | ;; | |
1002 | ||
1003 | -o|-compatibility_version|-current_version|-framework|-undefined|-install_name) | |
1004 | # collect these options and values | |
1005 | args="${D}{args} ${D}1 ${D}2" | |
1006 | shift | |
1007 | ;; | |
1008 | ||
1009 | -arch|-isysroot) | |
1010 | # collect these options and values | |
1011 | ldargs="${D}{ldargs} ${D}1 ${D}2" | |
1012 | shift | |
1013 | ;; | |
1014 | ||
1015 | -s|-Wl,*) | |
1016 | # collect these load args | |
1017 | ldargs="${D}{ldargs} ${D}1" | |
1018 | ;; | |
1019 | ||
1020 | -l*|-L*|-flat_namespace|-headerpad_max_install_names) | |
1021 | # collect these options | |
1022 | args="${D}{args} ${D}1" | |
1023 | ;; | |
1024 | ||
1025 | -dynamiclib|-bundle) | |
1026 | linking_flag="${D}1" | |
1027 | ;; | |
1028 | ||
1029 | -*) | |
1030 | echo "shared-ld: unhandled option '${D}1'" | |
1031 | exit 1 | |
1032 | ;; | |
1033 | ||
1034 | *.o | *.a | *.dylib) | |
1035 | # collect object files | |
1036 | objects="${D}{objects} ${D}1" | |
1037 | ;; | |
1038 | ||
1039 | *) | |
1040 | echo "shared-ld: unhandled argument '${D}1'" | |
1041 | exit 1 | |
1042 | ;; | |
1043 | ||
1044 | esac | |
1045 | shift | |
1046 | done | |
1047 | ||
1048 | status=0 | |
1049 | ||
1050 | # | |
1051 | # Link one module containing all the others | |
1052 | # | |
1053 | if test ${D}{verbose} = 1; then | |
1054 | echo "${D}CXX ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o" | |
1055 | fi | |
1056 | ${D}CXX ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o | |
1057 | status=${D}? | |
1058 | ||
1059 | # | |
1060 | # Link the shared library from the single module created, but only if the | |
1061 | # previous command didn't fail: | |
1062 | # | |
1063 | if test ${D}{status} = 0; then | |
1064 | if test ${D}{verbose} = 1; then | |
1065 | echo "${D}CXX ${D}{linking_flag} master.${D}${D}.o ${D}{args}" | |
1066 | fi | |
1067 | ${D}CXX ${D}{linking_flag} master.${D}${D}.o ${D}{args} | |
1068 | status=${D}? | |
1069 | fi | |
1070 | ||
1071 | # | |
1072 | # Remove intermediate module | |
1073 | # | |
1074 | rm -f master.${D}${D}.o | |
1075 | ||
1076 | exit ${D}status | |
1077 | EOF | |
1078 | dnl ===================== shared-ld-sh ends here ===================== | |
1079 | ]) | |
1080 | ||
1081 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH], | |
1082 | [ | |
1083 | dnl ===================== bk-make-pch begins here ===================== | |
1084 | dnl (Created by merge-scripts.py from bk-make-pch | |
1085 | dnl file do not edit here!) | |
1086 | D='$' | |
1087 | cat <<EOF >bk-make-pch | |
1088 | #!/bin/sh | |
1089 | ||
1090 | # This script is part of Bakefile (http://www.bakefile.org) autoconf | |
1091 | # script. It is used to generated precompiled headers. | |
1092 | # | |
1093 | # Permission is given to use this file in any way. | |
1094 | ||
1095 | outfile="${D}{1}" | |
1096 | header="${D}{2}" | |
1097 | shift | |
1098 | shift | |
1099 | ||
1100 | builddir=\`echo ${D}outfile | sed -e 's,/\\.pch/.*${D},,g'\` | |
1101 | ||
1102 | compiler="" | |
1103 | headerfile="" | |
1104 | ||
1105 | while test ${D}{#} -gt 0; do | |
1106 | add_to_cmdline=1 | |
1107 | case "${D}{1}" in | |
1108 | -I* ) | |
1109 | incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\` | |
1110 | if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then | |
1111 | headerfile="${D}{incdir}/${D}{header}" | |
1112 | fi | |
1113 | ;; | |
1114 | -use-pch|-use_pch|-pch-use ) | |
1115 | shift | |
1116 | add_to_cmdline=0 | |
1117 | ;; | |
1118 | esac | |
1119 | if test ${D}add_to_cmdline = 1 ; then | |
1120 | compiler="${D}{compiler} ${D}{1}" | |
1121 | fi | |
1122 | shift | |
1123 | done | |
1124 | ||
1125 | if test "x${D}{headerfile}" = "x" ; then | |
1126 | echo "error: can't find header ${D}{header} in include paths" >&2 | |
1127 | else | |
1128 | if test -f ${D}{outfile} ; then | |
1129 | rm -f ${D}{outfile} | |
1130 | else | |
1131 | mkdir -p \`dirname ${D}{outfile}\` | |
1132 | fi | |
1133 | depsfile="${D}{builddir}/.deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d" | |
1134 | mkdir -p ${D}{builddir}/.deps | |
1135 | if test "x${GCC_PCH}" = "x1" ; then | |
1136 | # can do this because gcc is >= 3.4: | |
1137 | ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}" | |
1138 | elif test "x${ICC_PCH}" = "x1" ; then | |
1139 | filename=pch_gen-${D}${D} | |
1140 | file=${D}{filename}.c | |
1141 | dfile=${D}{filename}.d | |
1142 | cat > ${D}file <<EOT | |
1143 | #include "${D}header" | |
1144 | EOT | |
1145 | # using -MF icc complains about differing command lines in creation/use | |
1146 | ${D}compiler -c ${ICC_PCH_CREATE_SWITCH} ${D}outfile -MMD ${D}file && \\ | |
1147 | sed -e "s,^.*:,${D}outfile:," -e "s, ${D}file,," < ${D}dfile > ${D}depsfile && \\ | |
1148 | rm -f ${D}file ${D}dfile ${D}{filename}.o | |
1149 | fi | |
1150 | exit ${D}{?} | |
1151 | fi | |
1152 | EOF | |
1153 | dnl ===================== bk-make-pch ends here ===================== | |
1154 | ]) |