~ubuntu-branches/ubuntu/quantal/hawtjni/quantal

« back to all changes in this revision

Viewing changes to maven-hawtjni-plugin/src/main/resources/project-template/m4/osx-universal.m4

  • Committer: Bazaar Package Importer
  • Author(s): Miguel Landaeta
  • Date: 2010-08-05 19:40:25 UTC
  • Revision ID: james.westby@ubuntu.com-20100805194025-3004hn889accwu2i
Tags: upstream-1.0~+git0c502e20c4
ImportĀ upstreamĀ versionĀ 1.0~+git0c502e20c4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl ---------------------------------------------------------------------------
 
2
dnl  Copyright (C) 2009 Progress Software, Inc.
 
3
dnl  http://fusesource.com
 
4
dnl  
 
5
dnl  Licensed under the Apache License, Version 2.0 (the "License");
 
6
dnl  you may not use this file except in compliance with the License.
 
7
dnl  You may obtain a copy of the License at
 
8
dnl  
 
9
dnl     http://www.apache.org/licenses/LICENSE-2.0
 
10
dnl  
 
11
dnl  Unless required by applicable law or agreed to in writing, software
 
12
dnl  distributed under the License is distributed on an "AS IS" BASIS,
 
13
dnl  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
14
dnl  See the License for the specific language governing permissions and
 
15
dnl  limitations under the License.
 
16
dnl ---------------------------------------------------------------------------
 
17
dnl ---------------------------------------------------------------------------
 
18
dnl SYNOPSIS:
 
19
dnl
 
20
dnl   WITH_OSX_UNIVERSAL()
 
21
dnl
 
22
dnl   Allows creating universal binaries on the 
 
23
dnl
 
24
dnl   Adds the --with-universal=ARCH option.  This will will 
 
25
dnl   set sysroot option to /Developer/SDKs/MacOSX${OSX_VERSION}.sdk.
 
26
dnl   if OSX_VERSION is not defined, it will set it to 10.5 (the first
 
27
dnl   release where intel universal binaries were supported)
 
28
dnl
 
29
dnl   You must use the no-dependencies option when automake is initialized.  
 
30
dnl   for example: AM_INIT_AUTOMAKE([no-dependencies]) 
 
31
dnl
 
32
dnl      This macro calls:
 
33
dnl        AC_SUBST(CFLAGS)
 
34
dnl        AC_SUBST(LDFLAGS)
 
35
dnl        AC_SUBST(MAC_OSX_VERSION)
 
36
dnl
 
37
dnl AUTHOR: <a href="http://hiramchirino.com">Hiram Chrino</a>
 
38
dnl ---------------------------------------------------------------------------
 
39
 
 
40
AC_DEFUN([WITH_OSX_UNIVERSAL],
 
41
[
 
42
  AC_PREREQ([2.61])
 
43
  case "$host_os" in
 
44
        darwin*)
 
45
        AS_IF(test -z "$OSX_VERSION", [
 
46
                        OSX_VERSION="10.5"
 
47
                        AC_SUBST(OSX_VERSION)
 
48
                ])
 
49
                
 
50
    AC_MSG_CHECKING(whether to build universal binaries)
 
51
          AC_ARG_WITH([universal],
 
52
    [AS_HELP_STRING([--with-universal@<:@=ARCH@:>@],
 
53
                        [Build a universal binary.  Set to a space separated architecture list. Pick from: i386, x86_64, ppc, and/or ppc64. @<:@default="i386 x86_64 ppc"@:>@])],
 
54
    [ 
 
55
                        AS_IF(test "$withval" = "no", [
 
56
                                OSX_UNIVERSAL=""
 
57
                                AC_MSG_RESULT([no])
 
58
                        ], test "$withval" = "yes", [
 
59
                                OSX_UNIVERSAL="i386 x86_64 ppc"
 
60
                                AC_MSG_RESULT([yes, archs: $OSX_UNIVERSAL])
 
61
                        ],[
 
62
                                OSX_UNIVERSAL="$withval"
 
63
                                AC_MSG_RESULT([yes, archs: $OSX_UNIVERSAL])
 
64
                        ])
 
65
                ],[
 
66
                        OSX_UNIVERSAL=""
 
67
                        AC_MSG_RESULT([no])
 
68
                ])
 
69
        AS_IF(test -n "$OSX_UNIVERSAL", [
 
70
                        for i in $OSX_UNIVERSAL ; do
 
71
                                CFLAGS="-arch $i $CFLAGS" 
 
72
                                LDFLAGS="-arch $i $LDFLAGS"
 
73
                        done 
 
74
                        
 
75
                        CFLAGS="-isysroot /Developer/SDKs/MacOSX${OSX_VERSION}.sdk $CFLAGS" 
 
76
                        LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX${OSX_VERSION}.sdk $LDFLAGS"
 
77
                        AC_SUBST(CFLAGS)
 
78
                        AC_SUBST(LDFLAGS)
 
79
                ])
 
80
                ;;
 
81
        esac
 
82
])
 
83
 
 
84