ffi 1.0.9-x86-mingw32 → 1.0.12.pre-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ffi might be problematic. Click here for more details.

Files changed (218) hide show
  1. data/Rakefile +16 -16
  2. data/ext/ffi_c/AbstractMemory.c +376 -14
  3. data/ext/ffi_c/AbstractMemory.h +8 -0
  4. data/ext/ffi_c/ArrayType.c +28 -0
  5. data/ext/ffi_c/Buffer.c +109 -25
  6. data/ext/ffi_c/Call.c +16 -5
  7. data/ext/ffi_c/ClosurePool.c +21 -8
  8. data/ext/ffi_c/DataConverter.c +29 -0
  9. data/ext/ffi_c/DynamicLibrary.c +71 -2
  10. data/ext/ffi_c/Function.c +122 -11
  11. data/ext/ffi_c/Function.h +6 -0
  12. data/ext/ffi_c/FunctionInfo.c +21 -1
  13. data/ext/ffi_c/LastError.c +24 -0
  14. data/ext/ffi_c/MappedType.c +22 -0
  15. data/ext/ffi_c/MemoryPointer.c +19 -1
  16. data/ext/ffi_c/MemoryPointer.h +6 -0
  17. data/ext/ffi_c/MethodHandle.c +26 -11
  18. data/ext/ffi_c/Platform.c +17 -3
  19. data/ext/ffi_c/Pointer.c +106 -0
  20. data/ext/ffi_c/Pointer.h +6 -0
  21. data/ext/ffi_c/Struct.c +10 -4
  22. data/ext/ffi_c/Struct.h +2 -1
  23. data/ext/ffi_c/StructByReference.c +8 -0
  24. data/ext/ffi_c/StructByValue.c +8 -0
  25. data/ext/ffi_c/StructLayout.c +8 -2
  26. data/ext/ffi_c/Thread.c +131 -1
  27. data/ext/ffi_c/Thread.h +6 -0
  28. data/ext/ffi_c/Type.c +111 -17
  29. data/ext/ffi_c/Types.c +9 -2
  30. data/ext/ffi_c/Types.h +4 -0
  31. data/ext/ffi_c/Variadic.c +13 -4
  32. data/ext/ffi_c/compat.h +8 -0
  33. data/ext/ffi_c/endian.h +10 -1
  34. data/ext/ffi_c/extconf.rb +51 -35
  35. data/ext/ffi_c/ffi.c +5 -0
  36. data/ext/ffi_c/libffi.darwin.mk +15 -15
  37. data/ext/ffi_c/libffi.gnu.mk +3 -3
  38. data/ext/ffi_c/libffi.mk +4 -4
  39. data/ext/ffi_c/libffi.vc.mk +26 -0
  40. data/ext/ffi_c/libffi.vc64.mk +26 -0
  41. data/ext/ffi_c/libffi/ChangeLog +541 -0
  42. data/ext/ffi_c/libffi/ChangeLog.libffi +13 -87
  43. data/ext/ffi_c/libffi/LICENSE +3 -3
  44. data/ext/ffi_c/libffi/Makefile.am +41 -32
  45. data/ext/ffi_c/libffi/Makefile.in +95 -66
  46. data/ext/ffi_c/libffi/Makefile.vc +141 -0
  47. data/ext/ffi_c/libffi/Makefile.vc64 +141 -0
  48. data/ext/ffi_c/libffi/README +40 -4
  49. data/ext/ffi_c/libffi/aclocal.m4 +729 -7854
  50. data/ext/ffi_c/libffi/build-ios.sh +67 -0
  51. data/ext/ffi_c/libffi/compile +11 -10
  52. data/ext/ffi_c/libffi/config.guess +4 -1
  53. data/ext/ffi_c/libffi/config.sub +6 -3
  54. data/ext/ffi_c/libffi/configure +6264 -6354
  55. data/ext/ffi_c/libffi/configure.ac +155 -63
  56. data/ext/ffi_c/libffi/depcomp +81 -35
  57. data/ext/ffi_c/libffi/doc/libffi.info +78 -18
  58. data/ext/ffi_c/libffi/doc/libffi.texi +64 -5
  59. data/ext/ffi_c/libffi/doc/stamp-vti +4 -4
  60. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  61. data/ext/ffi_c/libffi/fficonfig.h.in +18 -0
  62. data/ext/ffi_c/libffi/fficonfig.hw +57 -0
  63. data/ext/ffi_c/libffi/include/Makefile.in +21 -3
  64. data/ext/ffi_c/libffi/include/ffi.h.in +42 -14
  65. data/ext/ffi_c/libffi/include/ffi.h.vc +427 -0
  66. data/ext/ffi_c/libffi/include/ffi.h.vc64 +427 -0
  67. data/ext/ffi_c/libffi/include/ffi_common.h +9 -5
  68. data/ext/ffi_c/libffi/install-sh +364 -167
  69. data/ext/ffi_c/libffi/ltmain.sh +2599 -1369
  70. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +176 -0
  71. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +195 -0
  72. data/ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4 +76 -0
  73. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +63 -0
  74. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +70 -0
  75. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +300 -0
  76. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +215 -0
  77. data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +79 -0
  78. data/ext/ffi_c/libffi/m4/libtool.m4 +1239 -768
  79. data/ext/ffi_c/libffi/m4/ltoptions.m4 +7 -6
  80. data/ext/ffi_c/libffi/m4/ltversion.m4 +6 -6
  81. data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +9 -3
  82. data/ext/ffi_c/libffi/man/Makefile.in +21 -3
  83. data/ext/ffi_c/libffi/mdate-sh +0 -0
  84. data/ext/ffi_c/libffi/missing +60 -44
  85. data/ext/ffi_c/libffi/msvcc.sh +197 -0
  86. data/ext/ffi_c/libffi/src/alpha/osf.S +39 -18
  87. data/ext/ffi_c/libffi/src/arm/ffi.c +443 -24
  88. data/ext/ffi_c/libffi/src/arm/ffitarget.h +17 -1
  89. data/ext/ffi_c/libffi/src/arm/gentramp.sh +118 -0
  90. data/ext/ffi_c/libffi/src/arm/sysv.S +206 -15
  91. data/ext/ffi_c/libffi/src/arm/trampoline.S +4450 -0
  92. data/ext/ffi_c/libffi/src/avr32/ffi.c +4 -2
  93. data/ext/ffi_c/libffi/src/avr32/ffitarget.h +2 -2
  94. data/ext/ffi_c/libffi/src/closures.c +17 -35
  95. data/ext/ffi_c/libffi/src/cris/ffi.c +1 -1
  96. data/ext/ffi_c/libffi/src/cris/ffitarget.h +2 -2
  97. data/ext/ffi_c/libffi/src/dlmalloc.c +66 -4
  98. data/ext/ffi_c/libffi/src/frv/ffitarget.h +2 -6
  99. data/ext/ffi_c/libffi/src/ia64/ffi.c +7 -5
  100. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +2 -2
  101. data/ext/ffi_c/libffi/src/java_raw_api.c +1 -1
  102. data/ext/ffi_c/libffi/src/m32r/ffitarget.h +2 -2
  103. data/ext/ffi_c/libffi/src/m68k/ffi.c +10 -0
  104. data/ext/ffi_c/libffi/src/m68k/ffitarget.h +2 -2
  105. data/ext/ffi_c/libffi/src/m68k/sysv.S +36 -0
  106. data/ext/ffi_c/libffi/src/mips/ffi.c +12 -5
  107. data/ext/ffi_c/libffi/src/mips/ffitarget.h +18 -11
  108. data/ext/ffi_c/libffi/src/mips/n32.S +4 -4
  109. data/ext/ffi_c/libffi/src/moxie/eabi.S +128 -0
  110. data/ext/ffi_c/libffi/src/moxie/ffi.c +276 -0
  111. data/ext/ffi_c/libffi/src/pa/ffi.c +7 -4
  112. data/ext/ffi_c/libffi/src/pa/ffitarget.h +6 -5
  113. data/ext/ffi_c/libffi/src/powerpc/aix.S +5 -1
  114. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +2 -0
  115. data/ext/ffi_c/libffi/src/powerpc/asm.h +1 -1
  116. data/ext/ffi_c/libffi/src/powerpc/darwin.S +215 -77
  117. data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +358 -100
  118. data/ext/ffi_c/libffi/src/powerpc/ffi.c +11 -5
  119. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +603 -172
  120. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +17 -4
  121. data/ext/ffi_c/libffi/src/prep_cif.c +16 -13
  122. data/ext/ffi_c/libffi/src/s390/ffitarget.h +4 -2
  123. data/ext/ffi_c/libffi/src/sh/ffitarget.h +2 -2
  124. data/ext/ffi_c/libffi/src/sh64/ffitarget.h +2 -2
  125. data/ext/ffi_c/libffi/src/sparc/ffi.c +55 -11
  126. data/ext/ffi_c/libffi/src/sparc/ffitarget.h +5 -3
  127. data/ext/ffi_c/libffi/src/x86/ffi.c +54 -92
  128. data/ext/ffi_c/libffi/src/x86/ffi64.c +17 -8
  129. data/ext/ffi_c/libffi/src/x86/ffitarget.h +15 -14
  130. data/ext/ffi_c/libffi/src/x86/sysv.S +40 -26
  131. data/ext/ffi_c/libffi/src/x86/unix64.S +4 -0
  132. data/ext/ffi_c/libffi/src/x86/win32.S +379 -191
  133. data/ext/ffi_c/libffi/src/x86/win64.S +15 -7
  134. data/ext/ffi_c/libffi/testsuite/Makefile.am +1 -1
  135. data/ext/ffi_c/libffi/testsuite/Makefile.in +22 -4
  136. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +350 -0
  137. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +1 -5
  138. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +1 -1
  139. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +1 -1
  140. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +1 -0
  141. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +1 -0
  142. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +3 -0
  143. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +2 -2
  144. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +3 -0
  145. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +1 -1
  146. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +1 -1
  147. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +1 -0
  148. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c +2 -3
  149. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +2 -1
  150. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +36 -0
  151. data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +17 -17
  152. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +1 -0
  153. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +1 -0
  154. data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +1 -1
  155. data/ext/ffi_c/libffi/testsuite/libffi.special/special.exp +1 -3
  156. data/ext/ffi_c/win32/stdint.h +199 -0
  157. data/gen/Rakefile +18 -2
  158. data/lib/1.8/ffi_c.so +0 -0
  159. data/lib/ffi.rb +13 -9
  160. data/lib/ffi/autopointer.rb +88 -26
  161. data/lib/ffi/enum.rb +42 -0
  162. data/lib/ffi/errno.rb +6 -1
  163. data/lib/ffi/ffi.rb +1 -0
  164. data/lib/ffi/io.rb +13 -2
  165. data/lib/ffi/library.rb +219 -24
  166. data/lib/ffi/memorypointer.rb +1 -33
  167. data/lib/ffi/platform.rb +21 -7
  168. data/lib/ffi/platform/arm-linux/types.conf +102 -0
  169. data/lib/ffi/platform/i386-freebsd/types.conf +152 -0
  170. data/lib/ffi/platform/i386-netbsd/types.conf +126 -0
  171. data/lib/ffi/platform/i486-gnu/types.conf +107 -0
  172. data/lib/ffi/platform/ia64-linux/types.conf +102 -0
  173. data/lib/ffi/platform/mips-linux/types.conf +102 -0
  174. data/lib/ffi/platform/mipsel-linux/types.conf +102 -0
  175. data/lib/ffi/platform/powerpc-linux/types.conf +100 -0
  176. data/lib/ffi/platform/s390-linux/types.conf +102 -0
  177. data/lib/ffi/platform/s390x-linux/types.conf +102 -0
  178. data/lib/ffi/platform/sparc-linux/types.conf +102 -0
  179. data/lib/ffi/platform/x86_64-freebsd/types.conf +126 -0
  180. data/lib/ffi/platform/x86_64-netbsd/types.conf +126 -0
  181. data/lib/ffi/pointer.rb +44 -0
  182. data/lib/ffi/struct.rb +2 -6
  183. data/lib/ffi/struct_layout_builder.rb +2 -1
  184. data/lib/ffi/tools/const_generator.rb +78 -26
  185. data/lib/ffi/tools/types_generator.rb +8 -1
  186. data/lib/ffi/types.rb +21 -1
  187. data/spec/ffi/async_callback_spec.rb +2 -2
  188. data/spec/ffi/bool_spec.rb +6 -6
  189. data/spec/ffi/buffer_spec.rb +23 -23
  190. data/spec/ffi/callback_spec.rb +101 -102
  191. data/spec/ffi/custom_type_spec.rb +20 -24
  192. data/spec/ffi/dup_spec.rb +7 -7
  193. data/spec/ffi/enum_spec.rb +127 -127
  194. data/spec/ffi/errno_spec.rb +2 -2
  195. data/spec/ffi/ffi_spec.rb +3 -3
  196. data/spec/ffi/function_spec.rb +10 -10
  197. data/spec/ffi/library_spec.rb +30 -12
  198. data/spec/ffi/managed_struct_spec.rb +4 -4
  199. data/spec/ffi/number_spec.rb +40 -40
  200. data/spec/ffi/pointer_spec.rb +21 -24
  201. data/spec/ffi/rbx/memory_pointer_spec.rb +17 -15
  202. data/spec/ffi/rbx/struct_spec.rb +2 -2
  203. data/spec/ffi/spec_helper.rb +1 -1
  204. data/spec/ffi/string_spec.rb +9 -9
  205. data/spec/ffi/strptr_spec.rb +3 -3
  206. data/spec/ffi/struct_callback_spec.rb +7 -7
  207. data/spec/ffi/struct_initialize_spec.rb +2 -2
  208. data/spec/ffi/struct_packed_spec.rb +6 -6
  209. data/spec/ffi/struct_spec.rb +94 -84
  210. data/spec/ffi/typedef_spec.rb +15 -4
  211. data/spec/ffi/union_spec.rb +3 -3
  212. data/spec/ffi/variadic_spec.rb +17 -14
  213. data/tasks/extension.rake +0 -1
  214. data/tasks/gem.rake +0 -1
  215. data/tasks/rdoc.rake +1 -1
  216. data/tasks/yard.rake +11 -0
  217. metadata +50 -11
  218. data/lib/1.9/ffi_c.so +0 -0
@@ -0,0 +1,70 @@
1
+ # ===========================================================================
2
+ # http://www.gnu.org/software/autoconf-archive/ax_configure_args.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_CONFIGURE_ARGS
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # Helper macro for AX_ENABLE_BUILDDIR.
12
+ #
13
+ # The traditional way of starting a subdir-configure is running the script
14
+ # with ${1+"$@"} but since autoconf 2.60 this is broken. Instead we have
15
+ # to rely on eval'ing $ac_configure_args however some old autoconf
16
+ # versions do not provide that. To ensure maximum portability of autoconf
17
+ # extension macros this helper can be AC_REQUIRE'd so that
18
+ # $ac_configure_args will alsways be present.
19
+ #
20
+ # Sadly, the traditional "exec $SHELL" of the enable_builddir macros is
21
+ # spoiled now and must be replaced by "eval + exit $?".
22
+ #
23
+ # Example:
24
+ #
25
+ # AC_DEFUN([AX_ENABLE_SUBDIR],[dnl
26
+ # AC_REQUIRE([AX_CONFIGURE_ARGS])dnl
27
+ # eval $SHELL $ac_configure_args || exit $?
28
+ # ...])
29
+ #
30
+ # LICENSE
31
+ #
32
+ # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
33
+ #
34
+ # This program is free software; you can redistribute it and/or modify it
35
+ # under the terms of the GNU General Public License as published by the
36
+ # Free Software Foundation; either version 3 of the License, or (at your
37
+ # option) any later version.
38
+ #
39
+ # This program is distributed in the hope that it will be useful, but
40
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
41
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
42
+ # Public License for more details.
43
+ #
44
+ # You should have received a copy of the GNU General Public License along
45
+ # with this program. If not, see <http://www.gnu.org/licenses/>.
46
+ #
47
+ # As a special exception, the respective Autoconf Macro's copyright owner
48
+ # gives unlimited permission to copy, distribute and modify the configure
49
+ # scripts that are the output of Autoconf when processing the Macro. You
50
+ # need not follow the terms of the GNU General Public License when using
51
+ # or distributing such scripts, even though portions of the text of the
52
+ # Macro appear in them. The GNU General Public License (GPL) does govern
53
+ # all other use of the material that constitutes the Autoconf Macro.
54
+ #
55
+ # This special exception to the GPL applies to versions of the Autoconf
56
+ # Macro released by the Autoconf Archive. When you make and distribute a
57
+ # modified version of the Autoconf Macro, you may extend this special
58
+ # exception to the GPL to apply to your modified version as well.
59
+
60
+ #serial 9
61
+
62
+ AC_DEFUN([AX_CONFIGURE_ARGS],[
63
+ # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args
64
+ if test "${ac_configure_args+set}" != "set" ; then
65
+ ac_configure_args=
66
+ for ac_arg in ${1+"[$]@"}; do
67
+ ac_configure_args="$ac_configure_args '$ac_arg'"
68
+ done
69
+ fi
70
+ ])
@@ -0,0 +1,300 @@
1
+ # ===========================================================================
2
+ # http://www.gnu.org/software/autoconf-archive/ax_enable_builddir.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_ENABLE_BUILDDIR [(dirstring-or-command [,Makefile.mk [,-all]])]
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # If the current configure was run within the srcdir then we move all
12
+ # configure-files into a subdir and let the configure steps continue
13
+ # there. We provide an option --disable-builddir to suppress the move into
14
+ # a separate builddir.
15
+ #
16
+ # Defaults:
17
+ #
18
+ # $1 = $host (overridden with $HOST)
19
+ # $2 = Makefile.mk
20
+ # $3 = -all
21
+ #
22
+ # This macro must be called before AM_INIT_AUTOMAKE. It creates a default
23
+ # toplevel srcdir Makefile from the information found in the created
24
+ # toplevel builddir Makefile. It just copies the variables and
25
+ # rule-targets, each extended with a default rule-execution that recurses
26
+ # into the build directory of the current "HOST". You can override the
27
+ # auto-dection through `config.guess` and build-time of course, as in
28
+ #
29
+ # make HOST=i386-mingw-cross
30
+ #
31
+ # which can of course set at configure time as well using
32
+ #
33
+ # configure --host=i386-mingw-cross
34
+ #
35
+ # After the default has been created, additional rules can be appended
36
+ # that will not just recurse into the subdirectories and only ever exist
37
+ # in the srcdir toplevel makefile - these parts are read from the $2 =
38
+ # Makefile.mk file
39
+ #
40
+ # The automatic rules are usually scanning the toplevel Makefile for lines
41
+ # like '#### $host |$builddir' to recognize the place where to recurse
42
+ # into. Usually, the last one is the only one used. However, almost all
43
+ # targets have an additional "*-all" rule which makes the script to
44
+ # recurse into _all_ variants of the current HOST (!!) setting. The "-all"
45
+ # suffix can be overriden for the macro as well.
46
+ #
47
+ # a special rule is only given for things like "dist" that will copy the
48
+ # tarball from the builddir to the sourcedir (or $(PUB)) for reason of
49
+ # convenience.
50
+ #
51
+ # LICENSE
52
+ #
53
+ # Copyright (c) 2009 Guido U. Draheim <guidod@gmx.de>
54
+ # Copyright (c) 2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk>
55
+ #
56
+ # This program is free software; you can redistribute it and/or modify it
57
+ # under the terms of the GNU General Public License as published by the
58
+ # Free Software Foundation; either version 3 of the License, or (at your
59
+ # option) any later version.
60
+ #
61
+ # This program is distributed in the hope that it will be useful, but
62
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
63
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
64
+ # Public License for more details.
65
+ #
66
+ # You should have received a copy of the GNU General Public License along
67
+ # with this program. If not, see <http://www.gnu.org/licenses/>.
68
+ #
69
+ # As a special exception, the respective Autoconf Macro's copyright owner
70
+ # gives unlimited permission to copy, distribute and modify the configure
71
+ # scripts that are the output of Autoconf when processing the Macro. You
72
+ # need not follow the terms of the GNU General Public License when using
73
+ # or distributing such scripts, even though portions of the text of the
74
+ # Macro appear in them. The GNU General Public License (GPL) does govern
75
+ # all other use of the material that constitutes the Autoconf Macro.
76
+ #
77
+ # This special exception to the GPL applies to versions of the Autoconf
78
+ # Macro released by the Autoconf Archive. When you make and distribute a
79
+ # modified version of the Autoconf Macro, you may extend this special
80
+ # exception to the GPL to apply to your modified version as well.
81
+
82
+ #serial 22
83
+
84
+ AC_DEFUN([AX_ENABLE_BUILDDIR],[
85
+ AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
86
+ AC_REQUIRE([AX_CONFIGURE_ARGS])[]dnl
87
+ AC_REQUIRE([AM_AUX_DIR_EXPAND])[]dnl
88
+ AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
89
+ AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl
90
+ AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl
91
+ AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl
92
+ SUB="."
93
+ AC_ARG_ENABLE([builddir], AS_HELP_STRING(
94
+ [--disable-builddir],[disable automatic build in subdir of sources])
95
+ ,[SUB="$enableval"], [SUB="auto"])
96
+ if test ".$ac_srcdir_defaulted" != ".no" ; then
97
+ if test ".$srcdir" = ".." ; then
98
+ if test -f config.status ; then
99
+ AC_MSG_NOTICE(toplevel srcdir already configured... skipping subdir build)
100
+ else
101
+ test ".$SUB" = "." && SUB="."
102
+ test ".$SUB" = ".no" && SUB="."
103
+ test ".$TARGET" = "." && TARGET="$target"
104
+ test ".$SUB" = ".auto" && SUB="m4_ifval([$1], [$1],[$TARGET])"
105
+ if test ".$SUB" != ".." ; then # we know where to go and
106
+ AS_MKDIR_P([$SUB])
107
+ echo __.$SUB.__ > $SUB/conftest.tmp
108
+ cd $SUB
109
+ if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then
110
+ rm conftest.tmp
111
+ AC_MSG_RESULT([continue configure in default builddir "./$SUB"])
112
+ else
113
+ AC_MSG_ERROR([could not change to default builddir "./$SUB"])
114
+ fi
115
+ srcdir=`echo "$SUB" |
116
+ sed -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'`
117
+ # going to restart from subdirectory location
118
+ test -f $srcdir/config.log && mv $srcdir/config.log .
119
+ test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h .
120
+ test -f $srcdir/conftest.log && mv $srcdir/conftest.log .
121
+ test -f $srcdir/$cache_file && mv $srcdir/$cache_file .
122
+ AC_MSG_RESULT(....exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"})
123
+ case "[$]0" in # restart
124
+ [/\\]*) eval $SHELL "'[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;;
125
+ *) eval $SHELL "'$srcdir/[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;;
126
+ esac ; exit $?
127
+ fi
128
+ fi
129
+ fi fi
130
+ test ".$SUB" = ".auto" && SUB="."
131
+ dnl ac_path_prog uses "set dummy" to override $@ which would defeat the "exec"
132
+ AC_PATH_PROG(SED,gsed sed, sed)
133
+ AUX="$am_aux_dir"
134
+ AS_VAR_POPDEF([SED])dnl
135
+ AS_VAR_POPDEF([AUX])dnl
136
+ AS_VAR_POPDEF([SUB])dnl
137
+ AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status ..............
138
+ AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl
139
+ AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl
140
+ AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl
141
+ AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl
142
+ AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl
143
+ pushdef([END],[Makefile.mk])dnl
144
+ pushdef([_ALL],[ifelse([$3],,[-all],[$3])])dnl
145
+ SRC="$ax_enable_builddir_srcdir"
146
+ if test ".$SUB" = ".." ; then
147
+ if test -f "$TOP/Makefile" ; then
148
+ AC_MSG_NOTICE([skipping TOP/Makefile - left untouched])
149
+ else
150
+ AC_MSG_NOTICE([skipping TOP/Makefile - not created])
151
+ fi
152
+ else
153
+ if test -f "$SRC/Makefile" ; then
154
+ a=`grep "^VERSION " "$SRC/Makefile"` ; b=`grep "^VERSION " Makefile`
155
+ test "$a" != "$b" && rm "$SRC/Makefile"
156
+ fi
157
+ if test -f "$SRC/Makefile" ; then
158
+ echo "$SRC/Makefile : $SRC/Makefile.in" > $tmp/conftemp.mk
159
+ echo " []@ echo 'REMOVED,,,' >\$[]@" >> $tmp/conftemp.mk
160
+ eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null"
161
+ if grep '^REMOVED,,,' "$SRC/Makefile" >/dev/null
162
+ then rm $SRC/Makefile ; fi
163
+ cp $tmp/conftemp.mk $SRC/makefiles.mk~ ## DEBUGGING
164
+ fi
165
+ if test ! -f "$SRC/Makefile" ; then
166
+ AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile])
167
+ x='`' ; cat >$tmp/conftemp.sed <<_EOF
168
+ /^\$/n
169
+ x
170
+ /^\$/bS
171
+ x
172
+ /\\\\\$/{H;d;}
173
+ {H;s/.*//;x;}
174
+ bM
175
+ :S
176
+ x
177
+ /\\\\\$/{h;d;}
178
+ {h;s/.*//;x;}
179
+ :M
180
+ s/\\(\\n\\) /\\1 /g
181
+ /^ /d
182
+ /^[[ ]]*[[\\#]]/d
183
+ /^VPATH *=/d
184
+ s/^srcdir *=.*/srcdir = ./
185
+ s/^top_srcdir *=.*/top_srcdir = ./
186
+ /[[:=]]/!d
187
+ /^\\./d
188
+ dnl Now handle rules (i.e. lines containing ":" but not " = ").
189
+ / = /b
190
+ / .= /b
191
+ /:/!b
192
+ s/:.*/:/
193
+ s/ / /g
194
+ s/ \\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/ \\1 \\1[]_ALL\\2/g
195
+ s/^\\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/\\1 \\1[]_ALL\\2/
196
+ s/ / /g
197
+ /^all all[]_ALL[[ :]]/i\\
198
+ all-configured : all[]_ALL
199
+ dnl dist-all exists... and would make for dist-all-all
200
+ s/ [[a-zA-Z0-9-]]*[]_ALL [[a-zA-Z0-9-]]*[]_ALL[]_ALL//g
201
+ /[]_ALL[]_ALL/d
202
+ a\\
203
+ @ HOST="\$(HOST)\" \\\\\\
204
+ ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
205
+ ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
206
+ ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
207
+ ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" = "0" ; then : \\\\\\
208
+ ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\
209
+ ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
210
+ ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\
211
+ ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
212
+ ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done
213
+ dnl special rule add-on: "dist" copies the tarball to $(PUB). (source tree)
214
+ /dist[]_ALL *:/a\\
215
+ @ HOST="\$(HOST)\" \\\\\\
216
+ ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
217
+ ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
218
+ ; found=$x echo \$\$BUILD | wc -w $x \\\\\\
219
+ ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\
220
+ ; if test "\$\$found" = "0" ; then : \\\\\\
221
+ ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\
222
+ ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
223
+ ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\
224
+ ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done
225
+ dnl special rule add-on: "dist-foo" copies all the archives to $(PUB). (source tree)
226
+ /dist-[[a-zA-Z0-9]]*[]_ALL *:/a\\
227
+ @ HOST="\$(HOST)\" \\\\\\
228
+ ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\
229
+ ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
230
+ ; found=$x echo \$\$BUILD | wc -w $x \\\\\\
231
+ ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\
232
+ ; if test "\$\$found" = "0" ; then : \\\\\\
233
+ ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\
234
+ ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
235
+ ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\
236
+ ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done
237
+ dnl special rule add-on: "distclean" removes all local builddirs completely
238
+ /distclean[]_ALL *:/a\\
239
+ @ HOST="\$(HOST)\" \\\\\\
240
+ ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
241
+ ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\
242
+ ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
243
+ ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\
244
+ ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
245
+ ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
246
+ ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\
247
+ ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
248
+ ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\
249
+ ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\
250
+ ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile
251
+ _EOF
252
+ cp "$tmp/conftemp.sed" "$SRC/makefile.sed~" ## DEBUGGING
253
+ $SED -f $tmp/conftemp.sed Makefile >$SRC/Makefile
254
+ if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then
255
+ AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])])
256
+ cat $SRC/END >>$SRC/Makefile
257
+ fi ; xxxx="####"
258
+ echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$SRC/Makefile
259
+ # sanity check
260
+ if grep '^; echo "MAKE ' $SRC/Makefile >/dev/null ; then
261
+ AC_MSG_NOTICE([buggy sed found - it deletes tab in "a" text parts])
262
+ $SED -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $SRC/Makefile \
263
+ >$SRC/Makefile~
264
+ (test -s $SRC/Makefile~ && mv $SRC/Makefile~ $SRC/Makefile) 2>/dev/null
265
+ fi
266
+ else
267
+ xxxx="\\#\\#\\#\\#"
268
+ # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed
269
+ echo "s!^$xxxx [[^|]]* | *$SUB *\$!$xxxx ...... $SUB!" >$tmp/conftemp.sed
270
+ $SED -f "$tmp/conftemp.sed" "$SRC/Makefile" >$tmp/mkfile.tmp
271
+ cp "$tmp/conftemp.sed" "$SRC/makefiles.sed~" ## DEBUGGING
272
+ cp "$tmp/mkfile.tmp" "$SRC/makefiles.out~" ## DEBUGGING
273
+ if cmp -s "$SRC/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then
274
+ AC_MSG_NOTICE([keeping TOP/Makefile from earlier configure])
275
+ rm "$tmp/mkfile.tmp"
276
+ else
277
+ AC_MSG_NOTICE([reusing TOP/Makefile from earlier configure])
278
+ mv "$tmp/mkfile.tmp" "$SRC/Makefile"
279
+ fi
280
+ fi
281
+ AC_MSG_NOTICE([build in $SUB (HOST=$ax_enable_builddir_host)])
282
+ xxxx="####"
283
+ echo "$xxxx" "$ax_enable_builddir_host" "|$SUB" >>$SRC/Makefile
284
+ fi
285
+ popdef([END])dnl
286
+ AS_VAR_POPDEF([SED])dnl
287
+ AS_VAR_POPDEF([AUX])dnl
288
+ AS_VAR_POPDEF([SRC])dnl
289
+ AS_VAR_POPDEF([TOP])dnl
290
+ AS_VAR_POPDEF([SUB])dnl
291
+ ],[dnl
292
+ ax_enable_builddir_srcdir="$srcdir" # $srcdir
293
+ ax_enable_builddir_host="$HOST" # $HOST / $host
294
+ ax_enable_builddir_version="$VERSION" # $VERSION
295
+ ax_enable_builddir_package="$PACKAGE" # $PACKAGE
296
+ ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX
297
+ ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED
298
+ ax_enable_builddir="$ax_enable_builddir" # $SUB
299
+ ])dnl
300
+ ])
@@ -0,0 +1,215 @@
1
+ # ===========================================================================
2
+ # http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_GCC_ARCHFLAG([PORTABLE?], [ACTION-SUCCESS], [ACTION-FAILURE])
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # This macro tries to guess the "native" arch corresponding to the target
12
+ # architecture for use with gcc's -march=arch or -mtune=arch flags. If
13
+ # found, the cache variable $ax_cv_gcc_archflag is set to this flag and
14
+ # ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is is set to
15
+ # "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is
16
+ # to add $ax_cv_gcc_archflag to the end of $CFLAGS.
17
+ #
18
+ # PORTABLE? should be either [yes] (default) or [no]. In the former case,
19
+ # the flag is set to -mtune (or equivalent) so that the architecture is
20
+ # only used for tuning, but the instruction set used is still portable. In
21
+ # the latter case, the flag is set to -march (or equivalent) so that
22
+ # architecture-specific instructions are enabled.
23
+ #
24
+ # The user can specify --with-gcc-arch=<arch> in order to override the
25
+ # macro's choice of architecture, or --without-gcc-arch to disable this.
26
+ #
27
+ # When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is
28
+ # called unless the user specified --with-gcc-arch manually.
29
+ #
30
+ # Requires macros: AX_CHECK_COMPILER_FLAGS, AX_GCC_X86_CPUID
31
+ #
32
+ # (The main emphasis here is on recent CPUs, on the principle that doing
33
+ # high-performance computing on old hardware is uncommon.)
34
+ #
35
+ # LICENSE
36
+ #
37
+ # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
38
+ # Copyright (c) 2008 Matteo Frigo
39
+ #
40
+ # This program is free software: you can redistribute it and/or modify it
41
+ # under the terms of the GNU General Public License as published by the
42
+ # Free Software Foundation, either version 3 of the License, or (at your
43
+ # option) any later version.
44
+ #
45
+ # This program is distributed in the hope that it will be useful, but
46
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
47
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
48
+ # Public License for more details.
49
+ #
50
+ # You should have received a copy of the GNU General Public License along
51
+ # with this program. If not, see <http://www.gnu.org/licenses/>.
52
+ #
53
+ # As a special exception, the respective Autoconf Macro's copyright owner
54
+ # gives unlimited permission to copy, distribute and modify the configure
55
+ # scripts that are the output of Autoconf when processing the Macro. You
56
+ # need not follow the terms of the GNU General Public License when using
57
+ # or distributing such scripts, even though portions of the text of the
58
+ # Macro appear in them. The GNU General Public License (GPL) does govern
59
+ # all other use of the material that constitutes the Autoconf Macro.
60
+ #
61
+ # This special exception to the GPL applies to versions of the Autoconf
62
+ # Macro released by the Autoconf Archive. When you make and distribute a
63
+ # modified version of the Autoconf Macro, you may extend this special
64
+ # exception to the GPL to apply to your modified version as well.
65
+
66
+ #serial 8
67
+
68
+ AC_DEFUN([AX_GCC_ARCHFLAG],
69
+ [AC_REQUIRE([AC_PROG_CC])
70
+ AC_REQUIRE([AC_CANONICAL_HOST])
71
+
72
+ AC_ARG_WITH(gcc-arch, [AS_HELP_STRING([--with-gcc-arch=<arch>], [use architecture <arch> for gcc -march/-mtune, instead of guessing])],
73
+ ax_gcc_arch=$withval, ax_gcc_arch=yes)
74
+
75
+ AC_MSG_CHECKING([for gcc architecture flag])
76
+ AC_MSG_RESULT([])
77
+ AC_CACHE_VAL(ax_cv_gcc_archflag,
78
+ [
79
+ ax_cv_gcc_archflag="unknown"
80
+
81
+ if test "$GCC" = yes; then
82
+
83
+ if test "x$ax_gcc_arch" = xyes; then
84
+ ax_gcc_arch=""
85
+ if test "$cross_compiling" = no; then
86
+ case $host_cpu in
87
+ i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones
88
+ AX_GCC_X86_CPUID(0)
89
+ AX_GCC_X86_CPUID(1)
90
+ case $ax_cv_gcc_x86_cpuid_0 in
91
+ *:756e6547:*:*) # Intel
92
+ case $ax_cv_gcc_x86_cpuid_1 in
93
+ *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;;
94
+ *5??:*:*:*) ax_gcc_arch=pentium ;;
95
+ *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
96
+ *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
97
+ *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
98
+ *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;;
99
+ *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
100
+ *6??:*:*:*) ax_gcc_arch=pentiumpro ;;
101
+ *f3[[347]]:*:*:*|*f4[1347]:*:*:*)
102
+ case $host_cpu in
103
+ x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;;
104
+ *) ax_gcc_arch="prescott pentium4 pentiumpro" ;;
105
+ esac ;;
106
+ *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";;
107
+ esac ;;
108
+ *:68747541:*:*) # AMD
109
+ case $ax_cv_gcc_x86_cpuid_1 in
110
+ *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;;
111
+ *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;;
112
+ *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;;
113
+ *60?:*:*:*) ax_gcc_arch=k7 ;;
114
+ *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;;
115
+ *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;;
116
+ *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;;
117
+ *6[[68a]]?:*:*:*)
118
+ AX_GCC_X86_CPUID(0x80000006) # L2 cache size
119
+ case $ax_cv_gcc_x86_cpuid_0x80000006 in
120
+ *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256
121
+ ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;;
122
+ *) ax_gcc_arch="athlon-4 athlon k7" ;;
123
+ esac ;;
124
+ *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;;
125
+ *f5?:*:*:*) ax_gcc_arch="opteron k8" ;;
126
+ *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;;
127
+ *f??:*:*:*) ax_gcc_arch="k8" ;;
128
+ esac ;;
129
+ *:746e6543:*:*) # IDT
130
+ case $ax_cv_gcc_x86_cpuid_1 in
131
+ *54?:*:*:*) ax_gcc_arch=winchip-c6 ;;
132
+ *58?:*:*:*) ax_gcc_arch=winchip2 ;;
133
+ *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;;
134
+ *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;;
135
+ esac ;;
136
+ esac
137
+ if test x"$ax_gcc_arch" = x; then # fallback
138
+ case $host_cpu in
139
+ i586*) ax_gcc_arch=pentium ;;
140
+ i686*) ax_gcc_arch=pentiumpro ;;
141
+ esac
142
+ fi
143
+ ;;
144
+
145
+ sparc*)
146
+ AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/])
147
+ cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
148
+ cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters`
149
+ case $cputype in
150
+ *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;;
151
+ *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;;
152
+ *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;;
153
+ *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;;
154
+ *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;;
155
+ *cypress*) ax_gcc_arch=cypress ;;
156
+ esac ;;
157
+
158
+ alphaev5) ax_gcc_arch=ev5 ;;
159
+ alphaev56) ax_gcc_arch=ev56 ;;
160
+ alphapca56) ax_gcc_arch="pca56 ev56" ;;
161
+ alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;;
162
+ alphaev6) ax_gcc_arch=ev6 ;;
163
+ alphaev67) ax_gcc_arch=ev67 ;;
164
+ alphaev68) ax_gcc_arch="ev68 ev67" ;;
165
+ alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;;
166
+ alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;;
167
+ alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;;
168
+
169
+ powerpc*)
170
+ cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null`
171
+ cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'`
172
+ case $cputype in
173
+ *750*) ax_gcc_arch="750 G3" ;;
174
+ *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;;
175
+ *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;;
176
+ *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;;
177
+ *970*) ax_gcc_arch="970 G5 power4";;
178
+ *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";;
179
+ *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";;
180
+ 603ev|8240) ax_gcc_arch="$cputype 603e 603";;
181
+ *) ax_gcc_arch=$cputype ;;
182
+ esac
183
+ ax_gcc_arch="$ax_gcc_arch powerpc"
184
+ ;;
185
+ esac
186
+ fi # not cross-compiling
187
+ fi # guess arch
188
+
189
+ if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then
190
+ for arch in $ax_gcc_arch; do
191
+ if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
192
+ flags="-mtune=$arch"
193
+ # -mcpu=$arch and m$arch generate nonportable code on every arch except
194
+ # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr.
195
+ case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac
196
+ else
197
+ flags="-march=$arch -mcpu=$arch -m$arch"
198
+ fi
199
+ for flag in $flags; do
200
+ AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break])
201
+ done
202
+ test "x$ax_cv_gcc_archflag" = xunknown || break
203
+ done
204
+ fi
205
+
206
+ fi # $GCC=yes
207
+ ])
208
+ AC_MSG_CHECKING([for gcc architecture flag])
209
+ AC_MSG_RESULT($ax_cv_gcc_archflag)
210
+ if test "x$ax_cv_gcc_archflag" = xunknown; then
211
+ m4_default([$3],:)
212
+ else
213
+ m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"])
214
+ fi
215
+ ])