aboutsummaryrefslogtreecommitdiffstats
path: root/make/gluegen-cpptasks-base.xml
blob: 7d28aef7b2ae80ec4c8c0242c35b3e5a441c50bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
<?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 property "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 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.
   - 
   -   isUnix
   -   isX11
   -   isFreeBSD
   -   isFreeBSDAMD64
   -   isFreeBSDX86
   -   isHPUX
   -   isIA64
   -   isAndroid
   -   isAndroidARMv7
   -   isLinux
   -   isLinuxAMD64
   -   isLinuxIA64
   -   isLinuxX86
   -   isLinuxARMv7
   -   isOSX
   -   isOSXPPC
   -   isSolaris
   -   isSolaris32Bit
   -   isSolarisAMD64
   -   isSolarisSparc
   -   isSolarisSparcv9
   -   isSolarisX86
   -   isWindows
   -   isWindowsX86
   -   isWindowsAMD64
   -   is64Bit
   -
   - isX11 is set if: !isWindows && !isOSX && !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.suffix (i.e.., "so", "dll")
   - 
   - 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.includes.dir           : path to the JNI headers (.../jdk/include)
   -   java.includes.dir.platform  : path to the platform JNI headers (.../jdk/include/linux)
   -   java.lib.dir.platform       : path to the Java library dir (libjawt.so, etc.)
   -
   - 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.
   - 
   -   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.armv7
   -   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.freebsd
   -   compiler.cfg.hpux
   -   linker.cfg.linux
   -   linker.cfg.linux.x86
   -   linker.cfg.linux.amd64
   -   linker.cfg.linux.armv7
   -   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.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=".">

  <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}" />

    <!-- 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.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="macosx32"     value="true" /> 
    <property name="macosx64"     value="true" /> 

    <!-- 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>

  <!-- Detect OS and compiler configuration -->
  <target name="gluegen.cpptasks.detect.os.1" depends="gluegen.cpptasks.initialize" unless="gluegen.cpptasks.detected.os">
    <condition property="isOSX">
      <and>
        <os family="mac"/>
        <os family="unix"/>
      </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}" />
        <or>
          <os arch="i386" />
          <os arch="x86" />
        </or>
      </and>
    </condition>
    <condition property="isWindowsAMD64">
      <and>
        <istrue value="${isWindows}" />
        <os arch="amd64" />
      </and>
    </condition>
    <condition property="isFreeBSDX86">
      <and>
        <istrue value="${isFreeBSD}" />
        <or>
          <os arch="i386" />
          <os arch="x86" />
        </or>
      </and>
    </condition>
    <condition property="isFreeBSDAMD64">
      <and>
        <istrue value="${isFreeBSD}" />
        <or>
          <os arch="AMD64" />
          <os arch="x86_64" />
        </or>
      </and>
    </condition>
    <condition property="isHPUX">
      <os name="HP-UX" />
    </condition>
    <condition property="isAndroidARMv7">
      <and>
        <istrue value="${isAndroid}" />
        <or>
            <os arch="arm" />
            <os arch="armv7" />
        </or>
      </and>
    </condition>
    <condition property="isLinuxARMv7">
      <and>
        <istrue value="${isLinux}" />
        <or>
            <os arch="arm" />
            <os arch="armv7" />
        </or>
      </and>
    </condition>
    <condition property="isLinuxX86">
      <and>
        <istrue value="${isLinux}" />
        <or>
          <os arch="i386" />
          <os arch="x86" />
        </or>
      </and>
    </condition>
    <condition property="isLinuxAMD64">
      <and>
        <istrue value="${isLinux}" />
        <or>
          <os arch="AMD64" />
          <os arch="x86_64" />
        </or>
      </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}" />
         <or>
          <os arch="i386" />
          <os arch="x86" />
          <os arch="sparc" />
         </or>
      </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}" />
          <os arch="AMD64" />
       </and>
    </condition>
    <condition property="isSolarisX86">
      <and>
         <istrue value="${isSolaris}" />
         <or>
          <os arch="i386" />
          <os arch="x86" />
         </or>
      </and>
    </condition>

    <!-- Note: assumes X11 platform by default -->
    <condition property="isX11">
      <and>
        <isfalse value="${isWindows}" />
        <isfalse value="${isOSX}" />
        <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="is64Bit">
      <or>
        <os arch="amd64" />
        <os arch="AMD64" />
        <os arch="sparcv9" />
        <os arch="IA64" />
        <os arch="AMD64" />
        <os arch="x86_64" />
        <os arch="AMD64" />
        <os arch="x86_64" />
      </or>
    </condition>

    <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="AndroidARMv7=${isAndroidARMv7}" />
    <echo message="Linux=${isLinux}" />
    <echo message="LinuxAMD64=${isLinuxAMD64}" />
    <echo message="LinuxIA64=${isLinuxIA64}" />
    <echo message="LinuxX86=${isLinuxX86}" />
    <echo message="LinuxARMv7=${isLinuxARMv7}" />
    <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="Solaris=${isSolaris}" />
    <echo message="Solaris32Bit=${isSolaris32Bit}" />
    <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="is64Bit=${is64Bit}" />
  </target>

  <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.armv7" unless="gluegen.cpptasks.detected.os.2" if="isLinuxARMv7">
    <property name="os.and.arch" value="linux-armv7" />
  </target>

  <target name="gluegen.cpptasks.detect.os.android.armv7" unless="gluegen.cpptasks.detected.os.2" if="isAndroidARMv7">
    <property name="os.and.arch" value="android-armv7" />
  </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.armv7,gluegen.cpptasks.detect.os.android.armv7" 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.suffix"     value="*lib" />
    <property name="os.and.arch" value="macosx-universal" />
  </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.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.suffix"     value="dll" />
  </target>

  <target name="gluegen.cpptasks.detect.os.2" depends="gluegen.cpptasks.detect.os.freebsd,gluegen.cpptasks.detect.os.hpux,gluegen.cpptasks.detect.os.linux,gluegen.cpptasks.detect.os.osx,gluegen.cpptasks.detect.os.solaris,gluegen.cpptasks.detect.os.unix,gluegen.cpptasks.detect.os.windows"  unless="gluegen.cpptasks.detected.os.2">
    <echo message="os and arch: ${os.and.arch}" />
  </target>

  <target name="gluegen.cpptasks.detect.os" depends="gluegen.properties.load.user,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="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>
    <property name="c.strip.args"     value="" /> 

  </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">
    <!-- 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.
      -->
    <target name="setup.java.home.dir.nonmacosx" unless="isOSX">
      <!-- java home dir is up one directory as java.home points to '<java-install-dir>/jre' -->
      <property name="java.home.dir" value="${java.home}/.." />
    </target>
    <target name="setup.java.home.dir.macosx" if="isOSX">
      <property name="java.home.dir" value="/System/Library/Frameworks/JavaVM.framework/Home" />
    </target>
    <target name="setup.java.home.dir" depends="setup.java.home.dir.nonmacosx,setup.java.home.dir.macosx">
    <property name="java.includes.dir" value="${java.home.dir}/include" />
    </target>

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

    <!-- UNIX compiler configuration -->

    <compiler id="compiler.cfg.freebsd" name="gcc">
      <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">
      <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>
    </compiler>

    <compiler id="compiler.cfg.linux.x86" name="gcc">
      <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>
    </compiler>

    <compiler id="compiler.cfg.linux.amd64" name="gcc">
      <compilerarg value="-fPIC"/>
      <compilerarg value="-m64"/>
      <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>
    </compiler>

    <compiler id="compiler.cfg.linux.armv7" name="gcc">
      <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>
    </compiler>

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

    <compiler id="compiler.cfg.freebsd" name="gcc">
      <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"> 
      <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"> 
      <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"> 
      <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="__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">
      <!-- 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" />
      <defineset>
        <define name="macosx" />
        <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">
      <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="0x0501"/> <!-- set windows version to >= Windows XP -->
        <define name="_WIN32_WINNT"   value="0x0501"/> <!-- set windows version to >= Windows XP -->
      </defineset>
    </compiler>

    <compiler id="compiler.cfg.win64.mingw" name="gcc">
      <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="0x0501"/> <!-- set windows version to >= Windows XP -->
        <define name="_WIN32_WINNT"   value="0x0501"/> <!-- set windows version to >= Windows XP -->
      </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">
    </linker>

    <linker id="linker.cfg.linux.x86" name="gcc">
        <linkerarg value="-m32"/>
    </linker>

    <linker id="linker.cfg.linux.amd64" name="gcc">
        <linkerarg value="-m64"/>
    </linker>

    <linker id="linker.cfg.linux.armv7" name="gcc">
    </linker>

    <compiler id="linker.cfg.android" name="gcc">
        <!-- 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">
      <linkerarg value="-m32"/>
    </linker>

    <linker id="linker.cfg.freebsd.amd64" name="gcc">
      <linkerarg value="-m64"/>
    </linker>

    <!-- SOLARIS linker configuration --> 

    <linker id="linker.cfg.solaris" name="gcc"> 
      <linkerarg value="-m32"/>
    </linker> 

    <linker id="linker.cfg.solaris.sparcv9" name="gcc"> 
      <linkerarg value="-xarch=v9a" /> 
    </linker> 

    <linker id="linker.cfg.solaris.amd64" name="gcc"> 
      <linkerarg value="-m64"/>
      <!-- linkerarg value="-xarch=amd64" / --> 
    </linker>

    <!-- MacOSX linker configuration -->

    <linker id="linker.cfg.macosx" name="gcc">
      <!-- Note: Apple doesn't seem to provide ppc binaries on Snow Leopard -->
      <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"/>
      <!-- Note: Apple doesn't seem to provide ppc64 binaries on Leopard -->
    </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"/>
    </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 -->
    </linker>

    <linker id="linker.cfg.win32.mingw" name="gcc" 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 -->
    </linker>

    <linker id="linker.cfg.win64.mingw" name="gcc" 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 -->
    </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.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}/jre/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" /> 
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/i386" />
    </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" /> 
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/amd64" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler.linux.armv7" if="isLinuxARMv7">
      <echo message="Linux.armv7" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux.armv7" /> 
      <property name="linker.cfg.id.base"            value="linker.cfg.linux.armv7" /> 
      <property name="java.lib.dir.platform"         value="${env.TARGET_JAVA_LIBS}" />
    </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" /> 
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/ia64" />
    </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.armv7" if="isLinux">
        <property name="java.includes.dir.platform" value="${java.includes.dir}/linux" />
    </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}/solaris" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/${solaris.cpu}" />
    </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" /> 
      <!-- Need to select either Java 10.6 Update 4's location or the old one -->
      <condition property="java.includes.dir.platform"
                 value="/System/Library/Frameworks/JavaVM.framework/Headers" 
                 else="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers">
                 <available file="/System/Library/Frameworks/JavaVM.framework/Headers/jni.h"/>
      </condition>
      <property name="java.lib.dir.platform"         value="/System/Library/Frameworks/JavaVM.framework/Libraries" />
    </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" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/i386" />
    </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" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/amd64" />
    </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}/freebsd" />
    </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}/hp-ux" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/PA_RISC2.0" />
    </target>

    <target name="gluegen.cpptasks.declare.compiler" depends="gluegen.cpptasks.declare.compiler.win32,gluegen.cpptasks.declare.compiler.linux,gluegen.cpptasks.declare.compiler.solaris,gluegen.cpptasks.declare.compiler.macosx,gluegen.cpptasks.declare.compiler.freebsd,gluegen.cpptasks.declare.compiler.hpux" />

    <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  -->
          <include name="**/*.jnilib"/> <!-- 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>
</project>