1 # Process this file with autoconf to produce a configure script.
3 # Copyright (C) 2002,2003 Yoshinori K. Okuji <okuji@enbug.org>
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.
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
14 AC_INIT(PUPA, 0.6, [okuji@enbug.org])
16 AC_CONFIG_SRCDIR([include/pupa/dl.h])
17 AC_CONFIG_HEADER([config.h])
19 # Checks for build and host systems.
24 i[[3456]]86) host_cpu=i386 ;;
25 *) AC_MSG_ERROR([unsupported CPU type]) ;;
28 case "$host_cpu"-"$host_vendor" in
29 i386-*) host_vendor=pc ;;
30 *) AC_MSG_ERROR([unsupported machine type]) ;;
36 # Checks for programs.
37 if test "x$CFLAGS" = x; then
45 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
47 if test "x$default_CFLAGS" = xyes; then
49 tmp_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
50 -Wundef -Wstrict-prototypes -g"
53 AC_CACHE_CHECK([whether optimization for size works], size_flag, [
55 AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
57 if test "x$size_flag" = xyes; then
58 tmp_CFLAGS="$tmp_CFLAGS -Os"
60 tmp_CFLAGS="$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
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])
70 if test "x$falign_loop_flag" = xyes; then
71 tmp_CFLAGS="$tmp_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
73 tmp_CFLAGS="$tmp_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
81 # Defined in aclocal.m4.
83 pupa_CHECK_START_SYMBOL
84 pupa_CHECK_BSS_START_SYMBOL
87 if test "x$host_cpu" = xi386; then
88 pupa_I386_ASM_PREFIX_REQUIREMENT
90 pupa_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
96 AC_CHECK_TOOL(OBJCOPY, objcopy)
97 pupa_PROG_OBJCOPY_ABSOLUTE
98 AC_CHECK_TOOL(STRIP, strip)
100 AC_CHECK_TOOL(LD, ld)
102 # This is not a "must".
103 AC_PATH_PROG(RUBY, ruby)
105 # For cross-compiling.
106 if test "x$build" = "x$host"; then
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.])])
114 # Test the C compiler for the build environment.
117 tmp_CPPFLAGS="$CPPFLAGS"
119 CFLAGS="$BUILD_CFLAGS"
120 CPPFLAGS="$BUILD_CPPFLAGS"
122 # Identify characteristics of the build architecture.
124 AC_CHECK_SIZEOF(void *)
125 AC_CHECK_SIZEOF(long)
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])])
135 CPPFLAGS="$tmp_CPPFLAGS"
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])