Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

530 lines
19KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_create_target_h.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CREATE_TARGET_H [(HEADER-FILE [,PREFIX)]
  8. #
  9. # DESCRIPTION
  10. #
  11. # Create the header-file and let it contain '#defines' for the target
  12. # platform. This macro is used for libraries that have platform-specific
  13. # quirks. Instead of inventing a target-specific target.h.in files, just
  14. # let it create a header file from the definitions of AC_CANONICAL_SYSTEM
  15. # and put only ifdef's in the installed header-files.
  16. #
  17. # if the HEADER-FILE is absent, [target.h] is used.
  18. # if the PREFIX is absent, [TARGET] is used.
  19. # the prefix can be the packagename. (y:a-z-:A-Z_:)
  20. #
  21. # The defines look like...
  22. #
  23. # #ifndef TARGET_CPU_M68K
  24. # #define TARGET_CPU_M68K "m68k"
  25. # #endif
  26. #
  27. # #ifndef TARGET_OS_LINUX
  28. # #define TARGET_OS_LINUX "linux-gnu"
  29. # #endif
  30. #
  31. # #ifndef TARGET_OS_TYPE /* the string itself */
  32. # #define TARGET_OS_TYPE "linux-gnu"
  33. # #endif
  34. #
  35. # Detail: in the case of hppa1.1, the three idents "hppa1_1" "hppa1" and
  36. # "hppa" are derived, for an m68k it just two, "m68k" and "m".
  37. #
  38. # The CREATE_TARGET_H__ variant is almost the same function, but
  39. # everything is lowercased instead of uppercased, and there is a "__" in
  40. # front of each prefix, so it looks like...
  41. #
  42. # #ifndef __target_os_linux
  43. # #define __target_os_linux "linux-gnulibc2"
  44. # #endif
  45. #
  46. # #ifndef __target_os__ /* the string itself */
  47. # #define __target_os__ "linux-gnulibc2"
  48. # #endif
  49. #
  50. # #ifndef __target_cpu_i586
  51. # #define __target_cpu_i586 "i586"
  52. # #endif
  53. #
  54. # #ifndef __target_arch_i386
  55. # #define __target_arch_i386 "i386"
  56. # #endif
  57. #
  58. # #ifndef __target_arch__ /* cpu family arch */
  59. # #define __target_arch__ "i386"
  60. # #endif
  61. #
  62. # Other differences: the default string-define is "__" instead of "_TYPE".
  63. #
  64. # Personally, I prefer the second variant (which had been the first in the
  65. # devprocess of this file but I assume people will often fallback to the
  66. # primary variant presented herein).
  67. #
  68. # NOTE: CREATE_TARGET_H does also fill HOST_OS-defines Functionality has
  69. # been split over functions called CREATE_TARGET_H_UPPER,
  70. # CREATE_TARGET_H_LOWER, CREATE_TARGET_HOST_UPPER, and
  71. # CREATE_TARGET_HOST_LOWER.
  72. #
  73. # CREATE_TARGET_H uses CREATE_TARGET_H_UPPER CREATE_TARGET_HOST_UPPER
  74. # CREATE_TARGET_H_ uses CREATE_TARGET_H_LOWER CREATE_TARGET_HOST_LOWER
  75. #
  76. # There is now a CREATE_PREFIX_TARGET_H in this file as a shorthand for
  77. # PREFIX_CONFIG_H from a target.h file, however w/o the target.h ever
  78. # created (the prefix is a bit different, since we add an extra -target-
  79. # and -host-).
  80. #
  81. # LICENSE
  82. #
  83. # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
  84. #
  85. # This program is free software; you can redistribute it and/or modify it
  86. # under the terms of the GNU General Public License as published by the
  87. # Free Software Foundation; either version 3 of the License, or (at your
  88. # option) any later version.
  89. #
  90. # This program is distributed in the hope that it will be useful, but
  91. # WITHOUT ANY WARRANTY; without even the implied warranty of
  92. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  93. # Public License for more details.
  94. #
  95. # You should have received a copy of the GNU General Public License along
  96. # with this program. If not, see <https://www.gnu.org/licenses/>.
  97. #
  98. # As a special exception, the respective Autoconf Macro's copyright owner
  99. # gives unlimited permission to copy, distribute and modify the configure
  100. # scripts that are the output of Autoconf when processing the Macro. You
  101. # need not follow the terms of the GNU General Public License when using
  102. # or distributing such scripts, even though portions of the text of the
  103. # Macro appear in them. The GNU General Public License (GPL) does govern
  104. # all other use of the material that constitutes the Autoconf Macro.
  105. #
  106. # This special exception to the GPL applies to versions of the Autoconf
  107. # Macro released by the Autoconf Archive. When you make and distribute a
  108. # modified version of the Autoconf Macro, you may extend this special
  109. # exception to the GPL to apply to your modified version as well.
  110. #serial 6
  111. AU_ALIAS([AC_CREATE_TARGET_H], [AX_CREATE_TARGET_H])
  112. AC_DEFUN([AX_CREATE_TARGET_H],
  113. [AC_REQUIRE([AC_CANONICAL_CPU_ARCH])
  114. AX_CREATE_TARGET_H_UPPER($1,$2)
  115. AX_CREATE_TARGET_HOST_UPPER($1,$2)
  116. ])
  117. AC_DEFUN([AC_CREATE_TARGET_OS_H],
  118. [AC_REQUIRE([AC_CANONICAL_CPU_ARCH])
  119. AX_CREATE_TARGET_H_LOWER($1,$2)
  120. AX_CREATE_TARGET_HOST_LOWER($1,$2)
  121. ])
  122. AC_DEFUN([AX_CREATE_TARGET_H__],
  123. [AC_REQUIRE([AC_CANONICAL_CPU_ARCH])
  124. AX_CREATE_TARGET_H_LOWER($1,$2)
  125. AX_CREATE_TARGET_HOST_LOWER($1,$2)
  126. ])
  127. dnl [(OUT-FILE [, PREFIX])] defaults: PREFIX=$PACKAGE OUTFILE=$PREFIX-target.h
  128. AC_DEFUN([AC_CREATE_PREFIX_TARGET_H],[dnl
  129. ac_prefix_conf_PKG=`echo ifelse($2, , $PACKAGE, $2)`
  130. ac_prefix_conf_OUT=`echo ifelse($1, , $ac_prefix_conf_PKG-target.h, $1)`
  131. ac_prefix_conf_PRE=`echo $ac_prefix_conf_PKG-target | sed -e 'y:abcdefghijklmnopqrstuvwxyz-:ABCDEFGHIJKLMNOPQRSTUVWXYZ_:'`
  132. AX_CREATE_TARGET_H_UPPER($ac_prefix_conf_PRE,$ac_perfix_conf_OUT)
  133. ac_prefix_conf_PRE=`echo __$ac_prefix_conf_PKG-host | sed -e 'y:abcdefghijklmnopqrstuvwxyz-:ABCDEFGHIJKLMNOPQRSTUVWXYZ_:'`
  134. AX_CREATE_TARGET_HOST_UPPER($ac_prefix_conf_PRE,$ac_perfix_conf_OUT)
  135. ])
  136. dnl [(OUT-FILE[, PREFIX])] defaults: PREFIX=$PACKAGE OUTFILE=$PREFIX-target.h
  137. AC_DEFUN([AC_CREATE_PREFIX_TARGET_H_],[dnl
  138. ac_prefix_conf_PKG=`echo ifelse($2, , $PACKAGE, $2)`
  139. ac_prefix_conf_OUT=`echo ifelse($1, , $ac_prefix_conf_PKG-target.h, $1)`
  140. ac_prefix_conf_PRE=`echo __$ac_prefix_conf_PKG-target | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ-:abcdefghijklmnopqrstuvwxyz_:'`
  141. AX_CREATE_TARGET_H_LOWER($ac_prefix_conf_PRE,$ac_perfix_conf_OUT)
  142. ac_prefix_conf_PRE=`echo __$ac_prefix_conf_PKG-host | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ-:abcdefghijklmnopqrstuvwxyz_:'`
  143. AX_CREATE_TARGET_HOST_LOWER($ac_prefix_conf_PRE,$ac_perfix_conf_OUT)
  144. ])
  145. AC_DEFUN([AX_CREATE_TARGET_H_FILE],[dnl
  146. ac_need_target_h_file_new=true
  147. ])
  148. AC_DEFUN([AX_CREATE_TARGET_H_UPPER],
  149. [AC_REQUIRE([AC_CANONICAL_CPU_ARCH])
  150. AC_REQUIRE([AX_CREATE_TARGET_H_FILE])
  151. changequote({, })dnl
  152. ac_need_target_h_file=`echo ifelse($1, , target.h, $1)`
  153. ac_need_target_h_prefix=`echo ifelse($2, , target, $2) | sed -e 'y:abcdefghijklmnopqrstuvwxyz-:ABCDEFGHIJKLMNOPQRSTUVWXYZ_:' -e 's:[^A-Z0-9_]::g'`
  154. #
  155. target_os0=`echo "$target_os" | sed -e 'y:abcdefghijklmnopqrstuvwxyz.-:ABCDEFGHIJKLMNOPQRSTUVWXYZ__:' -e 's:[^A-Z0-9_]::g'`
  156. target_os1=`echo "$target_os0" | sed -e 's:\([^0-9]*\).*:\1:' `
  157. target_os2=`echo "$target_os0" | sed -e 's:\([^_]*\).*:\1:' `
  158. target_os3=`echo "$target_os2" | sed -e 's:\([^0-9]*\).*:\1:' `
  159. #
  160. target_cpu0=`echo "$target_cpu" | sed -e 'y:abcdefghijklmnopqrstuvwxyz.-:ABCDEFGHIJKLMNOPQRSTUVWXYZ__:' -e 's:[^A-Z0-9_]::g'`
  161. target_cpu1=`echo "$target_cpu0" | sed -e 's:\([^0-9]*\).*:\1:' `
  162. target_cpu2=`echo "$target_cpu0" | sed -e 's:\([^_]*\).*:\1:' `
  163. target_cpu3=`echo "$target_cpu2" | sed -e 's:\([^0-9]*\).*:\1:' `
  164. #
  165. target_cpu_arch0=`echo "$target_cpu_arch" | sed -e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:'`
  166. #
  167. changequote([, ])dnl
  168. #
  169. if $ac_need_target_h_file_new ; then
  170. AC_MSG_RESULT(creating $ac_need_target_h_file - canonical system defines)
  171. echo /'*' automatically generated by $PACKAGE configure '*'/ >$ac_need_target_h_file
  172. echo /'*' on `date` '*'/ >>$ac_need_target_h_file
  173. ac_need_target_h_file_new=false
  174. fi
  175. echo /'*' target uppercase defines '*'/ >>$ac_need_target_h_file
  176. dnl
  177. old1=""
  178. old2=""
  179. for i in $target_os0 $target_os1 $target_os2 $target_os3 "TYPE"
  180. do
  181. if test "$old1" != "$i"; then
  182. if test "$old2" != "$i"; then
  183. echo " " >>$ac_need_target_h_file
  184. echo "#ifndef "$ac_need_target_h_prefix"_OS_"$i >>$ac_need_target_h_file
  185. echo "#define "$ac_need_target_h_prefix"_OS_"$i '"'"$target_os"'"' >>$ac_need_target_h_file
  186. echo "#endif" >>$ac_need_target_h_file
  187. fi
  188. fi
  189. old2="$old1"
  190. old1="$i"
  191. done
  192. #
  193. old1=""
  194. old2=""
  195. for i in $target_cpu0 $target_cpu1 $target_cpu2 $target_cpu3 "TYPE"
  196. do
  197. if test "$old1" != "$i"; then
  198. if test "$old2" != "$i"; then
  199. echo " " >>$ac_need_target_h_file
  200. echo "#ifndef "$ac_need_target_h_prefix"_CPU_"$i >>$ac_need_target_h_file
  201. echo "#define "$ac_need_target_h_prefix"_CPU_"$i '"'"$target_cpu"'"' >>$ac_need_target_h_file
  202. echo "#endif" >>$ac_need_target_h_file
  203. fi
  204. fi
  205. old2="$old1"
  206. old1="$i"
  207. done
  208. #
  209. old1=""
  210. old2=""
  211. for i in $target_cpu_arch0 "TYPE"
  212. do
  213. if test "$old1" != "$i"; then
  214. if test "$old2" != "$i"; then
  215. echo " " >>$ac_need_target_h_file
  216. echo "#ifndef "$ac_need_target_h_prefix"_ARCH_"$i >>$ac_need_target_h_file
  217. echo "#define "$ac_need_target_h_prefix"_ARCH_"$i '"'"$target_cpu_arch"'"' >>$ac_need_target_h_file
  218. echo "#endif" >>$ac_need_target_h_file
  219. fi
  220. fi
  221. old2="$old1"
  222. old1="$i"
  223. done
  224. ])
  225. dnl
  226. dnl ... the lowercase variant ...
  227. dnl
  228. AC_DEFUN([AX_CREATE_TARGET_H_LOWER],
  229. [AC_REQUIRE([AC_CANONICAL_CPU_ARCH])
  230. AC_REQUIRE([AX_CREATE_TARGET_H_FILE])
  231. changequote({, })dnl
  232. ac_need_target_h_file=`echo ifelse($1, , target-os.h, $1)`
  233. ac_need_target_h_prefix=`echo ifelse($2, , target, $2) | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ-:abcdefghijklmnopqrstuvwxyz_:' -e 's:[^a-z0-9_]::g'`
  234. #
  235. target_os0=`echo "$target_os" | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ.-:abcdefghijklmnopqrstuvwxyz__:' -e 's:[^a-z0-9_]::g'`
  236. target_os1=`echo "$target_os0" | sed -e 's:\([^0-9]*\).*:\1:' `
  237. target_os2=`echo "$target_os0" | sed -e 's:\([^_]*\).*:\1:' `
  238. target_os3=`echo "$target_os2" | sed -e 's:\([^0-9]*\).*:\1:' `
  239. #
  240. target_cpu0=`echo "$target_cpu" | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ.-:abcdefghijklmnopqrstuvwxyz__:' -e 's:[^a-z0-9_]::g'`
  241. target_cpu1=`echo "$target_cpu0" | sed -e 's:\([^0-9]*\).*:\1:' `
  242. target_cpu2=`echo "$target_cpu0" | sed -e 's:\([^_]*\).*:\1:' `
  243. target_cpu3=`echo "$target_cpu2" | sed -e 's:\([^0-9]*\).*:\1:' `
  244. #
  245. target_cpu_arch0=`echo "$target_cpu_arch" | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ:abcdefghijklmnopqrstuvwxyz:'`
  246. #
  247. changequote([, ])dnl
  248. #
  249. if $ac_need_target_h_file_new ; then
  250. AC_MSG_RESULT(creating $ac_need_target_h_file - canonical system defines)
  251. echo /'*' automatically generated by $PACKAGE configure '*'/ >$ac_need_target_h_file
  252. echo /'*' on `date` '*'/ >>$ac_need_target_h_file
  253. ac_need_target_h_file_new=false
  254. fi
  255. echo /'*' target lowercase defines '*'/ >>$ac_need_target_h_file
  256. dnl
  257. old1=""
  258. old2=""
  259. for i in $target_os0 $target_os1 $target_os2 $target_os3 "_";
  260. do
  261. if test "$old1" != "$i"; then
  262. if test "$old2" != "$i"; then
  263. echo " " >>$ac_need_target_h_file
  264. echo "#ifndef __"$ac_need_target_h_prefix"_os_"$i >>$ac_need_target_h_file
  265. echo "#define __"$ac_need_target_h_prefix"_os_"$i '"'"$target_os"'"' >>$ac_need_target_h_file
  266. echo "#endif" >>$ac_need_target_h_file
  267. fi
  268. fi
  269. old2="$old1"
  270. old1="$i"
  271. done
  272. #
  273. old1=""
  274. old2=""
  275. for i in $target_cpu0 $target_cpu1 $target_cpu2 $target_cpu3 "_"
  276. do
  277. if test "$old1" != "$i"; then
  278. if test "$old2" != "$i"; then
  279. echo " " >>$ac_need_target_h_file
  280. echo "#ifndef __"$ac_need_target_h_prefix"_cpu_"$i >>$ac_need_target_h_file
  281. echo "#define __"$ac_need_target_h_prefix"_cpu_"$i '"'"$target_cpu"'"' >>$ac_need_target_h_file
  282. echo "#endif" >>$ac_need_target_h_file
  283. fi
  284. fi
  285. old2="$old1"
  286. old1="$i"
  287. done
  288. #
  289. old1=""
  290. old2=""
  291. for i in $target_cpu_arch0 "_"
  292. do
  293. if test "$old1" != "$i"; then
  294. if test "$old2" != "$i"; then
  295. echo " " >>$ac_need_target_h_file
  296. echo "#ifndef __"$ac_need_target_h_prefix"_arch_"$i >>$ac_need_target_h_file
  297. echo "#define __"$ac_need_target_h_prefix"_arch_"$i '"'"$target_cpu_arch"'"' >>$ac_need_target_h_file
  298. echo "#endif" >>$ac_need_target_h_file
  299. fi
  300. fi
  301. old2="$old1"
  302. old1="$i"
  303. done
  304. ])
  305. dnl -------------------------------------------------------------------
  306. dnl
  307. dnl ... the uppercase variant for the host ...
  308. dnl
  309. AC_DEFUN([AX_CREATE_TARGET_HOST_UPPER],
  310. [AC_REQUIRE([AC_CANONICAL_CPU_ARCH])
  311. AC_REQUIRE([AX_CREATE_TARGET_H_FILE])
  312. changequote({, })dnl
  313. ac_need_target_h_file=`echo ifelse($1, , target.h, $1)`
  314. ac_need_target_h_prefix=`echo ifelse($2, , host, $2) | sed -e 'y:abcdefghijklmnopqrstuvwxyz-:ABCDEFGHIJKLMNOPQRSTUVWXYZ_:' -e 's:[^A-Z0-9_]::g'`
  315. #
  316. host_os0=`echo "$host_os" | sed -e 'y:abcdefghijklmnopqrstuvwxyz.-:ABCDEFGHIJKLMNOPQRSTUVWXYZ__:' -e 's:[^A-Z0-9_]::g'`
  317. host_os1=`echo "$host_os0" | sed -e 's:\([^0-9]*\).*:\1:' `
  318. host_os2=`echo "$host_os0" | sed -e 's:\([^_]*\).*:\1:' `
  319. host_os3=`echo "$host_os2" | sed -e 's:\([^0-9]*\).*:\1:' `
  320. #
  321. host_cpu0=`echo "$host_cpu" | sed -e 'y:abcdefghijklmnopqrstuvwxyz.-:ABCDEFGHIJKLMNOPQRSTUVWXYZ__:' -e 's:[^A-Z0-9]::g'`
  322. host_cpu1=`echo "$host_cpu0" | sed -e 's:\([^0-9]*\).*:\1:' `
  323. host_cpu2=`echo "$host_cpu0" | sed -e 's:\([^_]*\).*:\1:' `
  324. host_cpu3=`echo "$host_cpu2" | sed -e 's:\([^0-9]*\).*:\1:' `
  325. #
  326. host_cpu_arch0=`echo "$host_cpu_arch" | sed -e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:'`
  327. #
  328. changequote([, ])dnl
  329. #
  330. if $ac_need_target_h_file_new ; then
  331. AC_MSG_RESULT(creating $ac_need_target_h_file - canonical system defines)
  332. echo /'*' automatically generated by $PACKAGE configure '*'/ >$ac_need_target_h_file
  333. echo /'*' on `date` '*'/ >>$ac_need_target_h_file
  334. ac_need_target_h_file_new=false
  335. fi
  336. echo /'*' host uppercase defines '*'/ >>$ac_need_target_h_file
  337. dnl
  338. old1=""
  339. old2=""
  340. for i in $host_os0 $host_os1 $host_os2 $host_os3 "TYPE"
  341. do
  342. if test "$old1" != "$i"; then
  343. if test "$old2" != "$i"; then
  344. echo " " >>$ac_need_target_h_file
  345. echo "#ifndef "$ac_need_target_h_prefix"_OS_"$i >>$ac_need_target_h_file
  346. echo "#define "$ac_need_target_h_prefix"_OS_"$i '"'"$host_os"'"' >>$ac_need_target_h_file
  347. echo "#endif" >>$ac_need_target_h_file
  348. fi
  349. fi
  350. old2="$old1"
  351. old1="$i"
  352. done
  353. #
  354. old1=""
  355. old2=""
  356. for i in $host_cpu0 $host_cpu1 $host_cpu2 $host_cpu3 "TYPE"
  357. do
  358. if test "$old1" != "$i"; then
  359. if test "$old2" != "$i"; then
  360. echo " " >>$ac_need_target_h_file
  361. echo "#ifndef "$ac_need_target_h_prefix"_CPU_"$i >>$ac_need_target_h_file
  362. echo "#define "$ac_need_target_h_prefix"_CPU_"$i '"'"$host_cpu"'"' >>$ac_need_target_h_file
  363. echo "#endif" >>$ac_need_target_h_file
  364. fi
  365. fi
  366. old2="$old1"
  367. old1="$i"
  368. done
  369. #
  370. old1=""
  371. old2=""
  372. for i in $host_cpu_arch0 "TYPE"
  373. do
  374. if test "$old1" != "$i"; then
  375. if test "$old2" != "$i"; then
  376. echo " " >>$ac_need_target_h_file
  377. echo "#ifndef "$ac_need_target_h_prefix"_ARCH_"$i >>$ac_need_target_h_file
  378. echo "#define "$ac_need_target_h_prefix"_ARCH_"$i '"'"$host_cpu_arch"'"' >>$ac_need_target_h_file
  379. echo "#endif" >>$ac_need_target_h_file
  380. fi
  381. fi
  382. old2="$old1"
  383. old1="$i"
  384. done
  385. ])
  386. dnl ---------------------------------------------------------------------
  387. dnl
  388. dnl ... the lowercase variant for the host ...
  389. dnl
  390. AC_DEFUN([AX_CREATE_TARGET_HOST_LOWER],
  391. [AC_REQUIRE([AC_CANONICAL_CPU_ARCH])
  392. AC_REQUIRE([AX_CREATE_TARGET_H_FILE])
  393. changequote({, })dnl
  394. ac_need_target_h_file=`echo ifelse($1, , target.h, $1)`
  395. ac_need_target_h_prefix=`echo ifelse($2, , host, $2) | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ-:abcdefghijklmnopqrstuvwxyz_:' -e 's:[^a-z0-9_]::g'`
  396. #
  397. host_os0=`echo "$host_os" | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ.-:abcdefghijklmnopqrstuvwxyz__:' -e 's:[^a-z0-9_]::g'`
  398. host_os1=`echo "$host_os0" | sed -e 's:\([^0-9]*\).*:\1:' `
  399. host_os2=`echo "$host_os0" | sed -e 's:\([^_]*\).*:\1:' `
  400. host_os3=`echo "$host_os2" | sed -e 's:\([^0-9]*\).*:\1:' `
  401. #
  402. host_cpu0=`echo "$host_cpu" | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ.-:abcdefghijklmnopqrstuvwxyz__:' -e 's:[^a-z0-9_]::g'`
  403. host_cpu1=`echo "$host_cpu0" | sed -e 's:\([^0-9]*\).*:\1:' `
  404. host_cpu2=`echo "$host_cpu0" | sed -e 's:\([^_]*\).*:\1:' `
  405. host_cpu3=`echo "$host_cpu2" | sed -e 's:\([^0-9]*\).*:\1:' `
  406. #
  407. host_cpu_arch0=`echo "$host_cpu_arch" | sed -e 'y:ABCDEFGHIJKLMNOPQRSTUVWXYZ:abcdefghijklmnopqrstuvwxyz:'`
  408. #
  409. changequote([, ])dnl
  410. #
  411. if $ac_need_target_h_file_new ; then
  412. AC_MSG_RESULT(creating $ac_need_target_h_file - canonical system defines)
  413. echo /'*' automatically generated by $PACKAGE configure '*'/ >$ac_need_target_h_file
  414. echo /'*' on `date` '*'/ >>$ac_need_target_h_file
  415. ac_need_target_h_file_new=false
  416. fi
  417. echo /'*' host lowercase defines '*'/ >>$ac_need_target_h_file
  418. dnl
  419. old1=""
  420. old2=""
  421. for i in $host_os0 $host_os1 $host_os2 $host_os3 "_";
  422. do
  423. if test "$old1" != "$i"; then
  424. if test "$old2" != "$i"; then
  425. echo " " >>$ac_need_target_h_file
  426. echo "#ifndef __"$ac_need_target_h_prefix"_os_"$i >>$ac_need_target_h_file
  427. echo "#define __"$ac_need_target_h_prefix"_os_"$i '"'"$host_os"'"' >>$ac_need_target_h_file
  428. echo "#endif" >>$ac_need_target_h_file
  429. fi
  430. fi
  431. old2="$old1"
  432. old1="$i"
  433. done
  434. #
  435. old1=""
  436. old2=""
  437. for i in $host_cpu0 $host_cpu1 $host_cpu2 $host_cpu3 "_"
  438. do
  439. if test "$old1" != "$i"; then
  440. if test "$old2" != "$i"; then
  441. echo " " >>$ac_need_target_h_file
  442. echo "#ifndef __"$ac_need_target_h_prefix"_cpu_"$i >>$ac_need_target_h_file
  443. echo "#define __"$ac_need_target_h_prefix"_cpu_"$i '"'"$host_cpu"'"' >>$ac_need_target_h_file
  444. echo "#endif" >>$ac_need_target_h_file
  445. fi
  446. fi
  447. old2="$old1"
  448. old1="$i"
  449. done
  450. #
  451. old1=""
  452. old2=""
  453. for i in $host_cpu_arch0 "_"
  454. do
  455. if test "$old1" != "$i"; then
  456. if test "$old2" != "$i"; then
  457. echo " " >>$ac_need_target_h_file
  458. echo "#ifndef __"$ac_need_target_h_prefix"_arch_"$i >>$ac_need_target_h_file
  459. echo "#define __"$ac_need_target_h_prefix"_arch_"$i '"'"$host_cpu_arch"'"' >>$ac_need_target_h_file
  460. echo "#endif" >>$ac_need_target_h_file
  461. fi
  462. fi
  463. old2="$old1"
  464. old1="$i"
  465. done
  466. ])
  467. dnl -------------------------------------------------------------------
  468. dnl
  469. dnl the instruction set architecture (ISA) has evolved for a small set
  470. dnl of cpu types. So they often have specific names, e.g. sparclite,
  471. dnl yet they share quite a few similarities. This macro will set the
  472. dnl shell-var $target_cpu_arch to the basic type. Note that these
  473. dnl names are often in conflict with their original 32-bit type name
  474. dnl of these processors, just use them for directory-handling or add
  475. dnl a prefix/suffix to distinguish them from $target_cpu
  476. dnl
  477. dnl this macros has been invented since config.guess is sometimes
  478. dnl too specific about the cpu-type. I chose the names along the lines
  479. dnl of linux/arch/ which is modelled after widespread arch-naming, IMHO.
  480. dnl
  481. AC_DEFUN([AC_CANONICAL_CPU_ARCH],
  482. [AC_REQUIRE([AC_CANONICAL_SYSTEM])
  483. target_cpu_arch="unknown"
  484. case $target_cpu in
  485. i386*|i486*|i586*|i686*|i786*) target_cpu_arch=i386 ;;
  486. power*) target_cpu_arch=ppc ;;
  487. arm*) target_cpu_arch=arm ;;
  488. sparc64*) target_cpu_arch=sparc64 ;;
  489. sparc*) target_cpu_arch=sparc ;;
  490. mips64*) target_cpu_arch=mips64 ;;
  491. mips*) target_cpu_arch=mips ;;
  492. alpha*) target_cpu_arch=alpha ;;
  493. hppa1*) target_cpu_arch=hppa1 ;;
  494. hppa2*) target_cpu_arch=hppa2 ;;
  495. arm*) target_cpu_arch=arm ;;
  496. m68???|mcf54??) target_cpu_arch=m68k ;;
  497. *) target_cpu_arch="$target_cpu" ;;
  498. esac
  499. host_cpu_arch="unknown"
  500. case $host_cpu in
  501. i386*|i486*|i586*|i686*|i786*) host_cpu_arch=i386 ;;
  502. power*) host_cpu_arch=ppc ;;
  503. arm*) host_cpu_arch=arm ;;
  504. sparc64*) host_cpu_arch=sparc64 ;;
  505. sparc*) host_cpu_arch=sparc ;;
  506. mips64*) host_cpu_arch=mips64 ;;
  507. mips*) host_cpu_arch=mips ;;
  508. alpha*) host_cpu_arch=alpha ;;
  509. hppa1*) host_cpu_arch=hppa1 ;;
  510. hppa2*) host_cpu_arch=hppa2 ;;
  511. arm*) host_cpu_arch=arm ;;
  512. m68???|mcf54??) host_cpu_arch=m68k ;;
  513. *) host_cpu_arch="$target_cpu" ;;
  514. esac
  515. ])