OSDN Git Service

This patch is required to successfully link against libstdc++ on the Nios2
[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         AC_MSG_ERROR([
85
86 You need to specify the location of the libfd.a and libiberty.a
87 host libraries from the binutils package.
88         
89 Run configure again specifying these options:
90         
91   ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
92 ])
93 fi
94
95 if test "$ac_bfd_include_dir" = "NONE" ; then
96         AC_MSG_ERROR([
97
98 You need to specify the location of the bfd.h header from a
99 configured/compiled version of the binutils package for your target.
100 Without this your elf2flt may crash as it will try to use the
101 systems bfd.h which may be from a different binutils package.
102
103 Run configure again specifying these options:
104
105   ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
106 ])
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 libintl_dgettext)
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