]> git.saurik.com Git - wxWidgets.git/blame_incremental - build/aclocal/bakefile.m4
rebaked after wxCollapsiblePane move to core and using bakefile rev 928 which fixes...
[wxWidgets.git] / build / aclocal / bakefile.m4
... / ...
CommitLineData
1dnl ---------------------------------------------------------------------------
2dnl Support macros for makefiles generated by BAKEFILE.
3dnl ---------------------------------------------------------------------------
4
5dnl Lots of compiler & linker detection code contained here was taken from
6dnl wxWindows configure.in script (see http://www.wxwindows.org)
7
8
9
10dnl ---------------------------------------------------------------------------
11dnl AC_BAKEFILE_GNUMAKE
12dnl
13dnl Detects GNU make
14dnl ---------------------------------------------------------------------------
15
16AC_DEFUN([AC_BAKEFILE_GNUMAKE],
17[
18 dnl does make support "-include" (only GNU make does AFAIK)?
19 AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
20 [
21 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
22 egrep -s GNU > /dev/null); then
23 bakefile_cv_prog_makeisgnu="yes"
24 else
25 bakefile_cv_prog_makeisgnu="no"
26 fi
27 ])
28
29 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
30 IF_GNU_MAKE=""
31 else
32 IF_GNU_MAKE="#"
33 fi
34 AC_SUBST(IF_GNU_MAKE)
35])
36
37dnl ---------------------------------------------------------------------------
38dnl AC_BAKEFILE_PLATFORM
39dnl
40dnl Detects platform and sets PLATFORM_XXX variables accordingly
41dnl ---------------------------------------------------------------------------
42
43AC_DEFUN([AC_BAKEFILE_PLATFORM],
44[
45 PLATFORM_UNIX=0
46 PLATFORM_WIN32=0
47 PLATFORM_MSDOS=0
48 PLATFORM_MAC=0
49 PLATFORM_MACOS=0
50 PLATFORM_MACOSX=0
51 PLATFORM_OS2=0
52 PLATFORM_BEOS=0
53
54 if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then
55 case "${BAKEFILE_HOST}" in
56 *-*-mingw32* )
57 PLATFORM_WIN32=1
58 ;;
59 *-pc-msdosdjgpp )
60 PLATFORM_MSDOS=1
61 ;;
62 *-pc-os2_emx | *-pc-os2-emx )
63 PLATFORM_OS2=1
64 ;;
65 *-*-darwin* )
66 PLATFORM_MAC=1
67 PLATFORM_MACOSX=1
68 ;;
69 *-*-beos* )
70 PLATFORM_BEOS=1
71 ;;
72 powerpc-apple-macos* )
73 PLATFORM_MAC=1
74 PLATFORM_MACOS=1
75 ;;
76 * )
77 PLATFORM_UNIX=1
78 ;;
79 esac
80 else
81 case "$BAKEFILE_FORCE_PLATFORM" in
82 win32 )
83 PLATFORM_WIN32=1
84 ;;
85 msdos )
86 PLATFORM_MSDOS=1
87 ;;
88 os2 )
89 PLATFORM_OS2=1
90 ;;
91 darwin )
92 PLATFORM_MAC=1
93 PLATFORM_MACOSX=1
94 ;;
95 unix )
96 PLATFORM_UNIX=1
97 ;;
98 beos )
99 PLATFORM_BEOS=1
100 ;;
101 * )
102 AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM])
103 ;;
104 esac
105 fi
106
107 AC_SUBST(PLATFORM_UNIX)
108 AC_SUBST(PLATFORM_WIN32)
109 AC_SUBST(PLATFORM_MSDOS)
110 AC_SUBST(PLATFORM_MAC)
111 AC_SUBST(PLATFORM_MACOS)
112 AC_SUBST(PLATFORM_MACOSX)
113 AC_SUBST(PLATFORM_OS2)
114 AC_SUBST(PLATFORM_BEOS)
115])
116
117
118dnl ---------------------------------------------------------------------------
119dnl AC_BAKEFILE_PLATFORM_SPECIFICS
120dnl
121dnl Sets misc platform-specific settings
122dnl ---------------------------------------------------------------------------
123
124AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS],
125[
126 AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf],
127 [use OMF object format (OS/2)]),
128 [bk_os2_use_omf="$enableval"])
129
130 case "${BAKEFILE_HOST}" in
131 *-*-darwin* )
132 dnl For Unix to MacOS X porting instructions, see:
133 dnl http://fink.sourceforge.net/doc/porting/porting.html
134 if test "x$GCC" = "xyes"; then
135 CFLAGS="$CFLAGS -fno-common"
136 CXXFLAGS="$CXXFLAGS -fno-common"
137 fi
138 if test "x$XLCC" = "xyes"; then
139 CFLAGS="$CFLAGS -qnocommon"
140 CXXFLAGS="$CXXFLAGS -qnocommon"
141 fi
142 ;;
143
144 *-pc-os2_emx | *-pc-os2-emx )
145 if test "x$bk_os2_use_omf" = "xyes" ; then
146 AR=emxomfar
147 RANLIB=:
148 LDFLAGS="-Zomf $LDFLAGS"
149 CFLAGS="-Zomf $CFLAGS"
150 CXXFLAGS="-Zomf $CXXFLAGS"
151 OS2_LIBEXT="lib"
152 else
153 OS2_LIBEXT="a"
154 fi
155 ;;
156
157 i*86-*-beos* )
158 LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS"
159 ;;
160 esac
161])
162
163dnl ---------------------------------------------------------------------------
164dnl AC_BAKEFILE_SUFFIXES
165dnl
166dnl Detects shared various suffixes for shared libraries, libraries, programs,
167dnl plugins etc.
168dnl ---------------------------------------------------------------------------
169
170AC_DEFUN([AC_BAKEFILE_SUFFIXES],
171[
172 SO_SUFFIX="so"
173 SO_SUFFIX_MODULE="so"
174 EXEEXT=""
175 LIBPREFIX="lib"
176 LIBEXT=".a"
177 DLLPREFIX="lib"
178 DLLPREFIX_MODULE=""
179 DLLIMP_SUFFIX=""
180 dlldir="$libdir"
181
182 case "${BAKEFILE_HOST}" in
183 *-hp-hpux* )
184 SO_SUFFIX="sl"
185 SO_SUFFIX_MODULE="sl"
186 ;;
187 *-*-aix* )
188 dnl quoting from
189 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
190 dnl Both archive libraries and shared libraries on AIX have an
191 dnl .a extension. This will explain why you can't link with an
192 dnl .so and why it works with the name changed to .a.
193 SO_SUFFIX="a"
194 SO_SUFFIX_MODULE="a"
195 ;;
196 *-*-cygwin* )
197 SO_SUFFIX="dll"
198 SO_SUFFIX_MODULE="dll"
199 DLLIMP_SUFFIX="dll.a"
200 EXEEXT=".exe"
201 DLLPREFIX="cyg"
202 dlldir="$bindir"
203 ;;
204 *-*-mingw32* )
205 SO_SUFFIX="dll"
206 SO_SUFFIX_MODULE="dll"
207 DLLIMP_SUFFIX="dll.a"
208 EXEEXT=".exe"
209 DLLPREFIX=""
210 dlldir="$bindir"
211 ;;
212 *-pc-msdosdjgpp )
213 EXEEXT=".exe"
214 DLLPREFIX=""
215 dlldir="$bindir"
216 ;;
217 *-pc-os2_emx | *-pc-os2-emx )
218 SO_SUFFIX="dll"
219 SO_SUFFIX_MODULE="dll"
220 DLLIMP_SUFFIX=$OS2_LIBEXT
221 EXEEXT=".exe"
222 DLLPREFIX=""
223 LIBPREFIX=""
224 LIBEXT=".$OS2_LIBEXT"
225 dlldir="$bindir"
226 ;;
227 *-*-darwin* )
228 SO_SUFFIX="dylib"
229 SO_SUFFIX_MODULE="bundle"
230 ;;
231 esac
232
233 if test "x$DLLIMP_SUFFIX" = "x" ; then
234 DLLIMP_SUFFIX="$SO_SUFFIX"
235 fi
236
237 AC_SUBST(SO_SUFFIX)
238 AC_SUBST(SO_SUFFIX_MODULE)
239 AC_SUBST(DLLIMP_SUFFIX)
240 AC_SUBST(EXEEXT)
241 AC_SUBST(LIBPREFIX)
242 AC_SUBST(LIBEXT)
243 AC_SUBST(DLLPREFIX)
244 AC_SUBST(DLLPREFIX_MODULE)
245 AC_SUBST(dlldir)
246])
247
248
249dnl ---------------------------------------------------------------------------
250dnl AC_BAKEFILE_SHARED_LD
251dnl
252dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
253dnl and SHARED_LD_CXX.
254dnl ---------------------------------------------------------------------------
255
256AC_DEFUN([AC_BAKEFILE_SHARED_LD],
257[
258 dnl the extra compiler flags needed for compilation of shared library
259 PIC_FLAG=""
260 if test "x$GCC" = "xyes"; then
261 dnl the switch for gcc is the same under all platforms
262 PIC_FLAG="-fPIC"
263 fi
264
265 dnl Defaults for GCC and ELF .so shared libs:
266 SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o"
267 SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o"
268 WINDOWS_IMPLIB=0
269
270 case "${BAKEFILE_HOST}" in
271 *-hp-hpux* )
272 dnl default settings are good for gcc but not for the native HP-UX
273 if test "x$GCC" != "xyes"; then
274 dnl no idea why it wants it, but it does
275 LDFLAGS="$LDFLAGS -L/usr/lib"
276
277 SHARED_LD_CC="${CC} -b -o"
278 SHARED_LD_CXX="${CXX} -b -o"
279 PIC_FLAG="+Z"
280 fi
281 ;;
282
283 *-*-linux* )
284 if test "x$GCC" != "xyes"; then
285 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
286 [
287 AC_TRY_COMPILE([],
288 [
289 #ifndef __INTEL_COMPILER
290 This is not ICC
291 #endif
292 ],
293 bakefile_cv_prog_icc=yes,
294 bakefile_cv_prog_icc=no
295 )
296 ])
297 if test "$bakefile_cv_prog_icc" = "yes"; then
298 PIC_FLAG="-KPIC"
299 fi
300 fi
301 ;;
302
303 *-*-solaris2* )
304 if test "x$GCC" != xyes ; then
305 SHARED_LD_CC="${CC} -G -o"
306 SHARED_LD_CXX="${CXX} -G -o"
307 PIC_FLAG="-KPIC"
308 fi
309 ;;
310
311 *-*-darwin* )
312 AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH
313 chmod +x shared-ld-sh
314
315 SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
316 SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
317
318 dnl Most apps benefit from being fully binded (its faster and static
319 dnl variables initialized at startup work).
320 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
321 dnl or with a double stage link in order to create a single module
322 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
323
324 dnl If using newer dev tools then there is a -single_module flag that
325 dnl we can use to do this for dylibs, otherwise we'll need to use a helper
326 dnl script. Check the version of gcc to see which way we can go:
327 AC_CACHE_CHECK([for gcc 3.1 or later], bakefile_cv_gcc31, [
328 AC_TRY_COMPILE([],
329 [
330 #if (__GNUC__ < 3) || \
331 ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
332 This is old gcc
333 #endif
334 ],
335 [
336 bakefile_cv_gcc31=yes
337 ],
338 [
339 bakefile_cv_gcc31=no
340 ]
341 )
342 ])
343 if test "$bakefile_cv_gcc31" = "no"; then
344 dnl Use the shared-ld-sh helper script
345 SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
346 SHARED_LD_CXX="$SHARED_LD_CC"
347 else
348 dnl Use the -single_module flag and let the linker do it for us
349 SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
350 SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
351 fi
352
353 if test "x$GCC" == "xyes"; then
354 PIC_FLAG="-dynamic -fPIC"
355 fi
356 if test "x$XLCC" = "xyes"; then
357 PIC_FLAG="-dynamic -DPIC"
358 fi
359 ;;
360
361 *-*-aix* )
362 if test "x$GCC" = "xyes"; then
363 dnl at least gcc 2.95 warns that -fPIC is ignored when
364 dnl compiling each and every file under AIX which is annoying,
365 dnl so don't use it there (it's useless as AIX runs on
366 dnl position-independent architectures only anyhow)
367 PIC_FLAG=""
368
369 dnl -bexpfull is needed by AIX linker to export all symbols (by
370 dnl default it doesn't export any and even with -bexpall it
371 dnl doesn't export all C++ support symbols, e.g. vtable
372 dnl pointers) but it's only available starting from 5.1 (with
373 dnl maintenance pack 2, whatever this is), see
374 dnl http://www-128.ibm.com/developerworks/eserver/articles/gnu.html
375 case "${BAKEFILE_HOST}" in
376 *-*-aix5* )
377 LD_EXPFULL="-Wl,-bexpfull"
378 ;;
379 esac
380
381 SHARED_LD_CC="\$(CC) -shared $LD_EXPFULL -o"
382 SHARED_LD_CXX="\$(CXX) -shared $LD_EXPFULL -o"
383 else
384 dnl FIXME: makeC++SharedLib is obsolete, what should we do for
385 dnl recent AIX versions?
386 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
387 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
388 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
389 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
390 fi
391 ;;
392
393 *-*-beos* )
394 dnl can't use gcc under BeOS for shared library creation because it
395 dnl complains about missing 'main'
396 SHARED_LD_CC="${LD} -nostart -o"
397 SHARED_LD_CXX="${LD} -nostart -o"
398 ;;
399
400 *-*-irix* )
401 dnl default settings are ok for gcc
402 if test "x$GCC" != "xyes"; then
403 PIC_FLAG="-KPIC"
404 fi
405 ;;
406
407 *-*-cygwin* | *-*-mingw32* )
408 PIC_FLAG=""
409 SHARED_LD_CC="\$(CC) -shared -o"
410 SHARED_LD_CXX="\$(CXX) -shared -o"
411 WINDOWS_IMPLIB=1
412 ;;
413
414 *-pc-os2_emx | *-pc-os2-emx )
415 SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
416 SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
417 PIC_FLAG=""
418 AC_BAKEFILE_CREATE_FILE_DLLAR_SH
419 chmod +x dllar.sh
420 ;;
421
422 powerpc-apple-macos* | \
423 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | *-*-k*bsd*-gnu | \
424 *-*-sunos4* | \
425 *-*-osf* | \
426 *-*-dgux5* | \
427 *-*-sysv5* | \
428 *-pc-msdosdjgpp )
429 dnl defaults are ok
430 ;;
431
432 *)
433 AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
434 esac
435
436 if test "x$PIC_FLAG" != "x" ; then
437 PIC_FLAG="$PIC_FLAG -DPIC"
438 fi
439
440 if test "x$SHARED_LD_MODULE_CC" = "x" ; then
441 SHARED_LD_MODULE_CC="$SHARED_LD_CC"
442 fi
443 if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
444 SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
445 fi
446
447 AC_SUBST(SHARED_LD_CC)
448 AC_SUBST(SHARED_LD_CXX)
449 AC_SUBST(SHARED_LD_MODULE_CC)
450 AC_SUBST(SHARED_LD_MODULE_CXX)
451 AC_SUBST(PIC_FLAG)
452 AC_SUBST(WINDOWS_IMPLIB)
453])
454
455
456dnl ---------------------------------------------------------------------------
457dnl AC_BAKEFILE_SHARED_VERSIONS
458dnl
459dnl Detects linker options for attaching versions (sonames) to shared libs.
460dnl ---------------------------------------------------------------------------
461
462AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
463[
464 USE_SOVERSION=0
465 USE_SOVERLINUX=0
466 USE_SOVERSOLARIS=0
467 USE_SOVERCYGWIN=0
468 USE_SOSYMLINKS=0
469 USE_MACVERSION=0
470 SONAME_FLAG=
471
472 case "${BAKEFILE_HOST}" in
473 *-*-linux* | *-*-freebsd* | *-*-k*bsd*-gnu )
474 SONAME_FLAG="-Wl,-soname,"
475 USE_SOVERSION=1
476 USE_SOVERLINUX=1
477 USE_SOSYMLINKS=1
478 ;;
479
480 *-*-solaris2* )
481 SONAME_FLAG="-h "
482 USE_SOVERSION=1
483 USE_SOVERSOLARIS=1
484 USE_SOSYMLINKS=1
485 ;;
486
487 *-*-darwin* )
488 USE_MACVERSION=1
489 USE_SOVERSION=1
490 USE_SOSYMLINKS=1
491 ;;
492
493 *-*-cygwin* )
494 USE_SOVERSION=1
495 USE_SOVERCYGWIN=1
496 ;;
497 esac
498
499 AC_SUBST(USE_SOVERSION)
500 AC_SUBST(USE_SOVERLINUX)
501 AC_SUBST(USE_SOVERSOLARIS)
502 AC_SUBST(USE_SOVERCYGWIN)
503 AC_SUBST(USE_MACVERSION)
504 AC_SUBST(USE_SOSYMLINKS)
505 AC_SUBST(SONAME_FLAG)
506])
507
508
509dnl ---------------------------------------------------------------------------
510dnl AC_BAKEFILE_DEPS
511dnl
512dnl Detects available C/C++ dependency tracking options
513dnl ---------------------------------------------------------------------------
514
515AC_DEFUN([AC_BAKEFILE_DEPS],
516[
517 AC_ARG_ENABLE([dependency-tracking],
518 AS_HELP_STRING([--disable-dependency-tracking],
519 [don't use dependency tracking even if the compiler can]),
520 [bk_use_trackdeps="$enableval"])
521
522 AC_MSG_CHECKING([for dependency tracking method])
523
524 BK_DEPS=""
525 if test "x$bk_use_trackdeps" = "xno" ; then
526 DEPS_TRACKING=0
527 AC_MSG_RESULT([disabled])
528 else
529 DEPS_TRACKING=1
530
531 if test "x$GCC" = "xyes"; then
532 DEPSMODE=gcc
533 case "${BAKEFILE_HOST}" in
534 *-*-darwin* )
535 dnl -cpp-precomp (the default) conflicts with -MMD option
536 dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
537 DEPSFLAG="-no-cpp-precomp -MMD"
538 ;;
539 * )
540 DEPSFLAG="-MMD"
541 ;;
542 esac
543 AC_MSG_RESULT([gcc])
544 elif test "x$MWCC" = "xyes"; then
545 DEPSMODE=mwcc
546 DEPSFLAG="-MM"
547 AC_MSG_RESULT([mwcc])
548 elif test "x$SUNCC" = "xyes"; then
549 DEPSMODE=unixcc
550 DEPSFLAG="-xM1"
551 AC_MSG_RESULT([Sun cc])
552 elif test "x$SGICC" = "xyes"; then
553 DEPSMODE=unixcc
554 DEPSFLAG="-M"
555 AC_MSG_RESULT([SGI cc])
556 elif test "x$HPCC" = "xyes"; then
557 DEPSMODE=unixcc
558 DEPSFLAG="+make"
559 AC_MSG_RESULT([HP cc])
560 elif test "x$COMPAQCC" = "xyes"; then
561 DEPSMODE=gcc
562 DEPSFLAG="-MD"
563 AC_MSG_RESULT([Compaq cc])
564 else
565 DEPS_TRACKING=0
566 AC_MSG_RESULT([none])
567 fi
568
569 if test $DEPS_TRACKING = 1 ; then
570 AC_BAKEFILE_CREATE_FILE_BK_DEPS
571 chmod +x bk-deps
572 dnl FIXME: make this $(top_builddir)/bk-deps once autoconf-2.60
573 dnl is required (and so top_builddir is never empty):
574 BK_DEPS="`pwd`/bk-deps"
575 fi
576 fi
577
578 AC_SUBST(DEPS_TRACKING)
579 AC_SUBST(BK_DEPS)
580])
581
582dnl ---------------------------------------------------------------------------
583dnl AC_BAKEFILE_CHECK_BASIC_STUFF
584dnl
585dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
586dnl or "install"
587dnl ---------------------------------------------------------------------------
588
589AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
590[
591 AC_PROG_RANLIB
592 AC_PROG_INSTALL
593 AC_PROG_LN_S
594
595 AC_PROG_MAKE_SET
596 AC_SUBST(MAKE_SET)
597
598 if test "x$SUNCXX" = "xyes"; then
599 dnl Sun C++ compiler requires special way of creating static libs;
600 dnl see here for more details:
601 dnl https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1229751&group_id=9863
602 AR=$CXX
603 AC_SUBST(AR)
604 AROPTIONS="-xar -o"
605 else
606 AC_CHECK_TOOL(AR, ar, ar)
607 AROPTIONS=rcu
608 fi
609 AC_SUBST(AROPTIONS)
610
611 AC_CHECK_TOOL(STRIP, strip, :)
612 AC_CHECK_TOOL(NM, nm, :)
613
614 case ${BAKEFILE_HOST} in
615 *-hp-hpux* )
616 dnl HP-UX install doesn't handle the "-d" switch so don't
617 dnl use it there
618 INSTALL_DIR="mkdir -p"
619 ;;
620 * )
621 dnl we must refer to makefile's $(INSTALL) variable and not
622 dnl current value of shell variable, hence the single quoting:
623 INSTALL_DIR='$(INSTALL) -d'
624 ;;
625 esac
626 AC_SUBST(INSTALL_DIR)
627
628 LDFLAGS_GUI=
629 case ${BAKEFILE_HOST} in
630 *-*-cygwin* | *-*-mingw32* )
631 LDFLAGS_GUI="-mwindows"
632 esac
633 AC_SUBST(LDFLAGS_GUI)
634])
635
636
637dnl ---------------------------------------------------------------------------
638dnl AC_BAKEFILE_RES_COMPILERS
639dnl
640dnl Checks for presence of resource compilers for win32 or mac
641dnl ---------------------------------------------------------------------------
642
643AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
644[
645 case ${BAKEFILE_HOST} in
646 *-*-cygwin* | *-*-mingw32* )
647 dnl Check for win32 resources compiler:
648 AC_CHECK_TOOL(WINDRES, windres)
649 ;;
650
651 *-*-darwin* | powerpc-apple-macos* )
652 AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
653 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
654 ;;
655 esac
656
657 AC_SUBST(WINDRES)
658 AC_SUBST(REZ)
659 AC_SUBST(SETFILE)
660])
661
662dnl ---------------------------------------------------------------------------
663dnl AC_BAKEFILE_PRECOMP_HEADERS
664dnl
665dnl Check for precompiled headers support (GCC >= 3.4)
666dnl ---------------------------------------------------------------------------
667
668AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
669[
670
671 AC_ARG_ENABLE([precomp-headers],
672 AS_HELP_STRING([--disable-precomp-headers],
673 [don't use precompiled headers even if compiler can]),
674 [bk_use_pch="$enableval"])
675
676 GCC_PCH=0
677 ICC_PCH=0
678 USE_PCH=0
679 BK_MAKE_PCH=""
680
681 case ${BAKEFILE_HOST} in
682 *-*-cygwin* )
683 dnl PCH support is broken in cygwin gcc because of unportable
684 dnl assumptions about mmap() in gcc code which make PCH generation
685 dnl fail erratically; disable PCH completely until this is fixed
686 bk_use_pch="no"
687 ;;
688 esac
689
690 if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
691 if test "x$GCC" = "xyes"; then
692 dnl test if we have gcc-3.4:
693 AC_MSG_CHECKING([if the compiler supports precompiled headers])
694 AC_TRY_COMPILE([],
695 [
696 #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
697 There is no PCH support
698 #endif
699 #if (__GNUC__ < 3)
700 There is no PCH support
701 #endif
702 #if (__GNUC__ == 3) && \
703 ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
704 ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3))) || \
705 ( defined(__INTEL_COMPILER) )
706 There is no PCH support
707 #endif
708 ],
709 [
710 AC_MSG_RESULT([yes])
711 GCC_PCH=1
712 ],
713 [
714 AC_TRY_COMPILE([],
715 [
716 #if !defined(__INTEL_COMPILER) || \
717 (__INTEL_COMPILER < 800)
718 There is no PCH support
719 #endif
720 ],
721 [
722 AC_MSG_RESULT([yes])
723 ICC_PCH=1
724 ],
725 [
726 AC_MSG_RESULT([no])
727 ])
728 ])
729 if test $GCC_PCH = 1 -o $ICC_PCH = 1 ; then
730 USE_PCH=1
731 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
732 chmod +x bk-make-pch
733 dnl FIXME: make this $(top_builddir)/bk-make-pch once
734 dnl autoconf-2.60 is required (and so top_builddir is
735 dnl never empty):
736 BK_MAKE_PCH="`pwd`/bk-make-pch"
737 fi
738 fi
739 fi
740
741 AC_SUBST(GCC_PCH)
742 AC_SUBST(ICC_PCH)
743 AC_SUBST(BK_MAKE_PCH)
744])
745
746
747
748dnl ---------------------------------------------------------------------------
749dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
750dnl
751dnl To be used in configure.in of any project using Bakefile-generated mks
752dnl
753dnl Behaviour can be modified by setting following variables:
754dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
755dnl to perform check for basic tools like ranlib
756dnl BAKEFILE_HOST set this to override host detection, defaults
757dnl to ${host}
758dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
759dnl
760dnl Example usage:
761dnl
762dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
763dnl
764dnl (replace FOO with m4_include above, aclocal would die otherwise)
765dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
766dnl we can do...)
767dnl ---------------------------------------------------------------------------
768
769AC_DEFUN([AC_BAKEFILE],
770[
771 AC_PREREQ([2.58])
772
773 if test "x$BAKEFILE_HOST" = "x"; then
774 if test "x${host}" = "x" ; then
775 AC_MSG_ERROR([You must call the autoconf "CANONICAL_HOST" macro in your configure.ac (or .in) file.])
776 fi
777
778 BAKEFILE_HOST="${host}"
779 fi
780
781 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
782 AC_BAKEFILE_CHECK_BASIC_STUFF
783 fi
784 AC_BAKEFILE_GNUMAKE
785 AC_BAKEFILE_PLATFORM
786 AC_BAKEFILE_PLATFORM_SPECIFICS
787 AC_BAKEFILE_SUFFIXES
788 AC_BAKEFILE_SHARED_LD
789 AC_BAKEFILE_SHARED_VERSIONS
790 AC_BAKEFILE_DEPS
791 AC_BAKEFILE_RES_COMPILERS
792
793 BAKEFILE_BAKEFILE_M4_VERSION="0.2.0"
794
795 dnl includes autoconf_inc.m4:
796 $1
797
798 if test "$BAKEFILE_AUTOCONF_INC_M4_VERSION" = "" ; then
799 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)?])
800 fi
801
802 if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
803 AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
804 fi
805])
806
807
808dnl ---------------------------------------------------------------------------
809dnl Embedded copies of helper scripts follow:
810dnl ---------------------------------------------------------------------------
811
812AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
813[
814dnl ===================== dllar.sh begins here =====================
815dnl (Created by merge-scripts.py from dllar.sh
816dnl file do not edit here!)
817D='$'
818cat <<EOF >dllar.sh
819#!/bin/sh
820#
821# dllar - a tool to build both a .dll and an .a file
822# from a set of object (.o) files for EMX/OS2.
823#
824# Written by Andrew Zabolotny, bit@freya.etu.ru
825# Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de
826#
827# This script will accept a set of files on the command line.
828# All the public symbols from the .o files will be exported into
829# a .DEF file, then linker will be run (through gcc) against them to
830# build a shared library consisting of all given .o files. All libraries
831# (.a) will be first decompressed into component .o files then act as
832# described above. You can optionally give a description (-d "description")
833# which will be put into .DLL. To see the list of accepted options (as well
834# as command-line format) simply run this program without options. The .DLL
835# is built to be imported by name (there is no guarantee that new versions
836# of the library you build will have same ordinals for same symbols).
837#
838# dllar is free software; you can redistribute it and/or modify
839# it under the terms of the GNU General Public License as published by
840# the Free Software Foundation; either version 2, or (at your option)
841# any later version.
842#
843# dllar is distributed in the hope that it will be useful,
844# but WITHOUT ANY WARRANTY; without even the implied warranty of
845# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
846# GNU General Public License for more details.
847#
848# You should have received a copy of the GNU General Public License
849# along with dllar; see the file COPYING. If not, write to the Free
850# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
851# 02111-1307, USA.
852
853# To successfuly run this program you will need:
854# - Current drive should have LFN support (HPFS, ext2, network, etc)
855# (Sometimes dllar generates filenames which won't fit 8.3 scheme)
856# - gcc
857# (used to build the .dll)
858# - emxexp
859# (used to create .def file from .o files)
860# - emximp
861# (used to create .a file from .def file)
862# - GNU text utilites (cat, sort, uniq)
863# used to process emxexp output
864# - GNU file utilities (mv, rm)
865# - GNU sed
866# - lxlite (optional, see flag below)
867# (used for general .dll cleanup)
868#
869
870flag_USE_LXLITE=1;
871
872#
873# helper functions
874# basnam, variant of basename, which does _not_ remove the path, _iff_
875# second argument (suffix to remove) is given
876basnam(){
877 case ${D}# in
878 1)
879 echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
880 ;;
881 2)
882 echo ${D}1 | sed 's/'${D}2'${D}//'
883 ;;
884 *)
885 echo "error in basnam ${D}*"
886 exit 8
887 ;;
888 esac
889}
890
891# Cleanup temporary files and output
892CleanUp() {
893 cd ${D}curDir
894 for i in ${D}inputFiles ; do
895 case ${D}i in
896 *!)
897 rm -rf \`basnam ${D}i !\`
898 ;;
899 *)
900 ;;
901 esac
902 done
903
904 # Kill result in case of failure as there is just to many stupid make/nmake
905 # things out there which doesn't do this.
906 if @<:@ ${D}# -eq 0 @:>@; then
907 rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
908 fi
909}
910
911# Print usage and exit script with rc=1.
912PrintHelp() {
913 echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@'
914 echo ' @<:@-name-mangler-script script.sh@:>@'
915 echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@'
916 echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"'
917 echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@'
918 echo ' @<:@*.o@:>@ @<:@*.a@:>@'
919 echo '*> "output_file" should have no extension.'
920 echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
921 echo ' The import library name is derived from this and is set to "name".a,'
922 echo ' unless overridden by -import'
923 echo '*> "importlib_name" should have no extension.'
924 echo ' If it has the .o, or .a extension, it is automatically removed.'
925 echo ' This name is used as the import library name and may be longer and'
926 echo ' more descriptive than the DLL name which has to follow the old '
927 echo ' 8.3 convention of FAT.'
928 echo '*> "script.sh may be given to override the output_file name by a'
929 echo ' different name. It is mainly useful if the regular make process'
930 echo ' of some package does not take into account OS/2 restriction of'
931 echo ' DLL name lengths. It takes the importlib name as input and is'
932 echo ' supposed to procude a shorter name as output. The script should'
933 echo ' expect to get importlib_name without extension and should produce'
934 echo ' a (max.) 8 letter name without extension.'
935 echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
936 echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
937 echo ' These flags will be put at the start of GCC command line.'
938 echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.'
939 echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define'
940 echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
941 echo ' If the last character of a symbol is "*", all symbols beginning'
942 echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
943 echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
944 echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
945 echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s'
946 echo ' C runtime DLLs.'
947 echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.'
948 echo '*> All other switches (for example -L./ or -lmylib) will be passed'
949 echo ' unchanged to GCC at the end of command line.'
950 echo '*> If you create a DLL from a library and you do not specify -o,'
951 echo ' the basename for DLL and import library will be set to library name,'
952 echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
953 echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
954 echo ' library will be renamed into gcc_s.a.'
955 echo '--------'
956 echo 'Example:'
957 echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
958 echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
959 CleanUp
960 exit 1
961}
962
963# Execute a command.
964# If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
965# @Uses Whatever CleanUp() uses.
966doCommand() {
967 echo "${D}*"
968 eval ${D}*
969 rcCmd=${D}?
970
971 if @<:@ ${D}rcCmd -ne 0 @:>@; then
972 echo "command failed, exit code="${D}rcCmd
973 CleanUp
974 exit ${D}rcCmd
975 fi
976}
977
978# main routine
979# setup globals
980cmdLine=${D}*
981outFile=""
982outimpFile=""
983inputFiles=""
984renameScript=""
985description=""
986CC=gcc.exe
987CFLAGS="-s -Zcrtdll"
988EXTRA_CFLAGS=""
989EXPORT_BY_ORDINALS=0
990exclude_symbols=""
991library_flags=""
992curDir=\`pwd\`
993curDirS=curDir
994case ${D}curDirS in
995*/)
996 ;;
997*)
998 curDirS=${D}{curDirS}"/"
999 ;;
1000esac
1001# Parse commandline
1002libsToLink=0
1003omfLinking=0
1004while @<:@ ${D}1 @:>@; do
1005 case ${D}1 in
1006 -ord*)
1007 EXPORT_BY_ORDINALS=1;
1008 ;;
1009 -o*)
1010 shift
1011 outFile=${D}1
1012 ;;
1013 -i*)
1014 shift
1015 outimpFile=${D}1
1016 ;;
1017 -name-mangler-script)
1018 shift
1019 renameScript=${D}1
1020 ;;
1021 -d*)
1022 shift
1023 description=${D}1
1024 ;;
1025 -f*)
1026 shift
1027 CFLAGS=${D}1
1028 ;;
1029 -c*)
1030 shift
1031 CC=${D}1
1032 ;;
1033 -h*)
1034 PrintHelp
1035 ;;
1036 -ex*)
1037 shift
1038 exclude_symbols=${D}{exclude_symbols}${D}1" "
1039 ;;
1040 -libf*)
1041 shift
1042 library_flags=${D}{library_flags}${D}1" "
1043 ;;
1044 -nocrt*)
1045 CFLAGS="-s"
1046 ;;
1047 -nolxl*)
1048 flag_USE_LXLITE=0
1049 ;;
1050 -* | /*)
1051 case ${D}1 in
1052 -L* | -l*)
1053 libsToLink=1
1054 ;;
1055 -Zomf)
1056 omfLinking=1
1057 ;;
1058 *)
1059 ;;
1060 esac
1061 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1062 ;;
1063 *.dll)
1064 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`"
1065 if @<:@ ${D}omfLinking -eq 1 @:>@; then
1066 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib"
1067 else
1068 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a"
1069 fi
1070 ;;
1071 *)
1072 found=0;
1073 if @<:@ ${D}libsToLink -ne 0 @:>@; then
1074 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1075 else
1076 for file in ${D}1 ; do
1077 if @<:@ -f ${D}file @:>@; then
1078 inputFiles="${D}{inputFiles} ${D}file"
1079 found=1
1080 fi
1081 done
1082 if @<:@ ${D}found -eq 0 @:>@; then
1083 echo "ERROR: No file(s) found: "${D}1
1084 exit 8
1085 fi
1086 fi
1087 ;;
1088 esac
1089 shift
1090done # iterate cmdline words
1091
1092#
1093if @<:@ -z "${D}inputFiles" @:>@; then
1094 echo "dllar: no input files"
1095 PrintHelp
1096fi
1097
1098# Now extract all .o files from .a files
1099newInputFiles=""
1100for file in ${D}inputFiles ; do
1101 case ${D}file in
1102 *.a | *.lib)
1103 case ${D}file in
1104 *.a)
1105 suffix=".a"
1106 AR="ar"
1107 ;;
1108 *.lib)
1109 suffix=".lib"
1110 AR="emxomfar"
1111 EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf"
1112 ;;
1113 *)
1114 ;;
1115 esac
1116 dirname=\`basnam ${D}file ${D}suffix\`"_%"
1117 mkdir ${D}dirname
1118 if @<:@ ${D}? -ne 0 @:>@; then
1119 echo "Failed to create subdirectory ./${D}dirname"
1120 CleanUp
1121 exit 8;
1122 fi
1123 # Append '!' to indicate archive
1124 newInputFiles="${D}newInputFiles ${D}{dirname}!"
1125 doCommand "cd ${D}dirname; ${D}AR x ../${D}file"
1126 cd ${D}curDir
1127 found=0;
1128 for subfile in ${D}dirname/*.o* ; do
1129 if @<:@ -f ${D}subfile @:>@; then
1130 found=1
1131 if @<:@ -s ${D}subfile @:>@; then
1132 # FIXME: This should be: is file size > 32 byte, _not_ > 0!
1133 newInputFiles="${D}newInputFiles ${D}subfile"
1134 fi
1135 fi
1136 done
1137 if @<:@ ${D}found -eq 0 @:>@; then
1138 echo "WARNING: there are no files in archive \\'${D}file\\'"
1139 fi
1140 ;;
1141 *)
1142 newInputFiles="${D}{newInputFiles} ${D}file"
1143 ;;
1144 esac
1145done
1146inputFiles="${D}newInputFiles"
1147
1148# Output filename(s).
1149do_backup=0;
1150if @<:@ -z ${D}outFile @:>@; then
1151 do_backup=1;
1152 set outFile ${D}inputFiles; outFile=${D}2
1153fi
1154
1155# If it is an archive, remove the '!' and the '_%' suffixes
1156case ${D}outFile in
1157*_%!)
1158 outFile=\`basnam ${D}outFile _%!\`
1159 ;;
1160*)
1161 ;;
1162esac
1163case ${D}outFile in
1164*.dll)
1165 outFile=\`basnam ${D}outFile .dll\`
1166 ;;
1167*.DLL)
1168 outFile=\`basnam ${D}outFile .DLL\`
1169 ;;
1170*.o)
1171 outFile=\`basnam ${D}outFile .o\`
1172 ;;
1173*.obj)
1174 outFile=\`basnam ${D}outFile .obj\`
1175 ;;
1176*.a)
1177 outFile=\`basnam ${D}outFile .a\`
1178 ;;
1179*.lib)
1180 outFile=\`basnam ${D}outFile .lib\`
1181 ;;
1182*)
1183 ;;
1184esac
1185case ${D}outimpFile in
1186*.a)
1187 outimpFile=\`basnam ${D}outimpFile .a\`
1188 ;;
1189*.lib)
1190 outimpFile=\`basnam ${D}outimpFile .lib\`
1191 ;;
1192*)
1193 ;;
1194esac
1195if @<:@ -z ${D}outimpFile @:>@; then
1196 outimpFile=${D}outFile
1197fi
1198defFile="${D}{outFile}.def"
1199arcFile="${D}{outimpFile}.a"
1200arcFile2="${D}{outimpFile}.lib"
1201
1202#create ${D}dllFile as something matching 8.3 restrictions,
1203if @<:@ -z ${D}renameScript @:>@ ; then
1204 dllFile="${D}outFile"
1205else
1206 dllFile=\`${D}renameScript ${D}outimpFile\`
1207fi
1208
1209if @<:@ ${D}do_backup -ne 0 @:>@ ; then
1210 if @<:@ -f ${D}arcFile @:>@ ; then
1211 doCommand "mv ${D}arcFile ${D}{outFile}_s.a"
1212 fi
1213 if @<:@ -f ${D}arcFile2 @:>@ ; then
1214 doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib"
1215 fi
1216fi
1217
1218# Extract public symbols from all the object files.
1219tmpdefFile=${D}{defFile}_%
1220rm -f ${D}tmpdefFile
1221for file in ${D}inputFiles ; do
1222 case ${D}file in
1223 *!)
1224 ;;
1225 *)
1226 doCommand "emxexp -u ${D}file >> ${D}tmpdefFile"
1227 ;;
1228 esac
1229done
1230
1231# Create the def file.
1232rm -f ${D}defFile
1233echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile
1234dllFile="${D}{dllFile}.dll"
1235if @<:@ ! -z ${D}description @:>@; then
1236 echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile
1237fi
1238echo "EXPORTS" >> ${D}defFile
1239
1240doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%"
1241grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile
1242
1243# Checks if the export is ok or not.
1244for word in ${D}exclude_symbols; do
1245 grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}%
1246 mv ${D}{tmpdefFile}% ${D}tmpdefFile
1247done
1248
1249
1250if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1251 sed "=" < ${D}tmpdefFile | \\
1252 sed '
1253 N
1254 : loop
1255 s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/
1256 t loop
1257 ' > ${D}{tmpdefFile}%
1258 grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile
1259else
1260 rm -f ${D}{tmpdefFile}%
1261fi
1262cat ${D}tmpdefFile >> ${D}defFile
1263rm -f ${D}tmpdefFile
1264
1265# Do linking, create implib, and apply lxlite.
1266gccCmdl="";
1267for file in ${D}inputFiles ; do
1268 case ${D}file in
1269 *!)
1270 ;;
1271 *)
1272 gccCmdl="${D}gccCmdl ${D}file"
1273 ;;
1274 esac
1275done
1276doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS"
1277touch "${D}{outFile}.dll"
1278
1279doCommand "emximp -o ${D}arcFile ${D}defFile"
1280if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then
1281 add_flags="";
1282 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1283 add_flags="-ynd"
1284 fi
1285 doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile"
1286fi
1287doCommand "emxomf -s -l ${D}arcFile"
1288
1289# Successful exit.
1290CleanUp 1
1291exit 0
1292EOF
1293dnl ===================== dllar.sh ends here =====================
1294])
1295
1296AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS],
1297[
1298dnl ===================== bk-deps begins here =====================
1299dnl (Created by merge-scripts.py from bk-deps
1300dnl file do not edit here!)
1301D='$'
1302cat <<EOF >bk-deps
1303#!/bin/sh
1304
1305# This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
1306# script. It is used to track C/C++ files dependencies in portable way.
1307#
1308# Permission is given to use this file in any way.
1309
1310DEPSMODE=${DEPSMODE}
1311DEPSDIR=.deps
1312DEPSFLAG="${DEPSFLAG}"
1313
1314mkdir -p ${D}DEPSDIR
1315
1316if test ${D}DEPSMODE = gcc ; then
1317 ${D}* ${D}{DEPSFLAG}
1318 status=${D}?
1319 if test ${D}{status} != 0 ; then
1320 exit ${D}{status}
1321 fi
1322 # move created file to the location we want it in:
1323 while test ${D}# -gt 0; do
1324 case "${D}1" in
1325 -o )
1326 shift
1327 objfile=${D}1
1328 ;;
1329 -* )
1330 ;;
1331 * )
1332 srcfile=${D}1
1333 ;;
1334 esac
1335 shift
1336 done
1337 depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\`
1338 depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\`
1339 if test -f ${D}depfile ; then
1340 sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1341 rm -f ${D}depfile
1342 else
1343 # "g++ -MMD -o fooobj.o foosrc.cpp" produces fooobj.d
1344 depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\`
1345 if test ! -f ${D}depfile ; then
1346 # "cxx -MD -o fooobj.o foosrc.cpp" creates fooobj.o.d (Compaq C++)
1347 depfile="${D}objfile.d"
1348 fi
1349 if test -f ${D}depfile ; then
1350 sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1351 rm -f ${D}depfile
1352 fi
1353 fi
1354 exit 0
1355elif test ${D}DEPSMODE = mwcc ; then
1356 ${D}* || exit ${D}?
1357 # Run mwcc again with -MM and redirect into the dep file we want
1358 # NOTE: We can't use shift here because we need ${D}* to be valid
1359 prevarg=
1360 for arg in ${D}* ; do
1361 if test "${D}prevarg" = "-o"; then
1362 objfile=${D}arg
1363 else
1364 case "${D}arg" in
1365 -* )
1366 ;;
1367 * )
1368 srcfile=${D}arg
1369 ;;
1370 esac
1371 fi
1372 prevarg="${D}arg"
1373 done
1374 ${D}* ${D}DEPSFLAG >${D}{DEPSDIR}/${D}{objfile}.d
1375 exit 0
1376elif test ${D}DEPSMODE = unixcc; then
1377 ${D}* || exit ${D}?
1378 # Run compiler again with deps flag and redirect into the dep file.
1379 # It doesn't work if the '-o FILE' option is used, but without it the
1380 # dependency file will contain the wrong name for the object. So it is
1381 # removed from the command line, and the dep file is fixed with sed.
1382 cmd=""
1383 while test ${D}# -gt 0; do
1384 case "${D}1" in
1385 -o )
1386 shift
1387 objfile=${D}1
1388 ;;
1389 * )
1390 eval arg${D}#=\\${D}1
1391 cmd="${D}cmd \\${D}arg${D}#"
1392 ;;
1393 esac
1394 shift
1395 done
1396 eval "${D}cmd ${D}DEPSFLAG" | sed "s|.*:|${D}objfile:|" >${D}{DEPSDIR}/${D}{objfile}.d
1397 exit 0
1398else
1399 ${D}*
1400 exit ${D}?
1401fi
1402EOF
1403dnl ===================== bk-deps ends here =====================
1404])
1405
1406AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
1407[
1408dnl ===================== shared-ld-sh begins here =====================
1409dnl (Created by merge-scripts.py from shared-ld-sh
1410dnl file do not edit here!)
1411D='$'
1412cat <<EOF >shared-ld-sh
1413#!/bin/sh
1414#-----------------------------------------------------------------------------
1415#-- Name: distrib/mac/shared-ld-sh
1416#-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
1417#-- Author: Gilles Depeyrot
1418#-- Copyright: (c) 2002 Gilles Depeyrot
1419#-- Licence: any use permitted
1420#-----------------------------------------------------------------------------
1421
1422verbose=0
1423args=""
1424objects=""
1425linking_flag="-dynamiclib"
1426ldargs="-r -keep_private_externs -nostdlib"
1427
1428while test ${D}# -gt 0; do
1429 case ${D}1 in
1430
1431 -v)
1432 verbose=1
1433 ;;
1434
1435 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
1436 # collect these options and values
1437 args="${D}{args} ${D}1 ${D}2"
1438 shift
1439 ;;
1440
1441 -s|-Wl,*)
1442 # collect these load args
1443 ldargs="${D}{ldargs} ${D}1"
1444 ;;
1445
1446 -l*|-L*|-flat_namespace|-headerpad_max_install_names)
1447 # collect these options
1448 args="${D}{args} ${D}1"
1449 ;;
1450
1451 -dynamiclib|-bundle)
1452 linking_flag="${D}1"
1453 ;;
1454
1455 -*)
1456 echo "shared-ld: unhandled option '${D}1'"
1457 exit 1
1458 ;;
1459
1460 *.o | *.a | *.dylib)
1461 # collect object files
1462 objects="${D}{objects} ${D}1"
1463 ;;
1464
1465 *)
1466 echo "shared-ld: unhandled argument '${D}1'"
1467 exit 1
1468 ;;
1469
1470 esac
1471 shift
1472done
1473
1474status=0
1475
1476#
1477# Link one module containing all the others
1478#
1479if test ${D}{verbose} = 1; then
1480 echo "c++ ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o"
1481fi
1482c++ ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o
1483status=${D}?
1484
1485#
1486# Link the shared library from the single module created, but only if the
1487# previous command didn't fail:
1488#
1489if test ${D}{status} = 0; then
1490 if test ${D}{verbose} = 1; then
1491 echo "c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
1492 fi
1493 c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}
1494 status=${D}?
1495fi
1496
1497#
1498# Remove intermediate module
1499#
1500rm -f master.${D}${D}.o
1501
1502exit ${D}status
1503EOF
1504dnl ===================== shared-ld-sh ends here =====================
1505])
1506
1507AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
1508[
1509dnl ===================== bk-make-pch begins here =====================
1510dnl (Created by merge-scripts.py from bk-make-pch
1511dnl file do not edit here!)
1512D='$'
1513cat <<EOF >bk-make-pch
1514#!/bin/sh
1515
1516# This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
1517# script. It is used to generated precompiled headers.
1518#
1519# Permission is given to use this file in any way.
1520
1521outfile="${D}{1}"
1522header="${D}{2}"
1523shift
1524shift
1525
1526compiler=""
1527headerfile=""
1528
1529while test ${D}{#} -gt 0; do
1530 add_to_cmdline=1
1531 case "${D}{1}" in
1532 -I* )
1533 incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\`
1534 if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then
1535 headerfile="${D}{incdir}/${D}{header}"
1536 fi
1537 ;;
1538 -use-pch|-use_pch )
1539 shift
1540 add_to_cmdline=0
1541 ;;
1542 esac
1543 if test ${D}add_to_cmdline = 1 ; then
1544 compiler="${D}{compiler} ${D}{1}"
1545 fi
1546 shift
1547done
1548
1549if test "x${D}{headerfile}" = "x" ; then
1550 echo "error: can't find header ${D}{header} in include paths" >&2
1551else
1552 if test -f ${D}{outfile} ; then
1553 rm -f ${D}{outfile}
1554 else
1555 mkdir -p \`dirname ${D}{outfile}\`
1556 fi
1557 depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d"
1558 mkdir -p .deps
1559 if test "x${GCC_PCH}" = "x1" ; then
1560 # can do this because gcc is >= 3.4:
1561 ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}"
1562 elif test "x${ICC_PCH}" = "x1" ; then
1563 filename=pch_gen-${D}${D}
1564 file=${D}{filename}.c
1565 dfile=${D}{filename}.d
1566 cat > ${D}file <<EOT
1567#include "${D}header"
1568EOT
1569 # using -MF icc complains about differing command lines in creation/use
1570 ${D}compiler -c -create_pch ${D}outfile -MMD ${D}file && \\
1571 sed -e "s,^.*:,${D}outfile:," -e "s, ${D}file,," < ${D}dfile > ${D}depsfile && \\
1572 rm -f ${D}file ${D}dfile ${D}{filename}.o
1573 fi
1574 exit ${D}{?}
1575fi
1576EOF
1577dnl ===================== bk-make-pch ends here =====================
1578])