summaryrefslogtreecommitdiff
path: root/arch/x86/configfrag.ac
blob: af731bff482596ec752d404fc80be71fa770ab93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
m4_define([x86_ENABLE_PAE],
          [AC_DEFINE([X86_PAE], [1], [use PAE page translation])
           AC_MSG_NOTICE([physical address extension enabled])])

m4_define([x86_SELECT_I386],
          [machine=i386
           AS_IF([test x"$enable_pae" = xyes], [x86_ENABLE_PAE])])

m4_define([x86_SELECT_AMD64],
          [machine=amd64
           AS_IF([test x"$enable_pae" = xyes],
                 [AC_MSG_WARN([pae option available for i386 only, ignoring])])])

m4_define([x86_SELECT],
          [arch=x86
           AC_ARG_WITH([i386],
                       [AS_HELP_STRING([--with-i386],
                                       [build for a 32-bit IA-32 machine])],
                       [opt_i386=$withval],
                       [opt_i386=no])

           AC_ARG_WITH([amd64],
                       [AS_HELP_STRING([--with-amd64],
                                       [build for a 64-bit AMD64 machine])],
                       [opt_amd64=$withval],
                       [opt_amd64=no])

           AC_ARG_ENABLE([pae],
                         [AS_HELP_STRING([--enable-pae],
                         [enable physical address extension (i386 only)])])

           AS_IF([test x"$opt_i386$opt_amd64" = xyesyes],
                 [AC_MSG_ERROR([select only one of i386 or amd64])],
                 [test x"$opt_i386$opt_amd64" = xnono],
                 [AS_CASE(["$host_cpu"],
                          [i?86], [opt_i386=yes],
                          [x86_64], [opt_amd64=yes])])

           AS_IF([test x"$opt_i386" = xyes], [x86_SELECT_I386],
                 [test x"$opt_amd64" = xyes], [x86_SELECT_AMD64])

           AC_DEFINE_UNQUOTED([X86_MACHINE], [$machine], [machine])
           AC_MSG_NOTICE([machine type: $arch ($machine)])])

AS_CASE(["$host_cpu"],
        [i?86|x86_64], [x86_SELECT])

AM_CONDITIONAL([X86], [test "$arch" = x86])
AM_CONDITIONAL([I386], [test x"$opt_i386" = xyes])
AM_CONDITIONAL([AMD64], [test x"$opt_amd64" = xyes])