]> git.ipfire.org Git - thirdparty/grub.git/blob - configure.ac
2003-10-27 Marco Gerards <metgerards@student.han.nl>
[thirdparty/grub.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 # Copyright (C) 2002,2003 Yoshinori K. Okuji <okuji@enbug.org>
4 #
5 # This configure.ac is free software; the author
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 AC_INIT(PUPA, 0.6, [okuji@enbug.org])
15 AC_PREREQ(2.53)
16 AC_CONFIG_SRCDIR([include/pupa/dl.h])
17 AC_CONFIG_HEADER([config.h])
18
19 # Checks for build and host systems.
20 AC_CANONICAL_BUILD
21 AC_CANONICAL_HOST
22
23 case "$host_cpu" in
24 i[[3456]]86) host_cpu=i386 ;;
25 *) AC_MSG_ERROR([unsupported CPU type]) ;;
26 esac
27
28 case "$host_cpu"-"$host_vendor" in
29 i386-*) host_vendor=pc ;;
30 *) AC_MSG_ERROR([unsupported machine type]) ;;
31 esac
32
33 AC_SUBST(host_cpu)
34 AC_SUBST(host_vendor)
35
36 # Checks for programs.
37 if test "x$CFLAGS" = x; then
38 default_CFLAGS=yes
39 fi
40
41 AC_PROG_CC
42 AC_SYS_LARGEFILE
43
44 # Must be GCC.
45 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
46
47 if test "x$default_CFLAGS" = xyes; then
48 # debug flags.
49 tmp_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
50 -Wundef -Wstrict-prototypes -g"
51
52 # optimization flags.
53 AC_CACHE_CHECK([whether optimization for size works], size_flag, [
54 CFLAGS=-Os
55 AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
56 ])
57 if test "x$size_flag" = xyes; then
58 tmp_CFLAGS="$tmp_CFLAGS -Os"
59 else
60 tmp_CFLAGS="$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
61 fi
62
63 # Force no alignment to save space on i386.
64 if test "x$host_cpu" = xi386; then
65 AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
66 CFLAGS="-falign-loops=1"
67 AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no])
68 ])
69
70 if test "x$falign_loop_flag" = xyes; then
71 tmp_CFLAGS="$tmp_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
72 else
73 tmp_CFLAGS="$tmp_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
74 fi
75 fi
76
77 CFLAGS="$tmp_CFLAGS"
78 fi
79 AC_SUBST(CFLAGS)
80
81 # Defined in aclocal.m4.
82 pupa_ASM_USCORE
83 pupa_CHECK_START_SYMBOL
84 pupa_CHECK_BSS_START_SYMBOL
85 pupa_CHECK_END_SYMBOL
86
87 if test "x$host_cpu" = xi386; then
88 pupa_I386_ASM_PREFIX_REQUIREMENT
89 pupa_I386_ASM_ADDR32
90 pupa_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
91 fi
92
93
94 AC_PROG_INSTALL
95 AC_PROG_MAKE_SET
96 AC_CHECK_TOOL(OBJCOPY, objcopy)
97 pupa_PROG_OBJCOPY_ABSOLUTE
98 AC_CHECK_TOOL(STRIP, strip)
99 AC_CHECK_TOOL(NM, nm)
100 AC_CHECK_TOOL(LD, ld)
101
102 # This is not a "must".
103 AC_PATH_PROG(RUBY, ruby)
104
105 # For cross-compiling.
106 if test "x$build" = "x$host"; then
107 BUILD_CC="$CC"
108 AC_SUBST(BUILD_CC)
109 else
110 AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
111 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
112 fi
113
114 # Test the C compiler for the build environment.
115 tmp_CC="$CC"
116 tmp_CFLAGS="$CFLAGS"
117 tmp_CPPFLAGS="$CPPFLAGS"
118 CC="$BUILD_CC"
119 CFLAGS="$BUILD_CFLAGS"
120 CPPFLAGS="$BUILD_CPPFLAGS"
121
122 # Identify characteristics of the build architecture.
123 AC_C_BIGENDIAN
124 AC_CHECK_SIZEOF(void *)
125 AC_CHECK_SIZEOF(long)
126
127 # Check LZO.
128 AC_CHECK_LIB(lzo, __lzo_init2, ,
129 AC_MSG_ERROR([LZO library version 1.02 or later is required]))
130 AC_CHECK_FUNC(lzo1x_999_compress, ,
131 [AC_MSG_ERROR([LZO1X-999 must be enabled])])
132
133 CC="$tmp_CC"
134 CFLAGS="$tmp_CFLAGS"
135 CPPFLAGS="$tmp_CPPFLAGS"
136
137 # Output files.
138 AC_CONFIG_LINKS([include/pupa/cpu:include/pupa/$host_cpu
139 include/pupa/machine:include/pupa/$host_cpu/$host_vendor])
140 AC_CONFIG_FILES([Makefile])
141 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
142 AC_OUTPUT