OSDN Git Service

Before I delve in the long (sorry) RFC below, I've been taking:
[uclinux-h8/elf2flt.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(elf2flt.c)
3
4 AC_ARG_WITH(libbfd,
5         [ --with-libbfd=<file>  path to libbfd.a library to use ],
6         [ ac_libbfd=$withval ],
7         [ ac_libbfd=NONE ]
8 )
9
10 AC_ARG_WITH(libiberty,
11         [ --with-libiberty=<file>  path to libiberty.a library to use ],
12         [ ac_libiberty=$withval ],
13         [ ac_libiberty=NONE ]
14 )
15
16 AC_ARG_WITH(bfd-include-dir,
17         [ --with-bfd-include-dir=<dir>  include path for correct bfd.h ],
18         [ ac_bfd_include_dir=$withval ],
19         [ ac_bfd_include_dir=NONE ]
20 )
21
22 AC_ARG_WITH(binutils-include-dir,
23         [ --with-binutils-include-dir=<dir>  include path for binutils headers ],
24         [ ac_binutils_include_dir=$withval ],
25         [ ac_binutils_include_dir=NONE ]
26 )
27
28 AC_ARG_WITH(binutils-ldscript-dir,
29         [ --with-binutils-ldscript-dir=<dir>  path to install elf2flt.ld ],
30         [ ac_binutils_ldscript_dir=$withval ],
31         [ ac_binutils_ldscript_dir=NONE ]
32 )
33
34 AC_ARG_ENABLE(got-check,
35         [ --disable-got-check - disable check for GOT (needed on H8) ],
36         [ got_check=$enableval ],
37         [ got_check=yes ]
38 )
39
40 AC_ARG_ENABLE(emit_relocs,
41         [ --disable-emit-relocs - don't use the --emit-relocs (-q) linker option ],
42         [ emit_relocs=$enableval ],
43         [ emit_relocs=yes ]
44 )
45
46 AC_CANONICAL_HOST
47 AC_CANONICAL_TARGET
48
49 dnl Checks for programs.
50 AC_PROG_CC
51 AC_PROG_INSTALL
52
53 dnl Checks for libraries.
54 if test "$ac_libiberty" = "NONE"; then
55   AC_CHECK_LIB(iberty, objalloc_create)
56   ac_libiberty=auto
57 else
58   LIBS="$ac_libiberty $LIBS"
59 fi
60 if test "$ac_libbfd" = "NONE"; then
61   AC_CHECK_LIB(bfd, bfd_openr)
62   ac_libbfd=auto
63 else
64   LIBS="$ac_libbfd $LIBS"
65 fi
66
67 bfd_include_dir=
68 if test "$ac_bfd_include_dir" != "NONE"; then
69   bfd_include_dir="-I$ac_bfd_include_dir"
70 fi
71
72 binutils_include_dir=
73 if test "$ac_binutils_include_dir" != "NONE"; then
74   binutils_include_dir="-I$ac_binutils_include_dir"
75 fi
76
77 binutils_ldscript_dir=
78 if test "$ac_binutils_ldscript_dir" = "NONE"; then
79   ac_binutils_ldscript_dir="\${TOOLDIR}/../${target_alias}/lib"
80 fi
81 binutils_ldscript_dir="$ac_binutils_ldscript_dir"
82
83 if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then
84         echo
85         echo "You need to specify the location of the libfd.a and libiberty.a"
86         echo "host libraries from the binutils package."
87         echo
88         echo "Run configure again specifying these options:"
89         echo
90         echo "  ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>"
91         echo
92         exit 1
93 fi
94
95 if test "$ac_bfd_include_dir" = "NONE" ; then
96         echo
97         echo "You need to specify the location of the bfd.h header from a"
98         echo "configured/compiled version of the binutils package for your target."
99         echo "Without this your elf2flt may crash as it will try to use the"
100         echo "systems bfd.h which may be from a different binutils package."
101         echo
102         echo "Run configure again specifying these options:"
103         echo
104         echo "  ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>"
105         echo
106         exit 1
107 fi
108
109 dnl Checks for header files.
110 AC_HEADER_STDC
111 AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h)
112
113 dnl Checks for typedefs, structures, and compiler characteristics.
114 AC_C_CONST
115
116 dnl Checks for library functions.
117 AC_FUNC_VPRINTF
118
119 AC_CHECK_FUNCS(dcgettext)
120
121 dnl Subsitute values
122 AC_SUBST(target)
123 AC_SUBST(target_alias)
124 AC_SUBST(target_cpu)
125 AC_SUBST(target_os)
126 AC_SUBST(target_vendor)
127 AC_SUBST(bfd_include_dir)
128 AC_SUBST(binutils_include_dir)
129 AC_SUBST(binutils_ldscript_dir)
130 AC_SUBST(got_check)
131 AC_SUBST(emit_relocs)
132
133 AC_OUTPUT(Makefile ld-elf2flt)
134