- *-*-beos* )
- dnl can't use gcc under BeOS for shared library creation because it
- dnl complains about missing 'main'
- SHARED_LD_CC="${LD} -nostart -o"
- SHARED_LD_CXX="${LD} -nostart -o"
- ;;
-
- *-*-irix* )
- dnl default settings are ok for gcc
- if test "x$GCC" != "xyes"; then
- PIC_FLAG="-KPIC"
- fi
- ;;
-
- *-*-cygwin* | *-*-mingw32* )
- PIC_FLAG=""
- SHARED_LD_CC="\$(CC) -shared -o"
- SHARED_LD_CXX="\$(CXX) -shared -o"
- ;;
-
- *-pc-os2_emx | *-pc-os2-emx )
- SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
- SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
- PIC_FLAG=""
- AC_BAKEFILE_CREATE_FILE_DLLAR_SH
- chmod +x dllar.sh
- ;;
-
- powerpc-apple-macos* | \
- *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
- *-*-sunos4* | \
- *-*-osf* | \
- *-*-dgux5* | \
- *-*-sysv5* | \
- *-pc-msdosdjgpp )
- dnl defaults are ok
- ;;
-
- *)
- AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
- esac
-
- if test "x$PIC_FLAG" != "x" ; then
- PIC_FLAG="$PIC_FLAG -DPIC"
- fi
-
- if test "x$SHARED_LD_MODULE_CC" = "x" ; then
- SHARED_LD_MODULE_CC="$SHARED_LD_CC"
- fi
- if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
- SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
- fi
-
- AC_SUBST(SHARED_LD_CC)
- AC_SUBST(SHARED_LD_CXX)
- AC_SUBST(SHARED_LD_MODULE_CC)
- AC_SUBST(SHARED_LD_MODULE_CXX)
- AC_SUBST(PIC_FLAG)
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl AC_BAKEFILE_SHARED_VERSIONS
-dnl
-dnl Detects linker options for attaching versions (sonames) to shared libs.
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
-[
- USE_SOVERSION=0
- USE_SOVERLINUX=0
- USE_SOVERSOLARIS=0
- USE_SOSYMLINKS=0
- USE_MACVERSION=0
- SONAME_FLAG=
-
- case "${BAKEFILE_HOST}" in
- *-*-linux* | *-*-freebsd* )
- SONAME_FLAG="-Wl,-soname,"
- USE_SOVERSION=1
- USE_SOVERLINUX=1
- USE_SOSYMLINKS=1
- ;;
-
- *-*-solaris2* )
- SONAME_FLAG="-h "
- USE_SOVERSION=1
- USE_SOVERSOLARIS=1
- USE_SOSYMLINKS=1
- ;;
-
- *-*-darwin* )
- USE_MACVERSION=1
- USE_SOVERSION=1
- USE_SOSYMLINKS=1
- ;;
- esac
-
- AC_SUBST(USE_SOVERSION)
- AC_SUBST(USE_SOVERLINUX)
- AC_SUBST(USE_SOVERSOLARIS)
- AC_SUBST(USE_MACVERSION)
- AC_SUBST(USE_SOSYMLINKS)
- AC_SUBST(SONAME_FLAG)
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl AC_BAKEFILE_DEPS
-dnl
-dnl Detects available C/C++ dependency tracking options
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([AC_BAKEFILE_DEPS],
-[
- AC_MSG_CHECKING([for dependency tracking method])
- DEPS_TRACKING=0
-
- if test "x$GCC" = "xyes"; then
- DEPSMODE=gcc
- DEPS_TRACKING=1
- case "${BAKEFILE_HOST}" in
- powerpc-*-darwin* )
- dnl -cpp-precomp (the default) conflicts with -MMD option
- dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
- DEPSFLAG_GCC="-no-cpp-precomp -MMD"
- ;;
- * )
- DEPSFLAG_GCC="-MMD"
- ;;
- esac
- AC_MSG_RESULT([gcc])
- elif test "x$MWCC" = "xyes"; then
- DEPSMODE=mwcc
- DEPS_TRACKING=1
- DEPSFLAG_MWCC="-MM"
- AC_MSG_RESULT([mwcc])
- elif test "x$SUNCC" = "xyes"; then
- DEPSMODE=suncc
- DEPS_TRACKING=1
- DEPSFLAG_SUNCC="-xM1"
- AC_MSG_RESULT([suncc])
- else
- AC_MSG_RESULT([none])
- fi
-
- if test $DEPS_TRACKING = 1 ; then
- AC_BAKEFILE_CREATE_FILE_BK_DEPS
- chmod +x bk-deps
- fi
-
- AC_SUBST(DEPS_TRACKING)
-])
-
-dnl ---------------------------------------------------------------------------
-dnl AC_BAKEFILE_CHECK_BASIC_STUFF
-dnl
-dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
-dnl or "install"
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
-[
- AC_PROG_RANLIB
- AC_PROG_INSTALL
- AC_PROG_LN_S
-
- AC_PROG_MAKE_SET
- AC_SUBST(MAKE_SET)
-
- AC_CHECK_TOOL(AR, ar, ar)
- AC_CHECK_TOOL(STRIP, strip, :)
- AC_CHECK_TOOL(NM, nm, :)
-
- case ${BAKEFILE_HOST} in
- *-hp-hpux* )
- dnl HP-UX install doesn't handle the "-d" switch so don't
- dnl use it there
- INSTALL_DIR="mkdir -p"
- ;;
- *) INSTALL_DIR="$INSTALL -d"
- ;;
- esac
- AC_SUBST(INSTALL_DIR)
-
- LDFLAGS_GUI=
- case ${BAKEFILE_HOST} in
- *-*-cygwin* | *-*-mingw32* )
- LDFLAGS_GUI="-mwindows"
- esac
- AC_SUBST(LDFLAGS_GUI)
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl AC_BAKEFILE_RES_COMPILERS
-dnl
-dnl Checks for presence of resource compilers for win32 or mac
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
-[
- RESCOMP=
- SETFILE=
-
- case ${BAKEFILE_HOST} in
- *-*-cygwin* | *-*-mingw32* )
- dnl Check for win32 resources compiler:
- if test "$build" != "$host" ; then
- RESCOMP=$host_alias-windres
- else
- AC_CHECK_PROG(RESCOMP, windres, windres, windres)
- fi
- ;;
-
- *-*-darwin* | powerpc-apple-macos* )
- AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
- AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
- ;;
- esac
-
- AC_SUBST(RESCOMP)
- AC_SUBST(SETFILE)
-])
-
-dnl ---------------------------------------------------------------------------
-dnl AC_BAKEFILE_PRECOMP_HEADERS
-dnl
-dnl Check for precompiled headers support (GCC >= 3.4)
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
-[
-
- AC_ARG_ENABLE([precomp-headers],
- AS_HELP_STRING([--disable-precomp-headers],
- [don't use precompiled headers even if compiler can]),
- [bk_use_pch="$enableval"])
-
- GCC_PCH=0
-
- if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
- if test "x$GCC" = "xyes"; then
- dnl test if we have gcc-3.4:
- AC_MSG_CHECKING([if the compiler supports precompiled headers])
- AC_TRY_COMPILE([],
- [
- #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
- #error "no pch support"
- #endif
- #if (__GNUC__ < 3)
- #error "no pch support"
- #endif
- #if (__GNUC__ == 3) && \
- ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
- ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
- #error "no pch support"
- #endif
- ],
- [
- AC_MSG_RESULT([yes])
- GCC_PCH=1
- ],
- [
- AC_MSG_RESULT([no])
- ])
- if test $GCC_PCH = 1 ; then
- AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
- chmod +x bk-make-pch
- fi
- fi
- fi
-
- AC_SUBST(GCC_PCH)
-])
-
-
-
-dnl ---------------------------------------------------------------------------
-dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
-dnl
-dnl To be used in configure.in of any project using Bakefile-generated mks
-dnl
-dnl Behaviour can be modified by setting following variables:
-dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
-dnl to perform check for basic tools like ranlib
-dnl BAKEFILE_HOST set this to override host detection, defaults
-dnl to ${host}
-dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
-dnl
-dnl Example usage:
-dnl
-dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
-dnl
-dnl (replace FOO with m4_include above, aclocal would die otherwise)
-dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
-dnl we can do...)
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([AC_BAKEFILE],
-[
- AC_PREREQ(2.58)
-
- if test "x$BAKEFILE_HOST" = "x"; then
- BAKEFILE_HOST="${host}"
- fi
-
- if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
- AC_BAKEFILE_CHECK_BASIC_STUFF
- fi
- AC_BAKEFILE_GNUMAKE
- AC_BAKEFILE_PLATFORM
- AC_BAKEFILE_PLATFORM_SPECIFICS
- AC_BAKEFILE_SUFFIXES
- AC_BAKEFILE_SHARED_LD
- AC_BAKEFILE_SHARED_VERSIONS
- AC_BAKEFILE_DEPS
- AC_BAKEFILE_RES_COMPILERS
-
- BAKEFILE_BAKEFILE_M4_VERSION="0.1.8"
-
- dnl includes autoconf_inc.m4:
- $1
-
- if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
- AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
- fi
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Embedded copies of helper scripts follow:
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
-[
-dnl ===================== dllar.sh begins here =====================
-dnl (Created by merge-scripts.py from dllar.sh
-dnl file do not edit here!)
-D='$'
-cat <<EOF >dllar.sh
-#!/bin/sh
-#
-# dllar - a tool to build both a .dll and an .a file
-# from a set of object (.o) files for EMX/OS2.
-#
-# Written by Andrew Zabolotny, bit@freya.etu.ru
-# Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de
-#
-# This script will accept a set of files on the command line.
-# All the public symbols from the .o files will be exported into
-# a .DEF file, then linker will be run (through gcc) against them to
-# build a shared library consisting of all given .o files. All libraries
-# (.a) will be first decompressed into component .o files then act as
-# described above. You can optionally give a description (-d "description")
-# which will be put into .DLL. To see the list of accepted options (as well
-# as command-line format) simply run this program without options. The .DLL
-# is built to be imported by name (there is no guarantee that new versions
-# of the library you build will have same ordinals for same symbols).
-#
-# dllar is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# dllar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with dllar; see the file COPYING. If not, write to the Free
-# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# To successfuly run this program you will need:
-# - Current drive should have LFN support (HPFS, ext2, network, etc)
-# (Sometimes dllar generates filenames which won't fit 8.3 scheme)
-# - gcc
-# (used to build the .dll)
-# - emxexp
-# (used to create .def file from .o files)
-# - emximp
-# (used to create .a file from .def file)
-# - GNU text utilites (cat, sort, uniq)
-# used to process emxexp output
-# - GNU file utilities (mv, rm)
-# - GNU sed
-# - lxlite (optional, see flag below)
-# (used for general .dll cleanup)
-#
-
-flag_USE_LXLITE=1;
-
-#
-# helper functions
-# basnam, variant of basename, which does _not_ remove the path, _iff_
-# second argument (suffix to remove) is given
-basnam(){
- case ${D}# in
- 1)
- echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
- ;;
- 2)
- echo ${D}1 | sed 's/'${D}2'${D}//'
- ;;
- *)
- echo "error in basnam ${D}*"
- exit 8
- ;;
- esac
-}
-
-# Cleanup temporary files and output
-CleanUp() {
- cd ${D}curDir
- for i in ${D}inputFiles ; do
- case ${D}i in
- *!)
- rm -rf \`basnam ${D}i !\`
- ;;
- *)
- ;;
- esac
- done
-
- # Kill result in case of failure as there is just to many stupid make/nmake
- # things out there which doesn't do this.
- if @<:@ ${D}# -eq 0 @:>@; then
- rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
- fi
-}
-
-# Print usage and exit script with rc=1.
-PrintHelp() {
- echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@'
- echo ' @<:@-name-mangler-script script.sh@:>@'
- echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@'
- echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"'
- echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@'
- echo ' @<:@*.o@:>@ @<:@*.a@:>@'
- echo '*> "output_file" should have no extension.'
- echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
- echo ' The import library name is derived from this and is set to "name".a,'
- echo ' unless overridden by -import'
- echo '*> "importlib_name" should have no extension.'
- echo ' If it has the .o, or .a extension, it is automatically removed.'
- echo ' This name is used as the import library name and may be longer and'
- echo ' more descriptive than the DLL name which has to follow the old '
- echo ' 8.3 convention of FAT.'
- echo '*> "script.sh may be given to override the output_file name by a'
- echo ' different name. It is mainly useful if the regular make process'
- echo ' of some package does not take into account OS/2 restriction of'
- echo ' DLL name lengths. It takes the importlib name as input and is'
- echo ' supposed to procude a shorter name as output. The script should'
- echo ' expect to get importlib_name without extension and should produce'
- echo ' a (max.) 8 letter name without extension.'
- echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
- echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
- echo ' These flags will be put at the start of GCC command line.'
- echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.'
- echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define'
- echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
- echo ' If the last character of a symbol is "*", all symbols beginning'
- echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
- echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
- echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
- echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s'
- echo ' C runtime DLLs.'
- echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.'
- echo '*> All other switches (for example -L./ or -lmylib) will be passed'
- echo ' unchanged to GCC at the end of command line.'
- echo '*> If you create a DLL from a library and you do not specify -o,'
- echo ' the basename for DLL and import library will be set to library name,'
- echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
- echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
- echo ' library will be renamed into gcc_s.a.'
- echo '--------'
- echo 'Example:'
- echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
- echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
- CleanUp
- exit 1
-}
-
-# Execute a command.
-# If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
-# @Uses Whatever CleanUp() uses.
-doCommand() {
- echo "${D}*"
- eval ${D}*
- rcCmd=${D}?
-
- if @<:@ ${D}rcCmd -ne 0 @:>@; then
- echo "command failed, exit code="${D}rcCmd
- CleanUp
- exit ${D}rcCmd
- fi
-}