1 # generated automatically by aclocal 1.7.2 -*- Autoconf -*-
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 dnl ---------------------------------------------------------------------------
15 dnl Support macros for makefiles generated by BAKEFILE.
16 dnl ---------------------------------------------------------------------------
18 dnl Lots of compiler & linker detection code contained here was taken from
19 dnl wxWindows configure.in script (see http://www.wxwindows.org)
23 dnl ---------------------------------------------------------------------------
24 dnl AC_BAKEFILE_GNUMAKE
27 dnl ---------------------------------------------------------------------------
29 AC_DEFUN(AC_BAKEFILE_GNUMAKE,
31 dnl does make support "-include" (only GNU make does AFAIK)?
32 AC_CACHE_CHECK([if make is GNU make], wx_cv_prog_makeisgnu,
34 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
35 egrep -s GNU > /dev/null); then
36 bakefile_cv_prog_makeisgnu="yes"
38 bakefile_cv_prog_makeisgnu="no"
42 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
50 dnl ---------------------------------------------------------------------------
51 dnl AC_BAKEFILE_PLATFORM
53 dnl Detects platform and sets PLATFORM_XXX variables accordingly
54 dnl ---------------------------------------------------------------------------
56 AC_DEFUN(AC_BAKEFILE_PLATFORM,
65 *-*-cygwin* | *-*-mingw32* )
68 *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx )
80 AC_SUBST(PLATFORM_UNIX)
81 AC_SUBST(PLATFORM_WIN32)
82 AC_SUBST(PLATFORM_MSDOS)
83 AC_SUBST(PLATFORM_MAC)
84 AC_SUBST(PLATFORM_MACOSX)
89 dnl ---------------------------------------------------------------------------
90 dnl AC_BAKEFILE_SUFFIXES
92 dnl Detects shared various suffixes for shared libraries, libraries, programs,
94 dnl ---------------------------------------------------------------------------
96 AC_DEFUN(AC_BAKEFILE_SUFFIXES,
108 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
109 dnl Both archive libraries and shared libraries on AIX have an
110 dnl .a extension. This will explain why you can't link with an
111 dnl .so and why it works with the name changed to .a.
114 *-*-cygwin* | *-*-mingw32* )
119 *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx )
134 dnl ---------------------------------------------------------------------------
135 dnl AC_BAKEFILE_SHARED_LD
137 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
138 dnl and SHARED_LD_CXX.
139 dnl ---------------------------------------------------------------------------
141 AC_DEFUN(AC_BAKEFILE_SHARED_LD,
143 dnl Defaults for GCC and ELF .so shared libs:
144 SHARED_LD_CC="\$(CC) -shared -o"
145 SHARED_LD_CXX="\$(CXX) -shared -o"
147 dnl the extra compiler flags needed for compilation of shared library
148 if test "x$GCC" = "xyes"; then
149 dnl the switch for gcc is the same under all platforms
155 dnl default settings are good for gcc but not for the native HP-UX
156 if test "x$GCC" = "xyes"; then
157 dnl -o flag must be after PIC flag
158 SHARED_LD_CC="${CC} -shared ${PIC_FLAG} -o"
159 SHARED_LD_CXX="${CXX} -shared ${PIC_FLAG} -o"
161 dnl no idea why it wants it, but it does
162 LDFLAGS="$LDFLAGS -L/usr/lib"
164 SHARED_LD_CC="${CC} -b -o"
165 SHARED_LD_CXX="${CXX} -b -o"
171 if test "x$GCC" != "xyes"; then
172 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
176 #ifndef __INTEL_COMPILER
180 bakefile_cv_prog_icc=yes,
181 bakefile_cv_prog_icc=no
184 if test "$bakefile_cv_prog_icc" = "yes"; then
191 if test "x$GCC" != xyes ; then
192 SHARED_LD_CC="${CC} -G -o"
193 SHARED_LD_CXX="${CXX} -G -o"
199 dnl For Unix to MacOS X porting instructions, see:
200 dnl http://fink.sourceforge.net/doc/porting/porting.html
201 CFLAGS="$CFLAGS -fno-common"
202 CXXFLAGS="$CXXFLAGS -fno-common"
204 dnl Most apps benefit from being fully binded (its faster and static
205 dnl variables initialized at startup work).
206 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
207 dnl or with a double stage link in order to create a single module
208 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
210 cat <<EOF >shared-ld-sh
212 #-----------------------------------------------------------------------------
213 #-- Name: distrib/mac/shared-ld-sh
214 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
215 #-- Author: Gilles Depeyrot
216 #-- Copyright: (c) 2002 Gilles Depeyrot
217 #-- Licence: any use permitted
218 #-----------------------------------------------------------------------------
224 while test \${#} -gt 0; do
231 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
232 # collect these options and values
233 args="\${args} \${1} \${2}"
237 -l*|-L*|-flat_namespace)
238 # collect these options
239 args="\${args} \${1}"
247 echo "shared-ld: unhandled option '\${1}'"
252 # collect object files
253 objects="\${objects} \${1}"
257 echo "shared-ld: unhandled argument '\${1}'"
266 # Link one module containing all the others
268 if test \${verbose} = 1; then
269 echo "c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o"
271 c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o
273 if test \${status} != 0; then
278 # Link the shared library from the single module created
280 if test \${verbose} = 1; then
281 echo "cc -dynamiclib master.\$\$.o \${args}"
283 c++ -dynamiclib master.\$\$.o \${args}
285 if test \${status} != 0; then
290 # Remove intermediate module
296 chmod +x shared-ld-sh
298 SHARED_LD_CC="`pwd`/shared-ld-sh -undefined suppress -flat_namespace -o"
299 SHARED_LD_CXX="$SHARED_LD_CC"
300 PIC_FLAG="-dynamic -fPIC"
301 dnl FIXME - what about C libs? Gilles says to use c++ because it doesn't
302 dnl matter for C projects and matters for C++ ones
303 dnl FIXME - newer devel tools have linker flag to do this, the script
304 dnl is not necessary - detect!
308 dnl default settings are ok for gcc
309 if test "x$GCC" != "xyes"; then
310 dnl the abs path below used to be hardcoded here so I guess it must
311 dnl be some sort of standard location under AIX?
312 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
313 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
314 dnl FIXME - what about makeCSharedLib?
315 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
316 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
321 dnl can't use gcc under BeOS for shared library creation because it
322 dnl complains about missing 'main'
323 SHARED_LD_CC="${LD} -shared -o"
324 SHARED_LD_CXX="${LD} -shared -o"
328 dnl default settings are ok for gcc
329 if test "x$GCC" != "xyes"; then
334 *-*-cygwin* | *-*-mingw32* )
338 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
347 AC_MSG_ERROR(unknown system type $host.)
350 AC_SUBST(SHARED_LD_CC)
351 AC_SUBST(SHARED_LD_CXX)
356 dnl ---------------------------------------------------------------------------
357 dnl AC_BAKEFILE_SHARED_VERSIONS
359 dnl Detects linker options for attaching versions (sonames) to shared libs.
360 dnl ---------------------------------------------------------------------------
362 AC_DEFUN(AC_BAKEFILE_SHARED_VERSIONS,
373 SONAME_FLAG="-Wl,-soname,"
393 AC_SUBST(USE_SOVERSION)
394 AC_SUBST(USE_SOVERLINUX)
395 AC_SUBST(USE_SOVERSOLARIS)
396 AC_SUBST(USE_MACVERSION)
397 AC_SUBST(USE_SOSYMLINKS)
398 AC_SUBST(SONAME_FLAG)
402 dnl ---------------------------------------------------------------------------
405 dnl Detects available C/C++ dependency tracking options
406 dnl ---------------------------------------------------------------------------
408 AC_DEFUN(AC_BAKEFILE_DEPS,
411 if test "x$GCC" = "xyes"; then
418 dnl ---------------------------------------------------------------------------
419 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
421 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
423 dnl ---------------------------------------------------------------------------
425 AC_DEFUN(AC_BAKEFILE_CHECK_BASIC_STUFF,
434 if test "$build" != "$host" ; then
436 STRIP=$host_alias-strip
438 AC_CHECK_PROG(AR, ar, ar, ar)
439 AC_CHECK_PROG(STRIP, strip, strip, true)
446 *) INSTALL_DIR="$INSTALL -d"
449 AC_SUBST(INSTALL_DIR)
453 dnl ---------------------------------------------------------------------------
454 dnl AC_BAKEFILE_RES_COMPILERS
456 dnl Checks for presence of resource compilers for win32 or mac
457 dnl ---------------------------------------------------------------------------
459 AC_DEFUN(AC_BAKEFILE_RES_COMPILERS,
465 *-*-cygwin* | *-*-mingw32* )
466 dnl Check for win32 resources compiler:
467 if test "$build" != "$host" ; then
468 RESCOMP=$host_alias-windres
470 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
475 AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
476 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
484 dnl ---------------------------------------------------------------------------
487 dnl To be used in configure.in of any project using Bakefile-generated mks
488 dnl ---------------------------------------------------------------------------
490 AC_DEFUN(AC_BAKEFILE,
492 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
493 AC_BAKEFILE_CHECK_BASIC_STUFF
498 AC_BAKEFILE_SHARED_LD
499 AC_BAKEFILE_SHARED_VERSIONS
501 AC_BAKEFILE_RES_COMPILERS
503 builtin(include, autoconf_inc.m4)