<?xml version="1.0" encoding="UTF-8"?>
<!--
   - Ant project file which sets up cpptasks to compile native code
   - generated by GlueGen for multiple supported platforms. This Ant
   - project file is not intended to be executed standalone, but imported
   - by other projects which use GlueGen to generate native code and
   - need to compile that native code.
   - 
   - Before importing this file, the properties "gluegen.root" must be defined; 
   - this is the relative path from the current working
   - directory (e.g., from which the parent project's build.xml is being
   - executed) to the top of the checked-out GlueGen workspace.
   - 
   - The property "gluegen.root.abs-path" must be defined as well;
   - this is the absolute path of "gluegen.root", see above.
   - 
   - The gluegen.cpptasks.detect.os target sets the following
   - properties appropriately. They are only set to "true" if the OS/CPU
   - configuration is exactly as specified.
   - 
   -   isI386
   -   isAMD64
   -   is64Bit
   -   isAbiEabiGnuArmel (implicit if isAndroidARMv6 or isAndroidARM64)
   -   isAbiEabiGnuArmhf (shall be declared explicit)
   -   isUnix
   -   isX11
   -   isFreeBSD
   -   isFreeBSDAMD64
   -   isFreeBSDX86
   -   isHPUX
   -   isIA64
   -   isAndroid
   -   isAndroidARMv6
   -   isAndroidARM64
   -   isAndroidARMv6Armel (set in gluegen.cpptasks.detected.os.2)
   -   isAndroidARMv6Armhf (set in gluegen.cpptasks.detected.os.2)
   -   isAndroidX86
   -   isLinux
   -   isLinuxAMD64
   -   isLinuxIA64
   -   isLinuxX86
   -   isLinuxARMv6
   -   isLinuxARM64
   -   isLinuxARMv6Armel   (set in gluegen.cpptasks.detected.os.2)
   -   isLinuxARMv6Armhf   (set in gluegen.cpptasks.detected.os.2)
   -   isLinuxAlpha
   -   isLinuxHppa
   -   isLinuxMips
   -   isLinuxMipsel
   -   isLinuxPpc
   -   isLinuxPpc64
   -   isLinuxPpc64le
   -   isLinuxs390
   -   isLinuxs390x
   -   isLinuxSparc
   -   isOSX
   -   isOSXPPC
   -   isIOS
   -   isIOSAmd64
   -   isIOSArm64
   -   isSolaris
   -   isSolaris32Bit
   -   isSolaris64Bit
   -   isSolarisAMD64
   -   isSolarisSparc
   -   isSolarisSparcv9
   -   isSolarisX86
   -   isWindows
   -   isWindowsX86
   -   isWindowsAMD64
   -   jvmDataModel64Bit
   -   jvmDataModel32Bit

   -   jvmDataModel.arg  either one of [ "-d64", "-d32" or "-Djnlp.no.jvm.data.model.set=true" ]

   -   build.dynamiclibs
   -   build.staticlibs  (usually = !build.dynamiclibs)
   -   output.lib.type

   -
   - isX11 is set if: !isWindows && !isOSX !isIOS && !noX11
   - 
   - It also sets the following properties which are useful for
   - building native library jar files for Java Web Start and
   - understanding on what OS and architecture things are being built.
   -
   -   os.and.arch (i.e., "windows-i586")
   -   native.library.prefix (i.e.., "lib", "")
   -   native.library.suffix (i.e.., "so", "dll", "dylib")
   - 
   - The gluegen.cpptasks.setup.compiler target is the preferred target
   - to depend upon in your build.xml. It depends on gluegen.cpptasks.detect.compiler
   - and gluegen.cpptasks.configure.compiler, below, and also sets up the following
   - compiler and linker IDs for the host platform:
   -
   -   compiler.cfg.id.base
   -   linker.cfg.id.base
   -
   - and the following properties:
   -
   -   java.home.dir               : path to the JDK home directory
   -   java.lib.dir.platform       : path to the Java library dir (libjawt.so, etc.)
   -   java.includes.dir           : path to the GlueGen JNI headers: gluegen/make/stub_includes/jni
   -   java.includes.dir.platform  : path to the GlueGen Platform JNI headers: gluegen/make/stub_includes/jni/<platform>
   -
   - If your project requires only minimal changes to the compiler
   - configuration, you may be able to simply refer to the
   - gluegen.cpptasks.setup.compiler target and avoid any platform-
   - specific compiler subclassing.
   - 
   - The gluegen.cpptasks.detect.compiler target sets the following
   - properties appropriately. They are only set to "true" if the OS/compiler
   - configuration is exactly as specified.
   - 
   -   isGCC
   -   isCLANG
   -   isVCFamily
   -   isVC6
   -   isVC7
   -   isVC8
   -   isVC8_X64
   -   isVC8Family (= isVC8 || isVC8_X64 || isVC9) (requires manifest in DLL)
   -   isVC9
   -   isMingW32 (isMingW)
   -   isMingW64 (isMingW)
   - 
   - The gluegen.cpptasks.configure.compiler target initializes several
   - cpptasks compiler and linker configurations designed to support
   - compilation of C code on multiple platforms. Generally if it is
   - necessary to set up include paths, link paths, etc., then these
   - compilers and linkers will need to be subclassed in sub-projects. 
   - However, at least the base-level configuration does not need to
   - be replicated.
   - 
   - The following compiler and linker IDs are defined by this target:
   - 
   -   compiler.cfg.linux
   -   compiler.cfg.linux.x86
   -   compiler.cfg.linux.amd64
   -   compiler.cfg.linux.armv6
   -   compiler.cfg.linux.aarch64
   -   compiler.cfg.linux.alpha
   -   compiler.cfg.linux.hppa
   -   compiler.cfg.linux.mips
   -   compiler.cfg.linux.mipsel
   -   compiler.cfg.linux.ppc
   -   compiler.cfg.linux.ppc64
   -   compiler.cfg.linux.ppc64le
   -   compiler.cfg.linux.s390
   -   compiler.cfg.linux.s390x
   -   compiler.cfg.linux.sparc
   -   compiler.cfg.solaris
   -   compiler.cfg.solaris.sparcv9
   -   compiler.cfg.solaris.amd64
   -   compiler.cfg.win64.mingw
   -   compiler.cfg.win32.mingw
   -   compiler.cfg.win32.msvc
   -   compiler.cfg.macosx
   -   compiler.cfg.ios.amd64
   -   compiler.cfg.ios.arm64
   -   compiler.cfg.freebsd
   -   compiler.cfg.hpux
   -   linker.cfg.linux
   -   linker.cfg.linux.x86
   -   linker.cfg.linux.amd64
   -   linker.cfg.linux.armv6
   -   linker.cfg.linux.aarch64
   -   linker.cfg.linux.alpha
   -   linker.cfg.linux.hppa
   -   linker.cfg.linux.mips
   -   linker.cfg.linux.mipsel
   -   linker.cfg.linux.ppc
   -   linker.cfg.linux.ppc64le
   -   linker.cfg.linux.s390
   -   linker.cfg.linux.s390x
   -   linker.cfg.linux.sparc
   -   linker.cfg.freebsd.x86
   -   linker.cfg.freebsd.amd64
   -   linker.cfg.solaris
   -   linker.cfg.solaris.sparcv9
   -   linker.cfg.solaris.amd64
   -   linker.cfg.win64.mingw
   -   linker.cfg.win32.mingw
   -   linker.cfg.win32.msvc
   -   linker.cfg.macosx
   -   linker.cfg.ios.amd64
   -   linker.cfg.ios.arm64
   -   linker.cfg.hpux
   - 
   - This project file also defines a macrodef called "msvc.manifest"
   - which helps insert manifests into DLLs compiled with MSVC 8.0 and
   - later. Example usage is:
   -   &lt;msvc.manifest objdir="${obj}" dllname="gluegen-rt" /&gt;
  -->
<project name="GlueGen-cpptasks-base" basedir=".">

  <import file="gluegen-properties.xml" />
  <target name="gluegen.cpptasks.initialize" depends="gluegen.properties.load.user">
    <echo message="os.name=${os.name}" />
    <echo message="os.version=${os.version}" />
    <echo message="os.arch=${os.arch}" />

    <property name="nativejartag.package"    value="jogamp.nativetag" /> 
    <property name="nativejartag.prefix"     value="jogamp/nativetag" /> 
    <echo message="nativejartag.prefix = ${nativejartag.prefix}" />

    <!-- NOTE: the value of the debug attribute will not be overridden if already set externally -->
    <property name="c.compiler.debug"     value="false" /> 
    <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition>
    <!-- Optimise flags one of { none, size, speed, minimal, full, aggressive, extreme, unsafe } --> 
    <property name="c.compiler.optimise"  value="none" /> 

    <echo message="c.compiler.debug=${c.compiler.debug}" />
    <echo message="c.compiler.use-debug=${c.compiler.use-debug}" />
    <echo message="c.compiler.optimise=${c.compiler.optimise}" />

    <condition property="c.strip.libraries"><isfalse value="${c.compiler.debug}"/></condition>

    <!-- NOTE: the values of the macos<arch> attributes will not be overridden if already set externally -->
    <property name="macosppc"     value="false" /> 
    <property name="macosx64"     value="true" /> 
    <property name="macosx32"     value="false" /> <!-- we disable 32bit on OSX for good now -->

    <!-- Need a way to be able to disable the macosx64 property specification in a build.xml -->
    <condition property="use.macosppc">
      <istrue value="${macosppc}" />
    </condition>
    <condition property="use.macosx32">
     <and>
      <istrue value="${macosx32}" />
      <os family="mac"/>
     </and>
    </condition>
    <condition property="use.macosx64">
     <and>
      <istrue value="${macosx64}" />
      <os family="mac"/>
     </and>
    </condition>
  </target>

  <!-- Custom target which can be overwritten 
       by a custom file set in property 'gluegen-cpptasks.file' 
       or environment var 'GLUEGEN_CPPTASKS_FILE' 

       See 'lib/gluegen-cpptasks-linux-armv6hf.xml' which sets OS and ARCH
       for crosscompilation.
    -->
  <target name="gluegen.cpptasks.detect.os.custom">
    <echo message="gluegen.cpptasks.detect.os.custom: NOP done"/>
  </target>

  <!-- Detect OS and compiler configuration -->
  <target name="gluegen.cpptasks.detect.os.1" depends="gluegen.cpptasks.initialize" unless="gluegen.cpptasks.detected.os">
    <condition property="isI386">
      <or>
          <os arch="i386" />
          <os arch="x86" />
      </or>
    </condition>
    <condition property="isAMD64">
      <or>
        <os arch="amd64" />
        <os arch="AMD64" />
        <os arch="x86_64" />
      </or>
    </condition>
    <condition property="is64Bit">
      <or>
        <istrue value="${isAMD64}" />
        <istrue value="${isIOSAmd64}"/> 
        <istrue value="${isIOSArm64}"/> 
        <os arch="IA64" />
        <os arch="sparcv9" />
        <os arch="armv8a" />
        <os arch="aarch64" />
      </or>
    </condition>

    <condition property="isIOS">
      <or>
          <istrue value="${isIOSAmd64}"/> 
          <istrue value="${isIOSArm64}"/> 
      </or>
    </condition>
    <condition property="isOSX">
      <and>
        <os family="mac"/>
        <os family="unix"/>
        <not>
          <istrue value="${isIOS}"/> 
        </not>
      </and>
    </condition>
    <condition property="isUnix">
      <and>
        <os family="unix" />
        <not>
          <os family="mac" />
        </not>
      </and>
    </condition>
    <condition property="isFreeBSD">
      <os name="FreeBSD" />
    </condition>
    <condition property="isAndroid">
      <os name="Android" />
    </condition>
    <condition property="isLinux">
      <os name="Linux" />
    </condition>
    <condition property="isSolaris">
      <os name="SunOS" />
    </condition>
    <condition property="isWindows">
      <os family="windows" />
    </condition>
    <condition property="isWindowsX86">
      <and>
        <istrue value="${isWindows}" />
        <istrue value="${isI386}" />
      </and>
    </condition>
    <condition property="isWindowsAMD64">
      <and>
        <istrue value="${isWindows}" />
        <os arch="amd64" />
      </and>
    </condition>
    <condition property="isFreeBSDX86">
      <and>
        <istrue value="${isFreeBSD}" />
        <istrue value="${isI386}" />
      </and>
    </condition>
    <condition property="isFreeBSDAMD64">
      <and>
        <istrue value="${isFreeBSD}" />
        <istrue value="${isAMD64}" />
      </and>
    </condition>
    <condition property="isHPUX">
      <os name="HP-UX" />
    </condition>
    <condition property="isAndroidARMv6">
      <and>
        <istrue value="${isAndroid}" />
        <or>
            <os arch="arm" />
            <os arch="armv6" />
            <os arch="armv7" />
        </or>
      </and>
    </condition>
    <condition property="isAndroidARM64">
      <and>
        <istrue value="${isAndroid}" />
        <or>
            <os arch="armv8a" />
            <os arch="aarch64" />
        </or>
      </and>
    </condition>
    <condition property="isAndroidX86">
      <and>
        <istrue value="${isAndroid}" />
        <os arch="x86" />
      </and>
    </condition>
    <condition property="isLinuxARMv6">
      <and>
        <istrue value="${isLinux}" />
        <or>
            <os arch="arm" />
            <os arch="armv6" />
            <os arch="armv7" />
        </or>
      </and>
    </condition>
    <condition property="isLinuxARM64">
      <and>
        <istrue value="${isLinux}" />
        <or>
            <os arch="armv8a" />
            <os arch="aarch64" />
        </or>
      </and>
    </condition>
    <condition property="isAbiEabiGnuArmel">
      <and>
        <isfalse value="${isAbiEabiGnuArmhf}" />
        <or>
            <istrue value="${isAndroidARMv6}" />
            <istrue value="${isAndroidARM64}" />
            <istrue value="${isLinuxARMv6}" />
            <istrue value="${isLinuxARM64}" />
        </or>
      </and>
    </condition>
    <condition property="isLinuxAlpha">
      <and>
        <istrue value="${isLinux}" />
        <os arch="alpha" />
      </and>
    </condition>
    <condition property="alpha">
      <os arch="alpha" />
    </condition>
    <condition property="arm">
      <os arch="arm" />
    </condition>
    <condition property="isLinuxHppa">
      <and>
        <istrue value="${isLinux}" />
        <os arch="hppa" />
      </and>
    </condition>
    <condition property="hppa">
      <os arch="hppa" />
    </condition>
    <condition property="isLinuxMips">
      <and>
        <istrue value="${isLinux}" />
        <os arch="mips" />
      </and>
    </condition>
    <condition property="mips">
      <os arch="mips" />
    </condition>
    <condition property="isLinuxMipsel">
      <and>
        <istrue value="${isLinux}" />
        <os arch="mipsel" />
      </and>
    </condition>
    <condition property="mipsel">
      <os arch="mipsel" />
    </condition>
    <condition property="isLinuxPpc">
      <and>
        <istrue value="${isLinux}" />
        <os arch="ppc" />
      </and>
    </condition>
    <condition property="ppc">
      <os arch="ppc" />
    </condition>
    <condition property="isLinuxPpc64">
      <and>
        <istrue value="${isLinux}" />
        <os arch="ppc64" />
      </and>
    </condition>
    <condition property="ppc64">
      <os arch="ppc64" />
    </condition>
    <condition property="isLinuxPpc64le">
      <and>
        <istrue value="${isLinux}" />
        <os arch="ppc64le" />
      </and>
    </condition>
    <condition property="ppc64le">
      <os arch="ppc64le" />
    </condition>
    <condition property="isLinuxs390">
      <and>
        <istrue value="${isLinux}" />
        <os arch="s390" />
      </and>
    </condition>
    <condition property="s390">
      <os arch="s390" />
    </condition>
    <condition property="isLinuxs390x">
      <and>
        <istrue value="${isLinux}" />
        <os arch="s390x" />
      </and>
    </condition>
    <condition property="s390x">
      <os arch="s390x" />
    </condition>
    <condition property="isLinuxSparc">
      <and>
        <istrue value="${isLinux}" />
        <os arch="sparc" />
      </and>
    </condition>
    <condition property="sparc">
      <os arch="sparc" />
    </condition>

    <condition property="isLinuxX86">
      <and>
        <istrue value="${isLinux}" />
        <istrue value="${isI386}" />
      </and>
    </condition>
    <condition property="isLinuxAMD64">
      <and>
        <istrue value="${isLinux}" />
        <istrue value="${isAMD64}" />
      </and>
    </condition>
    <condition property="isLinuxIA64">
      <and>
        <istrue value="${isLinux}" />
        <os arch="IA64" />
      </and>
    </condition>
    <condition property="isIA64">
      <os arch="IA64" />
    </condition>
    <condition property="isSolaris32Bit">
      <and>
         <istrue value="${isSolaris}" />
         <not>
           <istrue value="${is64Bit}" />
         </not>
      </and>
    </condition>
    <condition property="isSolaris64Bit">
      <and>
         <istrue value="${isSolaris}" />
         <istrue value="${is64Bit}" />
      </and>
    </condition>
    <condition property="isSolarisSparc">
       <and>
         <istrue value="${isSolaris}" />
          <os arch="sparc" />
       </and>
    </condition>
    <condition property="isSolarisSparcv9">
       <and>
         <istrue value="${isSolaris}" />
          <os arch="sparcv9" />
       </and>
    </condition>
    <condition property="isSolarisAMD64">
       <and>
         <istrue value="${isSolaris}" />
         <istrue value="${isAMD64}" />
       </and>
    </condition>
    <condition property="isSolarisX86">
      <and>
         <istrue value="${isSolaris}" />
         <istrue value="${isI386}" />
      </and>
    </condition>

    <!-- Note: assumes X11 platform by default -->
    <condition property="isX11">
      <and>
        <isfalse value="${isWindows}" />
        <isfalse value="${isOSX}" />
        <isfalse value="${isIOS}" />
        <isfalse value="${isAndroid}" />
        <isfalse value="${noX11}" />
      </and>
    </condition>

    <condition property="solaris.cpu" value="sparc">
        <os name="SunOS" arch="sparc" />
    </condition>
    <condition property="solaris.cpu" value="sparcv9">
        <os name="SunOS" arch="sparcv9" />
    </condition>
    <condition property="solaris.cpu" value="i386">
        <os name="SunOS" arch="x86" />
    </condition>
    <condition property="solaris.cpu" value="amd64">
        <os name="SunOS" arch="amd64" />
    </condition>

    <condition property="jvmDataModel32Bit">
      <or>
         <istrue value="${isSolaris32Bit}" />
      </or>
    </condition>
    <condition property="jvmDataModel64Bit">
      <or>
         <istrue value="${isSolaris64Bit}" />
      </or>
    </condition>
    <condition property="jvmDataModel.arg" value="-d64"><isset property="jvmDataModel64Bit"/></condition>
    <condition property="jvmDataModel.arg" value="-d32"><isset property="jvmDataModel32Bit"/></condition>
    <property name="jvmDataModel.arg" value="-Djnlp.no.jvm.data.model.set=true" /> <!-- dummy placeholder, valid jvm arg, won't override above spec -->
    <condition property="build.dynamiclibs" value="false" else="true"><istrue value="${isIOS}"/></condition>
    <condition property="build.staticlibs" value="false" else="true"><istrue value="${build.dynamiclibs}"/></condition>
    <condition property="output.lib.type" value="shared" else="static"><istrue value="${build.dynamiclibs}"/></condition>
  </target>

  <target name="gluegen.cpptasks.detect.os.refine" unless="gluegen.cpptasks.detected.os.2">
    <condition property="isAndroidARMv6Armel">
      <and>
        <istrue value="${isAbiEabiGnuArmel}" />
        <istrue value="${isAndroidARMv6}" />
      </and>
    </condition>
    <condition property="isAndroidARMv6Armhf">
      <and>
        <istrue value="${isAbiEabiGnuArmhf}" />
        <istrue value="${isAndroidARMv6}" />
      </and>
    </condition>

    <condition property="isLinuxARMv6Armel">
      <and>
        <istrue value="${isAbiEabiGnuArmel}" />
        <istrue value="${isLinuxARMv6}" />
      </and>
    </condition>
    <condition property="isLinuxARMv6Armhf">
      <and>
        <istrue value="${isAbiEabiGnuArmhf}" />
        <istrue value="${isLinuxARMv6}" />
      </and>
    </condition>

    <echo message="isI386=${isI386}" />
    <echo message="isAMD64=${isAMD64}" />
    <echo message="is64Bit=${is64Bit}" />
    <echo message="isAbiEabiGnuArmel=${isAbiEabiGnuArmel}" />
    <echo message="isAbiEabiGnuArmhf=${isAbiEabiGnuArmhf}" />
    <echo message="jvmDataModel32Bit=${jvmDataModel32Bit}" />
    <echo message="jvmDataModel64Bit=${jvmDataModel64Bit}" />
    <echo message="jvmDataModel.arg=${jvmDataModel.arg}" />
    <echo message="FreeBSD=${isFreeBSD}" />
    <echo message="FreeBSDX86=${isFreeBSDX86}" />
    <echo message="FreeBSDAMD64=${isFreeBSDAMD64}" />
    <echo message="HPUX=${isHPUX}" />
    <echo message="IA64=${isIA64}" />
    <echo message="Android=${isAndroid}" />
    <echo message="AndroidARMv6=${isAndroidARMv6}" />
    <echo message="AndroidARM64=${isAndroidARM64}" />
    <echo message="AndroidARMv6Armel=${isAndroidARMv6Armel}" />
    <echo message="AndroidARMv6Armhf=${isAndroidARMv6Armhf}" />
    <echo message="AndroidX86=${isAndroidX86}" />
    <echo message="Linux=${isLinux}" />
    <echo message="LinuxAMD64=${isLinuxAMD64}" />
    <echo message="LinuxIA64=${isLinuxIA64}" />
    <echo message="LinuxX86=${isLinuxX86}" />
    <echo message="LinuxARMv6=${isLinuxARMv6}" />
    <echo message="LinuxARM64=${isLinuxARM64}" />
    <echo message="LinuxARMv6Armel=${isLinuxARMv6Armel}" />
    <echo message="LinuxARMv6Armhf=${isLinuxARMv6Armhf}" />
    <echo message="LinuxAlpha=${isLinuxAlpha}" />
    <echo message="LinuxHppa=${isLinuxHppa}" />
    <echo message="LinuxMips=${isLinuxMips}" />
    <echo message="LinuxMipsel=${isLinuxMipsel}" />
    <echo message="LinuxPpc=${isLinuxPpc}" />
    <echo message="LinuxPpc64=${isLinuxPpc64}" />
    <echo message="LinuxPpc64le=${isLinuxPpc64le}" />
    <echo message="Linuxs390=${isLinuxs390}" />
    <echo message="Linuxs390x=${isLinuxs390x}" />
    <echo message="LinuxSparc=${isLinuxSparc}" />
    <echo message="OS X=${isOSX}" />
    <echo message="OS X PPC=${use.macosppc}" />
    <echo message="OS X x32=${use.macosx32}" />
    <echo message="OS X x64=${use.macosx64}" />
    <echo message="iOS=${isIOS}" />
    <echo message="iOSAmd64=${isIOSAmd64}" />
    <echo message="iOSArm64=${isIOSArm64}" />
    <echo message="Solaris=${isSolaris}" />
    <echo message="Solaris32Bit=${isSolaris32Bit}" />
    <echo message="Solaris64Bit=${isSolaris64Bit}" />
    <echo message="SolarisSparc=${isSolarisSparc}" />
    <echo message="SolarisSparcv9=${isSolarisSparcv9}" />
    <echo message="SolarisAMD64=${isSolarisAMD64}" />
    <echo message="SolarisX86=${isSolarisX86}" />
    <echo message="Unix=${isUnix}" />
    <echo message="Windows=${isWindows}" />
    <echo message="X11=${isX11}" />
    <echo message="os=${os.name}" />
    <echo message="os=${os.version}" />
    <echo message="arch=${os.arch}" /> 
    <echo message="build.dynamiclibs=${build.dynamiclibs}" /> 
    <echo message="build.staticlibs=${build.staticlibs}" /> 
    <echo message="output.lib.type=${output.lib.type}" /> 
 </target>

 <!-- Consult jogamp.common.os.PlatformPropsImpl.getOSAndArch(..) to complete/sync mapping! -->

  <target name="gluegen.cpptasks.detect.os.freebsd.x86" unless="gluegen.cpptasks.detected.os.2" if="isFreeBSDX86">
    <property name="os.and.arch" value="freebsd-i586" />
  </target>

  <target name="gluegen.cpptasks.detect.os.freebsd.amd64" unless="gluegen.cpptasks.detected.os.2" if="isFreeBSDAMD64">
    <property name="os.and.arch" value="freebsd-amd64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.freebsd" depends="gluegen.cpptasks.detect.os.freebsd.amd64,gluegen.cpptasks.detect.os.freebsd.x86" unless="gluegen.cpptasks.detected.os.2" />

  <target name="gluegen.cpptasks.detect.os.hpux" unless="gluegen.cpptasks.detected.os.2" if="isHPUX">
    <property name="os.and.arch" value="hpux-hppa" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.amd64" unless="gluegen.cpptasks.detected.os.2" if="isLinuxAMD64">
    <property name="os.and.arch" value="linux-amd64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.ia64" unless="gluegen.cpptasks.detected.os.2" if="isLinuxIA64">
    <property name="os.and.arch" value="linux-ia64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.x86" unless="gluegen.cpptasks.detected.os.2" if="isLinuxX86">
    <property name="os.and.arch" value="linux-i586" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.armv6.armel" unless="gluegen.cpptasks.detected.os.2" if="isLinuxARMv6Armel">
    <property name="os.and.arch" value="linux-armv6" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.armv6.armhf" unless="gluegen.cpptasks.detected.os.2" if="isLinuxARMv6Armhf">
    <property name="os.and.arch" value="linux-armv6hf" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.aarch64" unless="gluegen.cpptasks.detected.os.2" if="isLinuxARM64">
    <property name="os.and.arch" value="linux-aarch64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.alpha" unless="gluegen.cpptasks.detected.os.2" if="isLinuxAlpha">
    <property name="os.and.arch" value="linux-alpha" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.hppa" unless="gluegen.cpptasks.detected.os.2" if="isLinuxHppa">
    <property name="os.and.arch" value="linux-hppa" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.mips" unless="gluegen.cpptasks.detected.os.2" if="isLinuxMips">
    <property name="os.and.arch" value="linux-mips" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.mipsel" unless="gluegen.cpptasks.detected.os.2" if="isLinuxMipsel">
    <property name="os.and.arch" value="linux-mipsel" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.ppc" unless="gluegen.cpptasks.detected.os.2" if="isLinuxPpc">
    <property name="os.and.arch" value="linux-ppc" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.ppc64" unless="gluegen.cpptasks.detected.os.2" if="isLinuxPpc64">
    <property name="os.and.arch" value="linux-ppc64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.ppc64le" unless="gluegen.cpptasks.detected.os.2" if="isLinuxPpc64le">
    <property name="os.and.arch" value="linux-ppc64le" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.s390" unless="gluegen.cpptasks.detected.os.2" if="isLinuxs390">
    <property name="os.and.arch" value="linux-s390" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.s390x" unless="gluegen.cpptasks.detected.os.2" if="isLinuxs390x">
    <property name="os.and.arch" value="linux-s390x" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux.sparc" unless="gluegen.cpptasks.detected.os.2" if="isLinuxSparc">
    <property name="os.and.arch" value="linux-sparc" />
  </target>

  <target name="gluegen.cpptasks.detect.os.android.armv6.armel" unless="gluegen.cpptasks.detected.os.2" if="isAndroidARMv6Armel">
    <property name="os.and.arch" value="android-armv6" />
  </target>

  <target name="gluegen.cpptasks.detect.os.android.armv6.armhf" unless="gluegen.cpptasks.detected.os.2" if="isAndroidARMv6Armhf">
    <property name="os.and.arch" value="android-armv6hf" />
  </target>

  <target name="gluegen.cpptasks.detect.os.android.aarch64" unless="gluegen.cpptasks.detected.os.2" if="isAndroidARM64">
    <property name="os.and.arch" value="android-aarch64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.android.x86" unless="gluegen.cpptasks.detected.os.2" if="isAndroidX86">
    <property name="os.and.arch" value="android-x86" />
  </target>

  <target name="gluegen.cpptasks.detect.os.linux" depends="gluegen.cpptasks.detect.os.linux.amd64,gluegen.cpptasks.detect.os.linux.ia64,gluegen.cpptasks.detect.os.linux.x86,gluegen.cpptasks.detect.os.linux.armv6.armel,gluegen.cpptasks.detect.os.linux.armv6.armhf,gluegen.cpptasks.detect.os.android.armv6.armel,gluegen.cpptasks.detect.os.linux.aarch64,gluegen.cpptasks.detect.os.android.armv6.armhf,gluegen.cpptasks.detect.os.android.aarch64,gluegen.cpptasks.detect.os.android.x86,gluegen.cpptasks.detect.os.linux.alpha,gluegen.cpptasks.detect.os.linux.hppa,gluegen.cpptasks.detect.os.linux.mips,gluegen.cpptasks.detect.os.linux.mipsel,gluegen.cpptasks.detect.os.linux.ppc,gluegen.cpptasks.detect.os.linux.ppc64,gluegen.cpptasks.detect.os.linux.ppc64le,gluegen.cpptasks.detect.os.linux.s390,gluegen.cpptasks.detect.os.linux.s390x,gluegen.cpptasks.detect.os.linux.sparc" unless="gluegen.cpptasks.detected.os.2" />

  <target name="gluegen.cpptasks.detect.os.osx" unless="gluegen.cpptasks.detected.os.2" if="isOSX">
    <property name="native.library.prefix"     value="lib" />
    <property name="native.library.suffix"     value="dylib" />
    <property name="os.and.arch" value="macosx-universal" />
  </target>

  <target name="gluegen.cpptasks.detect.os.ios.amd64" unless="gluegen.cpptasks.detected.os.2" if="isIOSAmd64">
    <property name="native.library.prefix"     value="lib" />
    <property name="native.library.suffix"     value="a" />
    <property name="os.and.arch" value="ios-amd64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.ios.arch64" unless="gluegen.cpptasks.detected.os.2" if="isIOSArm64">
    <property name="native.library.prefix"     value="lib" />
    <property name="native.library.suffix"     value="a" />
    <property name="os.and.arch" value="ios-arm64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.solaris.sparc" unless="gluegen.cpptasks.detected.os.2" if="isSolarisSparc">
    <property name="os.and.arch" value="solaris-sparc" />
  </target>

  <target name="gluegen.cpptasks.detect.os.solaris.sparcv9" unless="gluegen.cpptasks.detected.os.2" if="isSolarisSparcv9">
    <property name="os.and.arch" value="solaris-sparcv9" />
  </target>

  <target name="gluegen.cpptasks.detect.os.solaris.amd64" unless="gluegen.cpptasks.detected.os.2" if="isSolarisAMD64">
    <property name="os.and.arch" value="solaris-amd64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.solaris.x86" unless="gluegen.cpptasks.detected.os.2" if="isSolarisX86">
    <property name="os.and.arch" value="solaris-i586" />
  </target>

  <target name="gluegen.cpptasks.detect.os.solaris" depends="gluegen.cpptasks.detect.os.solaris.sparc,gluegen.cpptasks.detect.os.solaris.sparcv9,gluegen.cpptasks.detect.os.solaris.amd64,gluegen.cpptasks.detect.os.solaris.x86" unless="gluegen.cpptasks.detected.os.2" />

  <target name="gluegen.cpptasks.detect.os.unix" unless="gluegen.cpptasks.detected.os.2" if="isUnix">
    <property name="native.library.prefix"     value="lib" />
    <property name="native.library.suffix"     value="so" />
  </target>

  <target name="gluegen.cpptasks.detect.os.windows.amd64" unless="gluegen.cpptasks.detected.os.2" if="isWindowsAMD64">
    <property name="os.and.arch" value="windows-amd64" />
  </target>

  <target name="gluegen.cpptasks.detect.os.windows.x86" unless="gluegen.cpptasks.detected.os.2" if="isWindowsX86">
    <property name="os.and.arch" value="windows-i586" />
  </target>

  <target name="gluegen.cpptasks.detect.os.windows" depends="gluegen.cpptasks.detect.os.windows.amd64,gluegen.cpptasks.detect.os.windows.x86" unless="gluegen.cpptasks.detected.os.2" if="isWindows">
    <property name="native.library.prefix"     value="" />
    <property name="native.library.suffix"     value="dll" />
  </target>

  <target name="gluegen.cpptasks.detect.os.2" depends="gluegen.cpptasks.detect.os.refine,gluegen.cpptasks.detect.os.freebsd,gluegen.cpptasks.detect.os.hpux,gluegen.cpptasks.detect.os.linux,gluegen.cpptasks.detect.os.osx,gluegen.cpptasks.detect.os.ios.amd64,gluegen.cpptasks.detect.os.ios.arch64,gluegen.cpptasks.detect.os.solaris,gluegen.cpptasks.detect.os.unix,gluegen.cpptasks.detect.os.windows"  unless="gluegen.cpptasks.detected.os.2">
    <propertyregex property="os.and.arch.dot"
                   input="${os.and.arch}"
                   regexp="-"
                   replace="."
                   global="true" />
    <propertyregex property="os.and.arch.slash"
                   input="${os.and.arch}"
                   regexp="-"
                   replace="/"
                   global="true" />
    <echo message="os and arch:       ${os.and.arch}" />
    <echo message="os and arch.dot:   ${os.and.arch.dot}" />
    <echo message="os and arch.slash: ${os.and.arch.slash}" />
  </target>

  <target name="gluegen.cpptasks.detect.os" depends="gluegen.properties.load.user,gluegen.cpptasks.detect.os.custom,gluegen.cpptasks.detect.os.1,gluegen.cpptasks.detect.os.2">
    <property name="gluegen.cpptasks.detected.os" value="true" />
    <property name="gluegen.cpptasks.detected.os.2" value="true" />

    <!-- Set the OS search library environment variable -->
    <condition property="system.env.library.path"
               value="DYLD_LIBRARY_PATH">
      <isset property="isOSX"/> 
    </condition>
    <condition property="system.env.library.path"
               value="DYLD_LIBRARY_PATH">
      <isset property="isIOS"/> 
    </condition>
    <condition property="system.env.library.path"
               value="LD_LIBRARY_PATH">
      <isset property="isUnix"/> 
    </condition>
    <condition property="system.env.library.path"
               value="PATH">
      <isset property="isWindows"/> 
    </condition>

    <!-- NOTE: the value of the c.strip.tool and c.strip.args attribute will not be overridden if already set externally -->
    <property name="c.strip.tool"     value="strip" /> 
    <condition property="c.strip.args" value="-S -x"><isset property="isOSX"/></condition>
    <condition property="c.strip.args" value="-S -x"><isset property="isIOS"/></condition>
    <property name="c.strip.args"     value="" /> 

    <condition property="awk_executable" value="gawk" else="awk"><isset property="isWindows"/></condition>
  </target>

  <!-- Detect compiler setup, in particular on Windows; separated
     - out because this must sometimes be called late in the setup process
    -->
  <target name="gluegen.cpptasks.detect.compiler">
    <condition property="isGCC">
        <equals arg1="${gcc.compat.compiler}" arg2="gcc" />
    </condition>
    <condition property="isCLANG">
        <or>
            <equals arg1="${gcc.compat.compiler}" arg2="clang" />
            <equals arg1="${gcc.compat.compiler}" arg2="xcode.clang" />
        </or>
    </condition>
    <echo message="gcc.compat.compiler=${gcc.compat.compiler}" />
    <echo message="GCC=${isGCC}" />
    <echo message="CLANG=${isCLANG}" />

    <!-- Set up compiler selection on Windows -->
    <condition property="isVCFamily">
      <and>
        <istrue value="${isWindows}" />
        <not>
          <or>
              <equals arg1="${win32.c.compiler}" arg2="mingw32" />
              <equals arg1="${win32.c.compiler}" arg2="mingw64" />
          </or>
        </not>
      </and>
    </condition>
    <condition property="isVC6">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc6" />
      </and>
    </condition>
    <condition property="isVC7">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc7" />
      </and>
    </condition>
    <condition property="isVC8">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc8" />
      </and>
    </condition>
    <condition property="isVC9">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc9" />
      </and>
    </condition>
    <condition property="isVC8_X64">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="vc8_x64" />
      </and>
    </condition>
    <condition property="isVC8Family">
      <or>
        <istrue value="${isVC8}" />
        <istrue value="${isVC8_X64}" />
        <istrue value="${isVC9}" />
      </or>
    </condition>
    <condition property="isMingW64">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="mingw64" />
      </and>
    </condition>
    <condition property="isMingW32">
      <and>
        <istrue value="${isWindows}" />
        <equals arg1="${win32.c.compiler}" arg2="mingw32" />
      </and>
    </condition>
    <condition property="isMingW">
      <or>
        <isset property="isMingW32" />
        <isset property="isMingW64" />
      </or>
    </condition>
    <condition property="WindowsFailure">
      <and>
        <istrue  value="${isWindows}" />
        <isfalse value="${isVC6}" />
        <isfalse value="${isVC7}" />
        <isfalse value="${isVC8}" />
        <isfalse value="${isVC8_X64}" />
        <isfalse value="${isVC9}" />
        <isfalse value="${isMingW32}" />
        <isfalse value="${isMingW64}" />
      </and>
    </condition>
    <fail message="Must specify either win32.c.compiler in e.g. gluegen.properties or use e.g. win32.vc6 build target" if="WindowsFailure" />
    <echo message="VC6=${isVC6}" />
    <echo message="VC7=${isVC7}" />
    <echo message="VC8=${isVC8}" />
    <echo message="VC8_X64=${isVC8_X64}" />
    <echo message="VC9=${isVC9}" />
    <echo message="MingW=${isMingW}" />
    <echo message="MingW32=${isMingW32}" />
    <echo message="MingW64=${isMingW64}" />

    <condition property="isVC7Debug">
      <and>
        <istrue value="${isVC7}" />
        <istrue value="${c.compiler.debug}" />
      </and>
    </condition>
    <condition property="isVC8Debug">
      <and>
        <istrue value="${isVC8}" />
        <istrue value="${c.compiler.debug}" />
      </and>
    </condition>
    <condition property="isVC9Debug">
      <and>
        <istrue value="${isVC9}" />
        <istrue value="${c.compiler.debug}" />
      </and>
    </condition>
  </target>

    <!-- ================================================================== -->
    <!-- 
       - Set up 'java.home.dir' appropriately on all platforms. 
       - Used to be the directory above 'java.home' jre path, 
       - since the <java-install-dir>'s underlying jre was selected for ANT's 'java.home'.
       - JDK 9 and later's installation layout should no more contain '<java-install-dir>/jre',
       - hence java.home.dir' should be equal to ANT's 'java.home'.
       - However, we still probe for the traditional installation layout, to enable individual setups.
       - Hence we still probe for '${java.home}/../jre' to define 'java.home.dir' 
       - and also probe for '${java.home.dir}/jre/lib' to define 'java.lib.dir.platform' below.
      -->
  <target name="setup.java.home.dir">
      <property name="java.home.dir" value="${java.home}" />
      <condition property="java.home.dir"
                 value="${java.home}/.." 
                 else="${java.home}" >
                 <available file="${java.home}/../jre" type="dir" />
      </condition>
      <property name="java.includes.dir" value="${gluegen.root.abs-path}/make/stub_includes/jni" />
      <echo message="java.home.dir      ${java.home.dir}" />
      <echo message="java.includes.dir  ${java.includes.dir}" />
  </target>

  <target name="gluegen.cpptasks.configure.compiler" depends="setup.java.home.dir">

    <!-- UNIX compiler configuration -->

    <compiler id="compiler.cfg.freebsd" name="${gcc.compat.compiler}">
      <defineset>
        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="FREEBSD" />
        <define name="BSD" />
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
      </defineset>
    </compiler>

    <compiler id="compiler.cfg.linux" name="${gcc.compat.compiler}">
      <defineset>
        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>        
        <define name="DEBUG"    if="c.compiler.use-debug"/>        
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>        
      </defineset>
      <compilerarg value="-include"/>
      <compilerarg value="${gluegen.root.abs-path}/make/stub_includes/platform/glibc-compat-symbols.h" />
    </compiler>

    <compiler id="compiler.cfg.linux.x86" name="${gcc.compat.compiler}">
      <compilerarg value="-m32"/>
      <defineset>
        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>        
        <define name="DEBUG"    if="c.compiler.use-debug"/>        
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>        
      </defineset>
      <compilerarg value="-include"/>
      <compilerarg value="${gluegen.root.abs-path}/make/stub_includes/platform/glibc-compat-symbols.h" />
    </compiler>

    <compiler id="compiler.cfg.linux.amd64" name="${gcc.compat.compiler}">
      <compilerarg value="-fPIC"/>
      <compilerarg value="-m64"/>
      <defineset>
        <define name="__LP64__" />     <!-- default pre-defined macro for 64bit unix -->

        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>        
        <define name="DEBUG"    if="c.compiler.use-debug"/>        
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>        
      </defineset>
      <compilerarg value="-include"/>
      <compilerarg value="${gluegen.root.abs-path}/make/stub_includes/platform/glibc-compat-symbols.h" />
    </compiler>

    <!-- Using default compiler settings - utilize:
           - lib/gluegen-cpptasks-linux-armv6hf.xml (armv6   + hardfp) 
           - lib/gluegen-cpptasks-linux-aarch64.xml (armv8 64bit) 
         for official JogAmp builds! -->
    <compiler id="compiler.cfg.linux.armv6" name="${gcc.compat.compiler}">
      <defineset>
        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>        
        <define name="DEBUG"    if="c.compiler.use-debug"/>        
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>        
      </defineset>
      <compilerarg value="-fpic" /> 
      <compilerarg value="-include"/>
      <compilerarg value="${gluegen.root.abs-path}/make/stub_includes/platform/glibc-compat-symbols.h" />
    </compiler>

    <!-- Using default compiler settings - utilize:
           - lib/gluegen-cpptasks-linux-armv6hf.xml (armv6   + hardfp) 
           - lib/gluegen-cpptasks-linux-aarch64.xml (armv8 64bit) 
         for official JogAmp builds! -->
    <compiler id="compiler.cfg.linux.aarch64" name="${gcc.compat.compiler}">
      <defineset>
        <define name="__LP64__" />     <!-- default pre-defined macro for 64bit unix -->
        <define name="__aarch64__" />  <!-- default pre-defined macro for armv8-a, 64bit -->

        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>        
        <define name="DEBUG"    if="c.compiler.use-debug"/>        
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>        
      </defineset>
      <compilerarg value="-fpic" /> 
      <compilerarg value="-include"/>
      <compilerarg value="${gluegen.root.abs-path}/make/stub_includes/platform/glibc-compat-symbols.h" />
    </compiler>

    <compiler id="compiler.cfg.android" name="${gcc.compat.compiler}">
        <!-- shall be defined in custom ${gluegen-cpptasks.file} ! -->
    </compiler>

    <compiler id="compiler.cfg.freebsd" name="${gcc.compat.compiler}">
      <defineset>
        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="FREEBSD" />
        <define name="BSD" />
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
      </defineset>
    </compiler>

    <compiler id="compiler.cfg.hpux" name="aCC">
      <!-- Interpret source as ANSI C89 (not C++) -->
      <compilerarg value="-Ae"/> 
      <!-- Dereferences are performed with four-byte loads and stores. -->
      <compilerarg value="+u4"/>
      <!-- Suppress warnings: 
               942: signed/unsigned assignment compatibility
               129: redeclarations in stub_includes -->
      <compilerarg value="+W942,129"/>
      <defineset>
        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <!-- aCC doesn't seem to define a generic system macro, a la 
             "__sun". The documentation claims it defines the following,
             but don't seem to work: __HP_aCC, __LP64__, __RISC_0__. 
             HP-UX docs on JNI say to use the defs below 
             (http://www.hp.com/products1/unix/java/infolibrary/prog_guide/JNI_java2.html) -->
        <!-- Single underscore prefix, as recommended by aCC docs... -->
        <define name="_HPUX"/> 
        <define name="_POSIX_C_SOURCE" value="199506L"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
      </defineset>
    </compiler>
 
    <!-- SOLARIS compiler configuration --> 

    <compiler id="compiler.cfg.solaris" name="${gcc.compat.compiler}"> 
      <compilerarg value="-m32"/>
      <defineset> 
        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
        <define name="SOLARIS" /> 
      </defineset> 
    </compiler> 

    <compiler id="compiler.cfg.solaris.sparcv9" name="${gcc.compat.compiler}"> 
      <compilerarg value="-fast" /> 
      <compilerarg value="-xchip=ultra" /> 
      <compilerarg value="-xarch=v9a" /> 
      <defineset> 
        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
        <define name="SOLARIS" /> 
      </defineset> 
    </compiler> 

    <compiler id="compiler.cfg.solaris.amd64" name="${gcc.compat.compiler}"> 
      <compilerarg value="-fPIC"/>
      <compilerarg value="-m64"/>
      <!-- compilerarg value="-fast" /--> 
      <!-- compilerarg value="-xchip=opteron" / --> 
      <!-- compilerarg value="-xarch=amd64" / --> 
      <!-- compilerarg value="-xcache=64/64/2:1024/64/16" / --> 
      <defineset> 
        <define name="__LP64__" />     <!-- default pre-defined macro for 64bit unix -->

        <define name="__unix__"/>
        <define name="__X11__"  if="isX11"/>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
        <define name="SOLARIS" /> 
      </defineset> 
    </compiler>

    <!-- MacOSX compiler configuration -->

    <compiler id="compiler.cfg.macosx" name="${gcc.compat.compiler}">
      <!-- Note: Apple doesn't seem to provide ppc binaries on Snow Leopard -->
      <compilerarg value="-arch" if="use.macosppc"/>
      <compilerarg value="ppc" if="use.macosppc"/>
      <compilerarg value="-arch" if="use.macosx32"/>
      <compilerarg value="i386" if="use.macosx32"/>
      <compilerarg value="-arch" if="use.macosx64"/>
      <compilerarg value="x86_64" if="use.macosx64"/>
      <!-- Note: Apple doesn't seem to provide ppc64 binaries on Leopard -->
      <compilerarg value="-Wmost" />
      <compilerarg value="-ObjC" />
      <compilerarg value="-mmacosx-version-min=10.5"/>
      <!-- sysincludepath path="${macosx.sdkroot}" if="macosx.sdkroot"/ -->
      <defineset>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
      </defineset>
    </compiler>

    <compiler id="compiler.cfg.ios.amd64" name="${gcc.compat.compiler}">
      <!-- compilerarg value="-v"/ -->
      <compilerarg value="-arch"/>
      <compilerarg value="x86_64"/>
      <compilerarg value="-Wmost" />
      <compilerarg value="-ObjC" />
      <compilerarg value="-miphoneos-version-min=11.0"/>
      <!-- sysincludepath path="${macosx.sdkroot}" if="macosx.sdkroot"/ -->
      <defineset>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
      </defineset>
    </compiler>

    <compiler id="compiler.cfg.ios.arm64" name="${gcc.compat.compiler}">
      <!-- compilerarg value="-v"/ -->
      <compilerarg value="-arch"/>
      <compilerarg value="arm64"/>
      <compilerarg value="-Wmost" />
      <compilerarg value="-ObjC" />
      <compilerarg value="-miphoneos-version-min=11.0"/>
      <!-- sysincludepath path="${macosx.sdkroot}" if="macosx.sdkroot"/ -->
      <defineset>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
      </defineset>
    </compiler>

    <!-- Windows compiler configuration -->

    <!--compiler id="compiler.cfg.linux64.mingw64" classname="net.sf.antcontrib.cpptasks.gcc.Gcc64CCompiler"-->
    <compiler id="compiler.cfg.linux64.mingw64" classname="net.sf.antcontrib.cpptasks.gcc.GccCCompiler">
        <compilerarg value="-fPIC"/>
        <compilerarg value="-m64"/>
    </compiler>

    <!--compiler id="compiler.cfg.linux64.mingw32" classname="net.sf.antcontrib.cpptasks.gcc.Gcc32CCompiler"-->
    <compiler id="compiler.cfg.linux64.mingw32" classname="net.sf.antcontrib.cpptasks.gcc.GccCCompiler">
        <compilerarg value="-m32"/>
    </compiler>

    <compiler id="compiler.cfg.win32.mingw" name="${gcc.compat.compiler}">
      <compilerarg value="-g" if="c.compiler.use-debug"/> 
      <compilerarg value="-O0" if="c.compiler.use-debug"/> 
      <compilerarg value="-O2" unless="c.compiler.use-debug"/>
      <defineset>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>        
        <define name="DEBUG"    if="c.compiler.use-debug"/>        
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>        

        <define name="DBUILD_DLL" />
        <define name="_STRICT_ANSI" /> 
        <define name="_JNI_IMPLEMENTATION_" />
        <define name="WINVER"         value="0x0601"/> <!-- set windows version to >= Windows 7 -->
        <define name="_WIN32_WINNT"   value="0x0601"/> <!-- set windows version to >= Windows 7 -->
      </defineset>
    </compiler>

    <compiler id="compiler.cfg.win64.mingw" name="${gcc.compat.compiler}">
      <compilerarg value="-g" if="c.compiler.use-debug"/> 
      <compilerarg value="-O0" if="c.compiler.use-debug"/> 
      <compilerarg value="-O2" unless="c.compiler.use-debug"/>
      <defineset>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>        
        <define name="DEBUG"    if="c.compiler.use-debug"/>        
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>        

        <define name="DBUILD_DLL" />
        <define name="_STRICT_ANSI" /> 
        <define name="_JNI_IMPLEMENTATION_" />
        <define name="WINVER"         value="0x0601"/> <!-- set windows version to >= Windows 7 -->
        <define name="_WIN32_WINNT"   value="0x0601"/> <!-- set windows version to >= Windows 7 -->
      </defineset>
    </compiler>

    <compiler id="compiler.cfg.win32.msvc" name="msvc">
      <compilerarg value="/W3"/>      <!-- set warning level -->
      <compilerarg value="/Ob1"/>     <!-- inline only functions marked inline -->
      <compilerarg value="/GF"/>      <!-- enable string pooling -->
      <compilerarg value="/Gy"/>      <!-- enable function level linking -->
      <compilerarg value="/GS"      if="isVC7"/>  <!-- buffer security checks -->
      <compilerarg value="/Wp64"    if="isVC7"/>  <!-- detect 64-bit port problems -->
      <compilerarg value="/RTCcsu"  if="isVC7Debug"/>  <!-- various runtime checks -->
      <!-- Note: previous compiler options for VC7 were:
           Debug:     /MDd /Yd /GS /RTCs /RTCu /RTCc /W3 /Od /GF /EHsc /Zi /GS /Gy /Wp64 /Zi /D &quot;_DEBUG&quot;
           Optimized: /MD /W3 /O2 /Ob1 /GF /EHsc /GS /Gy /Wp64 /D &quot;NDEBUG&quot; -->
      <compilerarg value="/GS"      if="isVC8"/>  <!-- buffer security checks -->
      <compilerarg value="/Wp64"    if="isVC8"/>  <!-- detect 64-bit port problems -->
      <compilerarg value="/RTCcsu"  if="isVC8Debug"/>  <!-- various runtime checks -->
      <compilerarg value="/NODEFAULTLIB:oldnames.lib" if="isVC8"/>  <!-- library not available with VC8 -->
      <compilerarg value="/GS"      if="isVC9"/>  <!-- buffer security checks -->
      <compilerarg value="/RTCcsu"  if="isVC9Debug"/>  <!-- various runtime checks -->
      <!--compilerarg value="/MT"      if="isVC9"/-->  <!-- static multithreaded - somehow overwritten by default /MD -->

      <defineset>
        <define name="_DEBUG"   if="c.compiler.use-debug"/>
        <define name="DEBUG"    if="c.compiler.use-debug"/>
        <define name="NDEBUG"   unless="c.compiler.use-debug"/>
      </defineset>
    </compiler>

    <!-- linker configuration -->
 
    <!-- Unix linker configuration -->

    <linker id="linker.cfg.linux" name="${gcc.compat.compiler}">
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <linker id="linker.cfg.linux.x86" name="${gcc.compat.compiler}">
      <linkerarg value="-m32"/>
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <linker id="linker.cfg.linux.amd64" name="${gcc.compat.compiler}">
      <linkerarg value="-m64"/>
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <!-- Using default compiler settings - utilize:
           - lib/gluegen-cpptasks-linux-armv6hf.xml (armv6   + hardfp) 
           - lib/gluegen-cpptasks-linux-aarch64.xml (armv8 64bit) 
         for official JogAmp builds! -->
    <linker id="linker.cfg.linux.armv6" name="${gcc.compat.compiler}">
      <linkerarg value="-fpic" /> 
      <linkerarg value="-nostdlib" />
      <linkerarg value="-Bdynamic" />
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <!-- Using default compiler settings - utilize:
           - lib/gluegen-cpptasks-linux-armv6hf.xml (armv6   + hardfp) 
           - lib/gluegen-cpptasks-linux-aarch64.xml (armv8 64bit) 
         for official JogAmp builds! -->
    <linker id="linker.cfg.linux.aarch64" name="${gcc.compat.compiler}">
      <linkerarg value="-fpic" /> 
      <linkerarg value="-nostdlib" />
      <linkerarg value="-Bdynamic" />
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <linker id="linker.cfg.linux.alpha" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.hppa" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.mips" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.mipsel" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.ppc" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.ppc64" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.ppc64le" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.s390" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.s390x" name="${gcc.compat.compiler}">
    </linker>

    <linker id="linker.cfg.linux.sparc" name="${gcc.compat.compiler}">
    </linker>

    <compiler id="linker.cfg.android" name="${gcc.compat.compiler}">
      <!-- shall be defined in custom ${gluegen-cpptasks.file} ! -->
    </compiler>

    <linker id="linker.cfg.hpux" name="aCC">
    </linker>

    <linker id="linker.cfg.freebsd.x86" name="${gcc.compat.compiler}">
      <linkerarg value="-m32"/>
    </linker>

    <linker id="linker.cfg.freebsd.amd64" name="${gcc.compat.compiler}">
      <linkerarg value="-m64"/>
    </linker>

    <!-- SOLARIS linker configuration --> 

    <linker id="linker.cfg.solaris" name="${gcc.compat.compiler}"> 
      <linkerarg value="-m32"/>
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker> 

    <linker id="linker.cfg.solaris.sparcv9" name="${gcc.compat.compiler}"> 
      <linkerarg value="-xarch=v9a" /> 
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker> 

    <linker id="linker.cfg.solaris.amd64" name="${gcc.compat.compiler}"> 
      <linkerarg value="-m64"/>
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
      <!-- linkerarg value="-xarch=amd64" / --> 
    </linker>

    <!-- MacOSX linker configuration -->

    <linker id="linker.cfg.macosx" name="${gcc.compat.compiler}">
      <!-- compilerarg value="-v"/ -->
      <linkerarg value="-arch" if="use.macosppc"/>
      <linkerarg value="ppc" if="use.macosppc"/>
      <linkerarg value="-arch" if="use.macosx32"/>
      <linkerarg value="i386" if="use.macosx32"/>
      <linkerarg value="-arch" if="use.macosx64"/>
      <linkerarg value="x86_64" if="use.macosx64"/>
      <linkerarg value="-mmacosx-version-min=10.5"/>
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <linker id="linker.cfg.ios.amd64" name="${gcc.compat.compiler}">
      <!-- compilerarg value="-v"/ -->
      <linkerarg value="-arch"/>
      <linkerarg value="x86_64"/>
      <linkerarg value="-miphoneos-version-min=11.0"/>
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <linker id="linker.cfg.ios.arm64" name="${gcc.compat.compiler}">
      <!-- compilerarg value="-v"/ -->
      <linkerarg value="-arch"/>
      <linkerarg value="arm64"/>
      <linkerarg value="-miphoneos-version-min=11.0"/>
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <!-- Windows linker configuration -->

    <!--linker id="linker.cfg.linux64.mingw64" classname="net.sf.antcontrib.cpptasks.gcc.Gcc64Linker"-->
    <linker id="linker.cfg.linux64.mingw64" classname="net.sf.antcontrib.cpptasks.gcc.GccLinker">
      <linkerarg value="-m64"/>
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>
    
    <!--linker id="linker.cfg.linux64.mingw32" classname="net.sf.antcontrib.cpptasks.gcc.Gcc32Linker"-->
    <linker id="linker.cfg.linux64.mingw32" classname="net.sf.antcontrib.cpptasks.gcc.GccLinker">
      <linkerarg value="-m32"/>
      <linkerarg value="-Wl,--kill-at" />        <!-- remove @ from function names, ie no __stdcall @nn -->
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <linker id="linker.cfg.win32.mingw" name="${gcc.compat.compiler}" incremental="false">
      <linkerarg value="-m32"/>
      <linkerarg value="-Wl,--enable-auto-import"/>    <!-- for linking against dll directly -->
      <linkerarg value="-Wl,--enable-stdcall-fixup"/>  <!-- for linking against dll directly -->
      <linkerarg value="-Wl,--kill-at" />        <!-- remove @ from function names, ie no __stdcall @nn -->
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <linker id="linker.cfg.win64.mingw" name="${gcc.compat.compiler}" incremental="false">
      <linkerarg value="-m64"/>
      <linkerarg value="-Wl,--enable-auto-import"/>    <!-- for linking against dll directly -->
      <linkerarg value="-Wl,--enable-stdcall-fixup"/>  <!-- for linking against dll directly -->
      <linkerarg value="-Wl,--kill-at" />        <!-- remove @ from function names, ie no __stdcall @nn -->
      <linkerarg value="-static-libgcc" if="isGCC"/>
      <linkerarg value="-static-libstdc++" if="isGCC"/>
    </linker>

    <linker id="linker.cfg.win32.msvc" name="msvc" incremental="false">
      <linkerarg value="/OPT:REF,ICF" />        <!-- enable link-time optimisations -->
      <linkerarg value="/SUBSYSTEM:WINDOWS" />  <!-- output is not a console app as uses WinMain entry point -->
      <linkerarg value="/MACHINE:X86" if="isVC6" />       <!-- explicity set target platform -->
      <linkerarg value="/MACHINE:X86" if="isVC7" />       <!-- explicity set target platform -->
      <linkerarg value="/MACHINE:X86" if="isVC8" />       <!-- explicity set target platform -->
      <linkerarg value="/MACHINE:X64" if="isVC8_X64"/>    <!-- explicity set target platform (IX64) -->
      <linkerarg value="/MACHINE:X86" if="isVC9" />       <!-- explicity set target platform -->
    </linker>

  </target>

    <!-- ================================================================== -->
    <!--
       - Platform specific declares.
      -->
    <target name="gluegen.cpptasks.declare.compiler.environment" >
      <condition property="java.lib.dir.platform"
                 value="${TARGET_JAVA_LIBS}" >
                 <available file="${TARGET_JAVA_LIBS}" type="dir" />
      </condition>
    </target>

    <target name="gluegen.cpptasks.declare.compiler.win32.vc6" if="isVC6">
      <echo message="Win32.VC6" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.base"            value="linker.cfg.win32.msvc" />
    </target>
    
    <target name="gluegen.cpptasks.declare.compiler.win32.vc7" if="isVC7">
      <echo message="Win32.VC7" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.base"            value="linker.cfg.win32.msvc" />
    </target>
    
    <target name="gluegen.cpptasks.declare.compiler.win32.vc8" if="isVC8">
      <echo message="Win32.VC8" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.base"            value="linker.cfg.win32.msvc" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler.win32.vc8_x64" if="isVC8_X64">
      <echo message="Win32.VC8_X64" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.base"            value="linker.cfg.win32.msvc" />
    </target>
    
    <target name="gluegen.cpptasks.declare.compiler.win32.vc9" if="isVC9">
      <echo message="Win32.VC9" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.base"            value="linker.cfg.win32.msvc" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler.win32.mingw" if="isMingW32">
      <echo message="Win32.MingW" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.win32.mingw" />
      <property name="linker.cfg.id.base"            value="linker.cfg.win32.mingw" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler.win64.mingw" if="isMingW64">
      <echo message="Win64.MingW" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.win64.mingw" />
      <property name="linker.cfg.id.base"            value="linker.cfg.win64.mingw" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/bin" /> <!-- link against dll directly (not lib)-->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.win32" depends="gluegen.cpptasks.declare.compiler.win32.vc6,gluegen.cpptasks.declare.compiler.win32.vc7,gluegen.cpptasks.declare.compiler.win32.vc8,gluegen.cpptasks.declare.compiler.win32.vc8_x64,gluegen.cpptasks.declare.compiler.win32.vc9,gluegen.cpptasks.declare.compiler.win32.mingw,gluegen.cpptasks.declare.compiler.win64.mingw" if="isWindows">
      <property name="java.includes.dir.platform"    value="${java.includes.dir}/win32" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.x86" if="isLinuxX86">
      <echo message="Linux.x86" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux.x86" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux.x86" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/i386" 
                                                      file="${java.home.dir}/jre/lib/i386/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/i386"     
                                                      file="${java.home.dir}/lib/i386/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.amd64" if="isLinuxAMD64">
      <echo message="Linux.AMD64" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux.amd64" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux.amd64" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/amd64" 
                                                      file="${java.home.dir}/jre/lib/amd64/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/amd64"     
                                                      file="${java.home.dir}/lib/amd64/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.alpha" if="isLinuxAlpha">
      <echo message="Linux.alpha" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux.alpha" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux.alpha" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/alpha" 
                                                      file="${java.home.dir}/jre/lib/alpha/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/alpha"     
                                                      file="${java.home.dir}/lib/alpha/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.armv6" if="isLinuxARMv6">
      <echo message="Linux.armv6" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux.armv6" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux.armv6" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/arm" 
                                                      file="${java.home.dir}/jre/lib/arm/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/arm"     
                                                      file="${java.home.dir}/lib/arm/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.aarch64" if="isLinuxARM64">
      <echo message="Linux.aarch64" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux.aarch64" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux.aarch64" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/aarch64" 
                                                      file="${java.home.dir}/jre/lib/aarch64/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/aarch64"     
                                                      file="${java.home.dir}/lib/aarch64/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.ia64" if="isLinuxIA64">
      <echo message="Linux.IA64" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/ia64" 
                                                      file="${java.home.dir}/jre/lib/ia64/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/ia64"     
                                                      file="${java.home.dir}/lib/ia64/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.hppa" if="isLinuxHppa">
      <echo message="Linux.hppa" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/hppa" 
                                                      file="${java.home.dir}/jre/lib/hppa/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/hppa"     
                                                      file="${java.home.dir}/lib/hppa/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.mips" if="isLinuxMips">
      <echo message="Linux.Mips" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/mips" 
                                                      file="${java.home.dir}/jre/lib/mips/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/mips"     
                                                      file="${java.home.dir}/lib/mips/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.mipsel" if="isLinuxMipsel">
      <echo message="Linux.Mipsel" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/mipsel" 
                                                      file="${java.home.dir}/jre/lib/mipsel/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/mipsel"     
                                                      file="${java.home.dir}/lib/mipsel/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.ppc" if="isLinuxPpc">
      <echo message="Linux.Ppc" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/ppc" 
                                                      file="${java.home.dir}/jre/lib/ppc/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/ppc"     
                                                      file="${java.home.dir}/lib/ppc/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.ppc64" if="isLinuxPpc64">
      <echo message="Linux.Ppc64" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" />
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/ppc64" 
                                                      file="${java.home.dir}/jre/lib/ppc64/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/ppc64"     
                                                      file="${java.home.dir}/lib/ppc64/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.ppc64le" if="isLinuxPpc64le">
      <echo message="Linux.Ppc64le" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" />
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/ppc64le" 
                                                      file="${java.home.dir}/jre/lib/ppc64le/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/ppc64le"     
                                                      file="${java.home.dir}/lib/ppc64le/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.s390" if="isLinuxs390">
      <echo message="Linux.s390" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/s390" 
                                                      file="${java.home.dir}/jre/lib/s390/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/s390"     
                                                      file="${java.home.dir}/lib/s390/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.s390x" if="isLinuxs390x">
      <echo message="Linux.s390x" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/s390x" 
                                                      file="${java.home.dir}/jre/lib/s390x/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/s390x"     
                                                      file="${java.home.dir}/lib/s390x/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.sparc" if="isLinuxSparc">
      <echo message="Linux.Sparc" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" /> 
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/sparc" 
                                                      file="${java.home.dir}/jre/lib/sparc/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/sparc"     
                                                      file="${java.home.dir}/lib/sparc/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux" depends="gluegen.cpptasks.declare.compiler.linux.x86,gluegen.cpptasks.declare.compiler.linux.amd64,gluegen.cpptasks.declare.compiler.linux.ia64,gluegen.cpptasks.declare.compiler.linux.armv6,gluegen.cpptasks.declare.compiler.linux.aarch64,gluegen.cpptasks.declare.compiler.linux.alpha,gluegen.cpptasks.declare.compiler.linux.hppa,gluegen.cpptasks.declare.compiler.linux.mips,gluegen.cpptasks.declare.compiler.linux.mipsel,gluegen.cpptasks.declare.compiler.linux.ppc,gluegen.cpptasks.declare.compiler.linux.ppc64,gluegen.cpptasks.declare.compiler.linux.ppc64le,gluegen.cpptasks.declare.compiler.linux.s390,gluegen.cpptasks.declare.compiler.linux.s390x,gluegen.cpptasks.declare.compiler.linux.sparc" if="isLinux">
        <property name="java.includes.dir.platform" value="${java.includes.dir}/x11" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler.solaris32" if="isSolaris32Bit">
      <echo message="Solaris" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.solaris" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.solaris" /> 
    </target>

    <target name="gluegen.cpptasks.declare.compiler.solaris.sparcv9" if="isSolarisSparcv9">
      <echo message="SolarisSparcv9" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.solaris.sparcv9" />
      <property name="linker.cfg.id.base"            value="linker.cfg.solaris.sparcv9" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler.solaris.amd64" if="isSolarisAMD64">
      <echo message="SolarisAMD64" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.solaris.amd64" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.solaris.amd64" /> 
    </target>

    <target name="gluegen.cpptasks.declare.compiler.solaris" depends="gluegen.cpptasks.declare.compiler.solaris32,gluegen.cpptasks.declare.compiler.solaris.sparcv9,gluegen.cpptasks.declare.compiler.solaris.amd64" if="isSolaris">
      <property name="java.includes.dir.platform"    value="${java.includes.dir}/x11" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/${solaris.cpu}" 
                                                      file="${java.home.dir}/jre/lib/${solaris.cpu}/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/${solaris.cpu}"     
                                                      file="${java.home.dir}/lib/${solaris.cpu}/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.macosx" if="isOSX">
      <echo message="MacOSX" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.macosx" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.macosx" /> 
      <property name="java.includes.dir.platform"    value="${java.includes.dir}/macosx" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib"
                                                      file="${java.home.dir}/jre/lib/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.ios.amd64" if="isIOSAmd64">
      <echo message="iOSAmd64" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.ios.amd64" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.ios.amd64" /> 
      <property name="java.includes.dir.platform"    value="${java.includes.dir}/macosx" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib"
                                                      file="${java.home.dir}/jre/lib/libjava.a"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.ios.arm64" if="isIOSArm64">
      <echo message="iOSArm64" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.ios.arm64" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.ios.arm64" /> 
      <property name="java.includes.dir.platform"    value="${java.includes.dir}/macosx" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib"
                                                      file="${java.home.dir}/jre/lib/libjava.a"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.freebsd.x86" if="isFreeBSDX86">
      <echo message="FreeBSD" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.freebsd" />
      <property name="linker.cfg.id.base"            value="linker.cfg.freebsd.x86" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/i386" 
                                                      file="${java.home.dir}/jre/lib/i386/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/i386"     
                                                      file="${java.home.dir}/lib/i386/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.freebsd.amd64" if="isFreeBSDAMD64">
      <echo message="FreeBSD" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.freebsd" />
      <property name="linker.cfg.id.base"            value="linker.cfg.freebsd.amd64" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/amd64" 
                                                      file="${java.home.dir}/jre/lib/amd64/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/amd64"     
                                                      file="${java.home.dir}/lib/amd64/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler.freebsd" depends="gluegen.cpptasks.declare.compiler.freebsd.x86,gluegen.cpptasks.declare.compiler.freebsd.amd64" if="isFreeBSD">
      <property name="java.includes.dir.platform"    value="${java.includes.dir}/x11" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler.hpux" if="isHPUX">
      <echo message="HP-UX" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.hpux" />
      <property name="linker.cfg.id.base"            value="linker.cfg.hpux" />
      <property name="java.includes.dir.platform"    value="${java.includes.dir}/x11" />
      <available property="java.lib.dir.platform"    value="${java.home.dir}/jre/lib/PA_RISC2.0" 
                                                      file="${java.home.dir}/jre/lib/PA_RISC2.0/libjava.so"/>
      <available property="java.lib.dir.platform"    value="${java.home.dir}/lib/PA_RISC2.0"     
                                                      file="${java.home.dir}/lib/PA_RISC2.0/libjava.so"/>
      <property name="java.lib.dir.platform"         value="${java.home.dir}/lib"/> <!-- new default -->
    </target>

    <target name="gluegen.cpptasks.declare.compiler" depends="gluegen.cpptasks.declare.compiler.environment,gluegen.cpptasks.declare.compiler.win32,gluegen.cpptasks.declare.compiler.linux,gluegen.cpptasks.declare.compiler.solaris,gluegen.cpptasks.declare.compiler.macosx,gluegen.cpptasks.declare.compiler.ios.amd64,gluegen.cpptasks.declare.compiler.ios.arm64,gluegen.cpptasks.declare.compiler.freebsd,gluegen.cpptasks.declare.compiler.hpux" >
      <echo message="java.home.dir                ${java.home.dir}" />
      <echo message="java.includes.dir            ${java.includes.dir}" />
      <echo message="java.includes.dir.platform   ${java.includes.dir.platform}" />
      <echo message="java.lib.dir.platform        ${java.lib.dir.platform}" />
    </target>

    <target name="gluegen.cpptasks.setup.compiler" depends="gluegen.cpptasks.detect.compiler,gluegen.cpptasks.configure.compiler,gluegen.cpptasks.declare.compiler" />

    <!-- ================================================================== -->
    <!--
       - Helper strip.libraries for stripping off debug information
      -->
    <target name="gluegen.cpptasks.striplibs" depends="gluegen.cpptasks.initialize" if="c.strip.libraries">
      <echo message="Strip symbols from libs in ${libdir}" />
      <apply dir="${libdir}" executable="${c.strip.tool}" parallel="false" 
             failonerror="true">
        <arg line="${c.strip.args}"/>
        <fileset dir="${libdir}">
          <include name="**/*.so"/>     <!-- unix    -->
          <include name="**/*.dll"/>    <!-- windows -->
          <include name="**/*.dylib"/>  <!-- macosx  -->
        </fileset>
      </apply>
    </target>

    <!-- ================================================================== -->
    <!--
       - Helper macrodef for installing manifest in generated DLLs, needed for VC8 and later
      -->
    <macrodef name="msvc.manifest">
      <attribute name="objdir" />
      <attribute name="dllname" />
      <sequential>
        <exec executable="mt">
          <arg value="-manifest"/>
          <arg value="@{objdir}/@{dllname}.dll.manifest"/>
          <arg value="-outputresource:@{objdir}/@{dllname}.dll;#2"/>
        </exec>
      </sequential>
    </macrodef>

    <macrodef name="native.tag.jar">
      <attribute name="objdir" />
      <attribute name="nativejarfile" />
      <attribute name="manifestfile" />
      <attribute name="module" />
      <attribute name="includelibs" />
      <attribute name="excludelibs" default="" />
      <sequential>

      <var name="nativejarfile.basename" unset="true"/>
      <var name="nativejarfile.tmpdir" unset="true"/>
      <var name="nativejarfile.tmpdir.natives" unset="true"/>
      <basename property="nativejarfile.basename" file="@{nativejarfile}"/>
      <property name="nativejarfile.tmpdir" value="@{objdir}/${nativejarfile.basename}.d" />
      <property name="nativejarfile.tmpdir.natives" value="${nativejarfile.tmpdir}/jar" />
      <!-- In case we like to switch to a natives subfolder 'natives/${os.and.arch}' use the following -->
      <!-- property name="nativejarfile.tmpdir.natives" value="${nativejarfile.tmpdir}/jar/natives/${os.and.arch}" /-->

      <mkdir dir="${nativejarfile.tmpdir}/java" />
      <mkdir dir="${nativejarfile.tmpdir.natives}" />
      <mkdir dir="${nativejarfile.tmpdir.natives}/natives" />
      <mkdir dir="${nativejarfile.tmpdir.natives}/natives/${os.and.arch}" />
      <copy todir="${nativejarfile.tmpdir.natives}/natives/${os.and.arch}">
        <fileset dir="@{objdir}"
                 includes="@{includelibs}"
                 excludes="@{excludelibs}"/>
      </copy>
      <echo message='package ${nativejartag.package}.@{module}.${os.and.arch.dot}; public final class TAG { }' file="${nativejarfile.tmpdir}/java/${nativejartag.prefix}/@{module}/${os.and.arch.slash}/TAG.java"/>
      <javac destdir="${nativejarfile.tmpdir}/jar"
           includes="${nativejartag.prefix}/@{module}/**"
           includeAntRuntime="false"
           encoding="UTF-8"
           source="${target.sourcelevel}" 
           target="${target.targetlevel}" 
           bootclasspath="${target.rt.jar}">
        <src path="${nativejarfile.tmpdir}/java" />
      </javac>
      <jar destfile="@{nativejarfile}" manifest="@{manifestfile}" filesonly="true">
        <fileset dir="${nativejarfile.tmpdir}/jar">
            <include name="**" />
        </fileset>
      </jar>
      <delete includeEmptyDirs="true">
        <fileset dir="${nativejarfile.tmpdir}" />
      </delete>
      </sequential>
    </macrodef>  

    <macrodef name="gluegen.make.libsymbols">
      <attribute name="builddir" />
      <attribute name="nativelib" />
      <attribute name="symbolsfile" />
      <sequential>
      <!-- invoke nm in a most compatible way, tested on GNU/Linux and MacOS -->
      <exec executable="nm" dir="@{builddir}" output="@{symbolsfile}.raw">
        <arg value="--extern-only"/>
        <arg value="--defined-only"/>
        <arg value="@{nativelib}"/>
      </exec>
      <exec executable="${awk_executable}" dir="@{builddir}" output="@{symbolsfile}">
        <arg value="{ print $3 }"/>
        <arg value="@{symbolsfile}.raw"/>
      </exec>
      <delete file="@{symbolsfile}.raw" quiet="true" failonerror="false" />
      </sequential>
    </macrodef>  
</project>