]> git.proxmox.com Git - grub2.git/blame - configure.ac
2002-12-27 Yoshinori K. Okuji <okuji@enbug.org>
[grub2.git] / configure.ac
CommitLineData
6a161fa9 1# Process this file with autoconf to produce a configure script.
2
3# Copyright (C) 2002 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
14AC_INIT(PUPA, 0.6, [okuji@enbug.org])
15AC_PREREQ(2.53)
16AC_CONFIG_SRCDIR([include/pupa/dl.h])
17AC_CONFIG_HEADER([config.h])
18
19# Checks for build and host systems.
20AC_CANONICAL_BUILD
21AC_CANONICAL_HOST
22
23case "$host_cpu" in
24 i[[3456]]86) host_cpu=i386 ;;
25 *) AC_MSG_ERROR([unsupported CPU type]) ;;
26esac
27
28case "$host_cpu"-"$host_vendor" in
29 i386-*) host_vendor=pc ;;
30 *) AC_MSG_ERROR([unsupported machine type]) ;;
31esac
32
33AC_SUBST(host_cpu)
34AC_SUBST(host_vendor)
35
36# Checks for programs.
37if test "x$CFLAGS" = x; then
38 default_CFLAGS=yes
39fi
40
41AC_PROG_CC
42
43# Must be GCC.
44test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
45
46if test "x$default_CFLAGS" = xyes; then
47 # debug flags.
48 tmp_CFLAGS="-Wall -W -g"
49
50 # optimization flags.
51 AC_CACHE_CHECK([whether optimization for size works], size_flag, [
52 CFLAGS=-Os
53 AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
54 ])
55 if test "x$size_flag" = xyes; then
56 tmp_CFLAGS="$tmp_CFLAGS -Os"
57 else
58 tmp_CFLAGS="$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
59 fi
60
61 # Force no alignment to save space on i386.
62 if test "x$host_cpu" = xi386; then
63 AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
64 CFLAGS="-falign-loops=1"
65 AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no])
66 ])
67
68 if test "x$falign_loop_flag" = xyes; then
69 tmp_CFLAGS="$tmp_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
70 else
71 tmp_CFLAGS="$tmp_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
72 fi
73 fi
74
75 CFLAGS="$tmp_CFLAGS"
76fi
77AC_SUBST(CFLAGS)
78
79# Defined in aclocal.m4.
80pupa_ASM_USCORE
81pupa_CHECK_START_SYMBOL
82pupa_CHECK_BSS_START_SYMBOL
83pupa_CHECK_END_SYMBOL
84
85if test "x$host_cpu" = xi386; then
86 pupa_I386_ASM_PREFIX_REQUIREMENT
87 pupa_I386_ASM_ADDR32
88 pupa_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
89fi
90
91
92AC_PROG_INSTALL
93AC_PROG_MAKE_SET
94AC_CHECK_TOOL(OBJCOPY, objcopy)
95pupa_PROG_OBJCOPY_ABSOLUTE
96AC_CHECK_TOOL(STRIP, strip)
97AC_CHECK_TOOL(NM, nm)
98
99# This is not a "must".
100AC_PATH_PROG(RUBY, ruby)
101
102# For cross-compiling.
103if test "x$build" = "x$host"; then
104 BUILD_CC="$CC"
105 AC_SUBST(BUILD_CC)
106else
107 AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
108 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
109fi
110
111# Test the C compiler for the build environment.
112pupa_tmp_CC="$CC"
113CC="$BUILD_CC"
114AC_C_BIGENDIAN
115AC_CHECK_SIZEOF(void *)
116AC_CHECK_SIZEOF(long)
117CC="$pupa_tmp_CC"
118
119# Output files.
120AC_CONFIG_LINKS([include/pupa/cpu:include/pupa/$host_cpu
121 include/pupa/machine:include/pupa/$host_cpu/$host_vendor])
122AC_CONFIG_FILES([Makefile])
123AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
124AC_OUTPUT