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