Autoconf-generated configure scripts can make decisions based on a canonical name for the system type, or target triplet, which has the form: ‘cpu-vendor-os’, where os can be ‘system’ or ‘kernel-system’
configure can guess the canonical name for the type of system it‘s running on. To do so it runs a script called config.guess, which infers the name using the uname command or symbols predefined by the C preprocessor.
Alternately, the user can specify the system type with command line arguments to configure (see System Type. Doing so is necessary when cross-compiling. In the most complex case of cross-compiling, three system types are involved. The options to specify them are:
--build=build-type
the type of system on which the package is being configured and compiled. It defaults to the result of running config.guess.
--host=host-type
the type of system on which the package runs. By default it is the same as the build machine. Specifying it enables the cross-compilation mode.
--target=target-type
the type of system for which any compiler tools in the package produce code (rarely needed). By default, it is the same as host.
gcc
-dumpmachine
Print the compiler’s target machine (for example, i686-pc-linux-gnu)---and don’t do anything else.
-dumpversion
Print the compiler version (for example, 3.0)---and don’t do anything else.
-dumpspecs
Print the compiler’s built-in specs---and don’t do anything else. (This is used when GCC itself is being built.)
[[email protected] ~]$ gcc -dumpmachine
x86_64-redhat-linux
[[email protected] ~]$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
[[[email protected] ~]$ ld -V
GNU ld version 2.20.51.0.2-5.44.el6 20100205
Supported emulations:
elf_x86_64
elf_i386
i386linux
elf_l1om
[[email protected] ~]$ uname -m -o
x86_64 GNU/Linux
$ as -v
GNU assembler version 2.20.51.0.2 (x86_64-redhat-linux) using BFD version version 2.20.51.0.2-5.44.el6
[[email protected] ~]$ file /usr/bin/file
/usr/bin/file: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped