AC-Archive
Autoconf Macro Archive

ac-archive.sf.net: - Project CVS - Download
Macro Index
- AM Support
- C++ Support
- C Support
- Fortran Support
- Java Support
- Cross Compilation
- Installed Packages
- Miscellaneous
- LaTeX Support
- Uncategorized
- archive macros
- adl's macros
- bkorb's macros
- guidod's macros
- latex's macros
- other's macros
- rleigh's macros
- obsoleted macros
- released macros
- search index

Documentation
- Contribute!
- History
- acincludedir m4
- acinclude (tool)
- macro howto
- ax tricks
- maintainers
- License
- Topics

generated...
2007-08-05

(C) 2007 guidod
Download the M4 Source.

ax_create_target_h

Back to the Main Page.

Synopsis
AX_CREATE_TARGET_H [(HEADER-FILE [,PREFIX)]
, 
Version

2007-07-27

Author

Guido U. Draheim <guidod@gmx.de>

License

GPLWithACException
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. As a special exception, the respective Autoconf Macro's copyright owner gives unlimited permission to copy, distribute and modify the configure scripts that are the output of Autoconf when processing the Macro. You need not follow the terms of the GNU General Public License when using or distributing such scripts

Category

guidod's Miscellaneous (released)

Documentation

create the header-file and let it contain '#defines' for the target platform. This macro is used for libraries that have platform-specific quirks. Instead of inventing a target-specific target.h.in files, just let it create a header file from the definitions of AC_CANONICAL_SYSTEM and put only ifdef's in the installed header-files.

if the HEADER-FILE is absent, [target.h] is used. 
if the PREFIX is absent, [TARGET] is used. 
the prefix can be the packagename. (y:a-z-:A-Z_:)

the defines look like...

#ifndef TARGET_CPU_M68K
#define TARGET_CPU_M68K "m68k"
#endif

#ifndef TARGET_OS_LINUX
#define TARGET_OS_LINUX "linux-gnu"
#endif

#ifndef TARGET_OS_TYPE                     /* the string itself */
#define TARGET_OS_TYPE "linux-gnu"
#endif

detail: in the case of hppa1.1, the three idents "hppa1_1" "hppa1" and "hppa" are derived, for an m68k it just two, "m68k" and "m"

variants:

  • - AX_CREATE_TARGET_H - the host and target defines

  • - AX_CREATE_PREFIX_TARGET_H - host and target defines with package prefix

  • - AX_CREATE_HOST_H - only host defines

  • - AX_CREATE_PREFIX_HOST_H - only host defines with package prefix

implementation note:

  • - it should have been defined through config.status but it is not.

M4 Source Code
dnl -------------------------------------------------------------------

dnl
dnl the instruction set architecture (ISA) has evolved for a small set
dnl of cpu types. So they often have specific names, e.g. sparclite,
dnl yet they share quite a few similarities. This macro will set the
dnl shell-var $target_cpu_type to the basic type. Note that these
dnl names are often in conflict with their original 32-bit type name
dnl of these processors, just use them for directory-handling or add
dnl a prefix/suffix to distinguish them from $target_cpu
dnl
dnl this macros has been invented since config.guess is sometimes
dnl too specific about the cpu-type. I chose the names along the lines
dnl of linux/arch/ which is modelled after widespread arch-naming, IMHO.
dnl A longer definition can be found in elf.h as the EM_* defines.
dnl
AC_DEFUN([AX_SET_CANONICAL_CPU_TYPE],[dnl
AS_VAR_PUSHDEF([TYPE],[$1])dnl
AS_VAR_PUSHDEF([CPU],[$2])dnl
TYPE=`echo "$CPU" | $as_tr_sh`
case $TYPE 
in i386*|i486*|i586*|i686*|i786*) TYPE="i386"
;; power*)   TYPE="ppc"
;; arm*)     TYPE="arm"
;; sparc64*) TYPE="sparc64"
;; sparc*)   TYPE="sparc"
;; mips64*)  TYPE="mips64"
;; mips*|cris*|etrax*) TYPE="mips"
;; alpha*)   TYPE="alpha"
;; hppa1*)   TYPE="hppa1"
;; hppa2*)   TYPE="hppa2"
;; arm*)     TYPE="arm"
;; sh*64)    TYPE="sh64"
;; sh*)      TYPE="sh"
;; m68???|mcf54??) TYPE="m68k"
;; esac
AS_VAR_POPDEF([CPU])dnl
AS_VAR_POPDEF([TYPE])dnl
])

AC_DEFUN([AX_SET_CANONICAL_OS_TYPE],[dnl
AS_VAR_PUSHDEF([TYPE],[$1])dnl
AS_VAR_PUSHDEF([OS],[$2])dnl
TYPE=`echo "$OS" | $as_tr_sh`
case $TYPE
in solaris*|sunos*)            TYPE="solaris"
;; *linux*)                    TYPE="linux"
;; *bsd*|*darwin*|*irix*)      TYPE="bsd"
;; win*|vista*)                TYPE="windows"
;; *sysv*|*aix*|*hpux*|*true*) TYPE="sysv"
;; esac
AS_VAR_POPDEF([OS])dnl
AS_VAR_POPDEF([TYPE])dnl
])


AC_DEFUN([AX_CANONICAL_BUILD_CPU_TYPE],[dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AX_SET_CANONICAL_CPU_TYPE([build_cpu_type],[build_cpu])dnl
])

AC_DEFUN([AX_CANONICAL_HOST_CPU_TYPE],[dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AX_SET_CANONICAL_CPU_TYPE([host_cpu_type],[host_cpu])dnl
])

AC_DEFUN([AX_CANONICAL_TARGET_CPU_TYPE],[dnl
AC_REQUIRE([AC_CANONICAL_TARGET])dnl
AX_SET_CANONICAL_CPU_TYPE([target_cpu_type],[target_cpu])dnl
])

AC_DEFUN([AX_CANONICAL_BUILD_OS_TYPE],[dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AX_SET_CANONICAL_OS_TYPE([build_os_type],[build_os])dnl
])

AC_DEFUN([AX_CANONICAL_HOST_OS_TYPE],[dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AX_SET_CANONICAL_OS_TYPE([host_os_type],[host_os])dnl
])

AC_DEFUN([AX_CANONICAL_TARGET_OS_TYPE],[dnl
AC_REQUIRE([AC_CANONICAL_TARGET])dnl
AX_SET_CANONICAL_OS_TYPE([target_os_type],[target_os])dnl
])

AC_DEFUN([AX_SET_CANONICAL_SHORTHAND_TYPES],[dnl
AS_VAR_PUSHDEF([DEF0],[$1_0])dnl
AS_VAR_PUSHDEF([DEF1],[$1_1])dnl
AS_VAR_PUSHDEF([DEF2],[$1_2])dnl
AS_VAR_PUSHDEF([DEF3],[$1_3])dnl
DEF0=`echo "$2" | $as_tr_cpp`
DEF1=`echo "$DEF0" | sed "s:\\(m4_dquote(^$as_cr_digits)*\\).*:\\1:"`
DEF2=`echo "$DEF0" | sed "s:\\(m4_dquote(^_)*\\).*:\\1:"`
DEF3=`echo "$DEF2" | sed "s:\\(m4_dquote(^$as_cr_digits)*\\).*:\\1:"`
AS_VAR_POPDEF([DEF3])dnl
AS_VAR_POPDEF([DEF2])dnl
AS_VAR_POPDEF([DEF1])dnl
AS_VAR_POPDEF([DEF0])dnl
])

AC_DEFUN([AX_CANONICAL_BUILD_CPU_TYPES],[dnl
AC_REQUIRE([AX_CANONICAL_BUILD_CPU_TYPE])dnl
AX_SET_CANONICAL_SHORTHAND_TYPES([build_cpu_type],[$build_cpu])dnl
])

AC_DEFUN([AX_CANONICAL_HOST_CPU_TYPES],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_CPU_TYPE])dnl
AX_SET_CANONICAL_SHORTHAND_TYPES([host_cpu_type],[$host_cpu])dnl
])

AC_DEFUN([AX_CANONICAL_TARGET_CPU_TYPES],[dnl
AC_REQUIRE([AX_CANONICAL_TARGET_CPU_TYPE])dnl
AX_SET_CANONICAL_SHORTHAND_TYPES([target_cpu_type],[$target_cpu])dnl
])

AC_DEFUN([AX_CANONICAL_BUILD_OS_TYPES],[dnl
AC_REQUIRE([AX_CANONICAL_BUILD_OS_TYPE])dnl
AX_SET_CANONICAL_SHORTHAND_TYPES([build_os_type],[$build_os])dnl
])

AC_DEFUN([AX_CANONICAL_HOST_OS_TYPES],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_OS_TYPE])dnl
AX_SET_CANONICAL_SHORTHAND_TYPES([host_os_type],[$host_os])dnl
])

AC_DEFUN([AX_CANONICAL_TARGET_OS_TYPES],[dnl
AC_REQUIRE([AX_CANONICAL_TARGET_OS_TYPE])dnl
AX_SET_CANONICAL_SHORTHAND_TYPES([target_os_type],[$target_os])dnl
])

AC_DEFUN([AX_CREATE_TARGET_DEFINE_INTO],[dnl
  {
   echo ""
   echo "#ifndef $2"
   echo "#define $2" $3
   echo "#endif"
  } &gt;&gt; $1
])
AC_DEFUN([AX_CREATE_TARGET_DEFINE_INTO_],[dnl
  AX_CREATE_TARGET_DEFINE_INTO([$1],[$2],['"'"$3"'"'])dnl
])

AC_DEFUN([AX_CREATE_WRITE_TARGET_INIT],[dnl
ax_create_write_target_h_defines="::"
])

AC_DEFUN([AX_CREATE_WRITE_TARGET_H],[dnl
AC_REQUIRE([AX_CREATE_WRITE_TARGET_INIT])dnl
AS_VAR_PUSHDEF([OLD],[ax_create_write_target_h_defines])dnl
for varname in $3 ; do
  varvalue=`eval echo '$'"$varname" `
  vardefine=`echo "$2"_"$varvalue" | $as_tr_cpp`
  if test "&lt;$varvalue&gt;" != "&lt;&gt;"; then
    case "$OLD:" 
    in *:$vardefine:*) : variable already defined
    ;; *) AX_CREATE_TARGET_DEFINE_INTO([$1],[$vardefine],[1])
    ;; esac
    OLD="$OLD:$vardefine"
  fi
done
AS_VAR_POPDEF([OLD])dnl
])

AC_DEFUN([AX_CREATE_UPDATE_TARGET_H],[dnl
    if cmp -s $1 $2 2&gt;/dev/null; then
      rm -f $1
      AC_MSG_NOTICE([unchanged $2])
    else
      ac_dir=`AS_DIRNAME(["$2"])`
      AS_MKDIR_P(["$ac_dir"])
      rm -f $2
      mv $1 $2
    fi
])

dnl --------------------------------------------------------------- CPU

AC_DEFUN([AX_CREATE_HOST_CPU_TARGET_H],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_CPU_TYPES])dnl
ax_create_target_h=ifelse($1, ,target.h, $1)
ax_create_target_prefix=ifelse($2, , _, $2)
AC_CONFIG_COMMANDS($ax_create_target_h,[dnl
AS_VAR_PUSHDEF([TMP],[ax_create_target_h_tmp])
AS_VAR_PUSHDEF([PRE],[ax_create_target_prefix])
AC_MSG_NOTICE([creating: $ax_create_target_h: canonical host cpu target defines])
TMP="$tmp/target.h"
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_CPU,[$host_cpu])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_CPU_TYPE,[$host_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_CPU_TYPE,[host_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_CPU,[ \
  host_cpu_type host_cpu_type_0 \
  host_cpu_type_1 host_cpu_type_2 host_cpu_type_3])
AX_CREATE_UPDATE_TARGET_H($TMP,$ax_create_target_h)
AS_VAR_POPDEF([PRE])
AS_VAR_POPDEF([TMP])
  ],[dnl
ax_create_target_h="$ax_create_target_h"
ax_create_target_prefix="$ax_create_target_prefix"
host_cpu="$host_cpu"
host_cpu_type="$host_cpu_type"
host_cpu_type_0="$host_cpu_type_0"
host_cpu_type_1="$host_cpu_type_1"
host_cpu_type_2="$host_cpu_type_2"
host_cpu_type_3="$host_cpu_type_3"
  ])dnl
])

AC_DEFUN([AX_CREATE_PREFIX_HOST_CPU_TARGET_H],[
AX_CREATE_HOST_CPU_TARGET_H([$1],[ifelse($2, ,$PACKAGE, $2)])dnl
])

AC_DEFUN([AX_CREATE_CPU_TARGET_H],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_CPU_TYPES])dnl
AC_REQUIRE([AX_CANONICAL_TARGET_CPU_TYPES])dnl
ax_create_target_h=ifelse($1, ,target.h, $1)
ax_create_target_prefix=ifelse($2, , _, $2)
AC_CONFIG_COMMANDS($ax_create_target_h,[
AC_MSG_NOTICE([creating: $ax_create_target_h: canonical cpu target defines])
AS_VAR_PUSHDEF([TMP],[ax_create_target_h_tmp])
AS_VAR_PUSHDEF([PRE],[ax_create_target_prefix])
TMP="$tmp/target.h"
AX_CREATE_HOST_DEFINE_INTO_($TMP, ${PRE}_HOST_CPU,[$host_cpu])
AX_CREATE_HOST_DEFINE_INTO_($TMP, ${PRE}_HOST_CPU_TYPE,[$host_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_CPU_TYPE,[host_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_CPU,[ \
  host_cpu_type host_cpu_type_0 \
  host_cpu_type_1 host_cpu_type_2 host_cpu_type_3])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_TARGET_CPU,[$target_cpu])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_TARGET_CPU_TYPE,[$target_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_TARGET_CPU_TYPE,[target_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_TARGET_CPU,[ \
  target_cpu_type target_cpu_type_0 \
  target_cpu_type_1 target_cpu_type_2 target_cpu_type_3])
AX_CREATE_UPDATE_TARGET_H($TMP,$ax_create_target_h)
AS_VAR_POPDEF([PRE])
AS_VAR_POPDEF([TMP])
  ],[dnl
ax_create_target_h="$ax_create_target_h"
ax_create_target_prefix="$ax_create_target_prefix"
target_cpu="$target_cpu"
target_cpu_type="$target_cpu_type"
target_cpu_type_0="$target_cpu_type_0"
target_cpu_type_1="$target_cpu_type_1"
target_cpu_type_2="$target_cpu_type_2"
target_cpu_type_3="$target_cpu_type_3"
host_cpu="$host_cpu"
host_cpu_type="$host_cpu_type"
host_cpu_type_0="$host_cpu_type_0"
host_cpu_type_1="$host_cpu_type_1"
host_cpu_type_2="$host_cpu_type_2"
host_cpu_type_3="$host_cpu_type_3"
  ])dnl
])

AC_DEFUN([AX_CREATE_PREFIX_CPU_TARGET_H],[
AX_CREATE_CPU_TARGET_H([$1],[ifelse($2, ,$PACKAGE, $2)])dnl
])

AC_DEFUN([AX_CREATE_BUILD_CPU_TARGET_H],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_CPU_TYPES])dnl
AC_REQUIRE([AX_CANONICAL_TARGET_CPU_TYPES])dnl
AC_REQUIRE([AX_CANONICAL_BUILD_CPU_TYPES])dnl
ax_create_target_h=ifelse($1, ,target.h, $1)
ax_create_target_prefix=ifelse($2, , _, $2)
AC_CONFIG_COMMANDS($ax_create_target_h,[
AC_MSG_NOTICE([creating: $ax_create_target_h: canonical build cpu target defines])
AS_VAR_PUSHDEF([TMP],[ax_create_target_h_tmp])
AS_VAR_PUSHDEF([PRE],[ax_create_target_prefix])
TMP="$tmp/target.h"
AX_CREATE_HOST_DEFINE_INTO_($TMP, ${PRE}_HOST_CPU,[$host_cpu])
AX_CREATE_HOST_DEFINE_INTO_($TMP, ${PRE}_HOST_CPU_TYPE,[$host_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_CPU_TYPE,[host_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_CPU,[ \
  host_cpu_type host_cpu_type_0 \
  host_cpu_type_1 host_cpu_type_2 host_cpu_type_3])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_TARGET_CPU,[$target_cpu])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_TARGET_CPU_TYPE,[$target_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_TARGET_CPU_TYPE,[target_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_TARGET_CPU,[ \
  target_cpu_type target_cpu_type_0 \
  target_cpu_type_1 target_cpu_type_2 target_cpu_type_3])
AX_CREATE_BUILD_DEFINE_INTO_($TMP, ${PRE}_BUILD_CPU,[$build_cpu])
AX_CREATE_BUILD_DEFINE_INTO_($TMP, ${PRE}_BUILD_CPU_TYPE,[$build_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_BUILD_CPU_TYPE,[build_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_BUILD_CPU,[ \
  build_cpu_type build_cpu_type_0 \
  build_cpu_type_1 build_cpu_type_2 build_cpu_type_3])
AX_CREATE_UPDATE_TARGET_H($TMP,$ax_create_target_h)
AS_VAR_POPDEF([PRE])
AS_VAR_POPDEF([TMP])
  ],[dnl
ax_create_target_h="$ax_create_target_h"
ax_create_target_prefix="$ax_create_target_prefix"
host_cpu="$host_cpu"
host_cpu_type="$host_cpu_type"
host_cpu_type_0="$host_cpu_type_0"
host_cpu_type_1="$host_cpu_type_1"
host_cpu_type_2="$host_cpu_type_2"
host_cpu_type_3="$host_cpu_type_3"
target_cpu="$target_cpu"
target_cpu_type="$target_cpu_type"
target_cpu_type_0="$target_cpu_type_0"
target_cpu_type_1="$target_cpu_type_1"
target_cpu_type_2="$target_cpu_type_2"
target_cpu_type_3="$target_cpu_type_3"
build_cpu="$build_cpu"
build_cpu_type="$build_cpu_type"
build_cpu_type_0="$build_cpu_type_0"
build_cpu_type_1="$build_cpu_type_1"
build_cpu_type_2="$build_cpu_type_2"
build_cpu_type_3="$build_cpu_type_3"
  ])dnl
])

AC_DEFUN([AX_CREATE_PREFIX_BUILD_CPU_TARGET_H],[
AX_CREATE_BUILD_CPU_TARGET_H([$1],[ifelse($2, ,$PACKAGE, $2)])dnl
])

dnl --------------------------------------------------------------- OS

AC_DEFUN([AX_CREATE_HOST_OS_TARGET_H],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_OS_TYPES])dnl
ax_create_target_h=ifelse($1, ,target.h, $1)
ax_create_target_prefix=ifelse($2, , _, $2)
AC_CONFIG_COMMANDS($ax_create_target_h,[
AC_MSG_NOTICE([creating: $ax_create_target_h: canonical host os target defines])
AS_VAR_PUSHDEF([TMP],[ax_create_target_h_tmp])
AS_VAR_PUSHDEF([PRE],[ax_create_target_prefix])
TMP="$tmp/target.h"
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_OS,[$host_os])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_OS_TYPE,[$host_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_OS_TYPE,[host_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_OS,[ \
  host_os_type host_os_type_0 \
  host_os_type_1 host_os_type_2 host_os_type_3])
AX_CREATE_UPDATE_TARGET_H($TMP,$ax_create_target_h)
AS_VAR_POPDEF([PRE])
AS_VAR_POPDEF([TMP])
  ],[dnl
ax_create_target_h="$ax_create_target_h"
ax_create_target_prefix="$ax_create_target_prefix"
host_os="$host_os"
host_os_type="$host_os_type"
host_os_type_0="$host_os_type_0"
host_os_type_1="$host_os_type_1"
host_os_type_2="$host_os_type_2"
host_os_type_3="$host_os_type_3"
  ])dnl
])

AC_DEFUN([AX_CREATE_PREFIX_HOST_OS_TARGET_H],[
AX_CREATE_HOST_OS_TARGET_H([$1],[ifelse($2, ,$PACKAGE, $2)])dnl
])

AC_DEFUN([AX_CREATE_OS_TARGET_H],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_OS_TYPES])dnl
AC_REQUIRE([AX_CANONICAL_TARGET_OS_TYPES])dnl
ax_create_target_h=ifelse($1, ,target.h, $1)
ax_create_target_prefix=ifelse($2, , _, $2)
AC_CONFIG_COMMANDS($ax_create_target_h,[
AC_MSG_NOTICE([creating: $ax_create_target_h: canonical os target defines])
AS_VAR_PUSHDEF([TMP],[ax_create_target_h_tmp])
AS_VAR_PUSHDEF([PRE],[ax_create_target_prefix])
TMP="$tmp/target.h"
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_OS,[$host_os])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_OS_TYPE,[$host_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_OS_TYPE,[host_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_OS,[ \
  host_os_type host_os_type_0 \
  host_os_type_1 host_os_type_2 host_os_type_3])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_TARGET_OS,[$target_os])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_TARGET_OS_TYPE,[$target_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_TARGET_OS_TYPE,[target_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_TARGET_OS,[ \
  target_os_type target_os_type_0 \
  target_os_type_1 target_os_type_2 target_os_type_3])
AX_CREATE_UPDATE_TARGET_H($TMP,$ax_create_target_h)
AS_VAR_POPDEF([PRE])
AS_VAR_POPDEF([TMP])
  ],[dnl
ax_create_target_h="$ax_create_target_h"
ax_create_target_prefix="$ax_create_target_prefix"
target_os="$target_os"
target_os_type="$target_os_type"
target_os_type_0="$target_os_type_0"
target_os_type_1="$target_os_type_1"
target_os_type_2="$target_os_type_2"
target_os_type_3="$target_os_type_3"
host_os="$host_os"
host_os_type="$host_os_type"
host_os_type_0="$host_os_type_0"
host_os_type_1="$host_os_type_1"
host_os_type_2="$host_os_type_2"
host_os_type_3="$host_os_type_3"
  ])dnl
])

AC_DEFUN([AX_CREATE_PREFIX_OS_TARGET_H],[
AX_CREATE_OS_TARGET_H([$1],[ifelse($2, ,$PACKAGE, $2)])dnl
])

AC_DEFUN([AX_CREATE_BUILD_OS_TARGET_H],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_OS_TYPES])dnl
AC_REQUIRE([AX_CANONICAL_TARGET_OS_TYPES])dnl
AC_REQUIRE([AX_CANONICAL_BUILD_OS_TYPES])dnl
ax_create_target_h=ifelse($1, ,target.h, $1)
ax_create_target_prefix=ifelse($2, , _, $2)
AC_CONFIG_COMMANDS($ax_create_target_h,[
AC_MSG_NOTICE([creating: $ax_create_target_h: canonical build os target defines])
AS_VAR_PUSHDEF([TMP],[ax_create_target_h_tmp])
AS_VAR_PUSHDEF([PRE],[ax_create_target_prefix])
TMP="$tmp/target.h"
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_OS,[$host_os])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_OS_TYPE,[$host_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_OS_TYPE,[host_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_OS,[ \
  host_os_type host_os_type_0 \
  host_os_type_1 host_os_type_2 host_os_type_3])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_TARGET_OS,[$target_os])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_TARGET_OS_TYPE,[$target_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_TARGET_OS_TYPE,[target_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_TARGET_OS,[ \
  target_os_type target_os_type_0 \
  target_os_type_1 target_os_type_2 target_os_type_3])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_BUILD_OS,[$build_os])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_BUILD_OS_TYPE,[$build_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_BUILD_OS_TYPE,[build_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_BUILD_OS,[ \
  build_os_type build_os_type_0 \
  build_os_type_1 build_os_type_2 build_os_type_3])
AX_CREATE_UPDATE_TARGET_H($TMP,$ax_create_target_h)
AS_VAR_POPDEF([PRE])
AS_VAR_POPDEF([TMP])
  ],[dnl
ax_create_target_h="$ax_create_target_h"
ax_create_target_prefix="$ax_create_target_prefix"
host_os="$host_os"
host_os_type="$host_os_type"
host_os_type_0="$host_os_type_0"
host_os_type_1="$host_os_type_1"
host_os_type_2="$host_os_type_2"
host_os_type_3="$host_os_type_3"
target_os="$target_os"
target_os_type="$target_os_type"
target_os_type_0="$target_os_type_0"
target_os_type_1="$target_os_type_1"
target_os_type_2="$target_os_type_2"
target_os_type_3="$target_os_type_3"
build_os="$build_os"
build_os_type="$build_os_type"
build_os_type_0="$build_os_type_0"
build_os_type_1="$build_os_type_1"
build_os_type_2="$build_os_type_2"
build_os_type_3="$build_os_type_3"
  ])dnl
])

AC_DEFUN([AX_CREATE_PREFIX_BUILD_OS_TARGET_H],[
AX_CREATE_BUILD_OS_TARGET_H([$1],[ifelse($2, ,$PACKAGE, $2)])dnl
])

dnl --------------------------------------------------------------- OS + CPU

AC_DEFUN([AX_CREATE_HOST_TARGET_H],[dnl
AC_REQUIRE([AX_CANONICAL_HOST_CPU_TYPES])dnl
AC_REQUIRE([AX_CANONICAL_HOST_OS_TYPES])dnl
ax_create_target_h=ifelse($1, ,target.h, $1)
ax_create_target_prefix=ifelse($2, , _, $2)
AC_CONFIG_COMMANDS($ax_create_target_h,[
AC_MSG_NOTICE([creating: $ax_create_target_h: canonical host target defines])
AS_VAR_PUSHDEF([TMP],[ax_create_target_h_tmp])
AS_VAR_PUSHDEF([PRE],[ax_create_target_prefix])
TMP="$tmp/target.h"
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_CPU,[$host_cpu])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_CPU_TYPE,[$host_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_CPU_TYPE,[host_cpu_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_CPU,[ \
  host_cpu_type host_cpu_type_0 \
  host_cpu_type_1 host_cpu_type_2 host_cpu_type_3])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_OS,[$host_os])
AX_CREATE_TARGET_DEFINE_INTO_($TMP, ${PRE}_HOST_OS_TYPE,[$host_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_OS_TYPE,[host_os_type])
AX_CREATE_WRITE_TARGET_H($TMP, ${PRE}_HOST_OS,[ \
  host_os_type host_os_type_0 \
  host_os_type_1 host_os_type_2 host_os_type_3])
AX_CREATE_UPDATE_TARGET_H($TMP,$ax_create_target_h)
AS_VAR_POPDEF([PRE])
AS_VAR_POPDEF([TMP])
  ],[dnl
ax_create_target_h="$ax_create_target_h"
ax_create_target_prefix="$ax_create_target_prefix"
host_cpu="$host_cpu"
host_cpu_type="$host_cpu_type"
host_cpu_type_0="$host_cpu_type_0"
host_cpu_type_1="$host_cpu_type_1"
host_cpu_type_2="$host_cpu_type_2"
host_cpu_type_3="$host_cpu_type_3"
host_os="$host_os"
host_os_type="$host_os_type"
host_os_type_0="$host_os_type_0"
host_os_type_1="$host_os_type_1"
host_os_type_2="$host_os_type_2"
host_os_type_3="$host_os_type_3"
  ])dnl
])

AC_DEFUN([AX_CREATE_PREFIX_HOST_TARGET_H],[
AX_CREATE_HOST_TARGET_H([$1],[ifelse($2, ,$PACKAGE, $2)])dnl
])