| 445 |
theseven |
1 |
dnl Process this file with autoconf to produce a configure script.
|
| 450 |
theseven |
2 |
AC_INIT(elf2emcoreapp.c)
|
| 445 |
theseven |
3 |
|
|
|
4 |
AC_ARG_WITH(zlib-prefix,
|
|
|
5 |
AS_HELP_STRING([--with-zlib-prefix=<dir>], [path to installed zlib]),
|
|
|
6 |
[ ac_zlib_prefix=$withval ],
|
|
|
7 |
[ ac_zlib_prefix=NONE ]
|
|
|
8 |
)
|
|
|
9 |
|
|
|
10 |
AC_ARG_WITH(libbfd,
|
|
|
11 |
AS_HELP_STRING([--with-libbfd=<file>], [path to libbfd.a library to use]),
|
|
|
12 |
[ ac_libbfd=$withval ],
|
|
|
13 |
[ ac_libbfd=NONE ]
|
|
|
14 |
)
|
|
|
15 |
|
|
|
16 |
AC_ARG_WITH(libiberty,
|
|
|
17 |
AS_HELP_STRING([--with-libiberty=<file>], [path to libiberty.a library to use]),
|
|
|
18 |
[ ac_libiberty=$withval ],
|
|
|
19 |
[ ac_libiberty=NONE ]
|
|
|
20 |
)
|
|
|
21 |
|
|
|
22 |
AC_ARG_WITH(bfd-include-dir,
|
|
|
23 |
AS_HELP_STRING([--with-bfd-include-dir=<dir>], [include path for correct bfd.h]),
|
|
|
24 |
[ ac_bfd_include_dir=$withval ],
|
|
|
25 |
[ ac_bfd_include_dir=NONE ]
|
|
|
26 |
)
|
|
|
27 |
|
|
|
28 |
AC_ARG_WITH(binutils-include-dir,
|
|
|
29 |
AS_HELP_STRING([--with-binutils-include-dir=<dir>], [include path for binutils headers]),
|
|
|
30 |
[ ac_binutils_include_dir=$withval ],
|
|
|
31 |
[ ac_binutils_include_dir=NONE ]
|
|
|
32 |
)
|
|
|
33 |
|
|
|
34 |
AC_ARG_WITH(binutils-build-dir,
|
|
|
35 |
AS_HELP_STRING([--with-binutils-build-dir=<dir>], [path to compiled binutils tree]),
|
|
|
36 |
[ ac_binutils_build_dir=$withval ],
|
|
|
37 |
[ ac_binutils_build_dir=NONE ]
|
|
|
38 |
)
|
|
|
39 |
|
|
|
40 |
dnl convert a yes/no variable to 1/0 for C code
|
|
|
41 |
var_yn_to_10() {
|
|
|
42 |
if eval test \"\$$1\" = yes ; then
|
|
|
43 |
eval $1=1
|
|
|
44 |
else
|
|
|
45 |
eval $1=0
|
|
|
46 |
fi
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
AC_ARG_ENABLE(got-check,
|
|
|
50 |
AS_HELP_STRING([--disable-got-check], [disable check for GOT (needed on H8)]),
|
|
|
51 |
[ got_check=$enableval ],
|
|
|
52 |
[ got_check=yes ]
|
|
|
53 |
)
|
|
|
54 |
var_yn_to_10 got_check
|
|
|
55 |
|
|
|
56 |
AC_ARG_ENABLE(emit-relocs,
|
|
|
57 |
AS_HELP_STRING([--disable-emit-relocs], [don't use the --emit-relocs (-q) linker option]),
|
|
|
58 |
[ emit_relocs=$enableval ],
|
|
|
59 |
[ emit_relocs=yes ]
|
|
|
60 |
)
|
|
|
61 |
var_yn_to_10 emit_relocs
|
|
|
62 |
|
|
|
63 |
AC_ARG_ENABLE(emit-ctor-dtor,
|
|
|
64 |
AS_HELP_STRING([--enable-emit-ctor-dtor], [manually create ctor/dtor list]),
|
|
|
65 |
[ emit_ctor_dtor=$enableval ],
|
|
|
66 |
[ emit_ctor_dtor=no ]
|
|
|
67 |
)
|
|
|
68 |
var_yn_to_10 emit_ctor_dtor
|
|
|
69 |
|
|
|
70 |
AC_ARG_ENABLE(always-reloc-text,
|
|
|
71 |
AS_HELP_STRING([--enable-always-reloc-text], [always process text relocs ignoring pic/got (needed on Blackfin)]),
|
|
|
72 |
[ always_reloc_text=$enableval ],
|
|
|
73 |
[
|
|
|
74 |
case $target in
|
|
|
75 |
bfin*) always_reloc_text=yes;;
|
|
|
76 |
*) always_reloc_text=no;;
|
|
|
77 |
esac
|
|
|
78 |
]
|
|
|
79 |
)
|
|
|
80 |
var_yn_to_10 always_reloc_text
|
|
|
81 |
|
|
|
82 |
AC_CANONICAL_HOST
|
|
|
83 |
AC_CANONICAL_TARGET
|
|
|
84 |
|
|
|
85 |
dnl Checks for programs.
|
|
|
86 |
AC_PROG_CC
|
|
|
87 |
AC_USE_SYSTEM_EXTENSIONS
|
|
|
88 |
AC_PROG_INSTALL
|
|
|
89 |
|
|
|
90 |
if test "$ac_binutils_build_dir" != "NONE"; then
|
|
|
91 |
test "$ac_libbfd" = "NONE" && ac_libbfd="$ac_binutils_build_dir/bfd/libbfd.a"
|
|
|
92 |
test "$ac_libiberty" = "NONE" && ac_libiberty="$ac_binutils_build_dir/libiberty/libiberty.a"
|
|
|
93 |
test "$ac_bfd_include_dir" = "NONE" && ac_bfd_include_dir="$ac_binutils_build_dir/bfd"
|
|
|
94 |
test "$ac_binutils_include_dir" = "NONE" && ac_binutils_include_dir="$ac_binutils_build_dir/include"
|
|
|
95 |
fi
|
|
|
96 |
|
|
|
97 |
dnl Checks for libraries.
|
|
|
98 |
if test "$ac_libiberty" = "NONE"; then
|
|
|
99 |
AC_CHECK_LIB(iberty, objalloc_create)
|
|
|
100 |
ac_libiberty=auto
|
|
|
101 |
else
|
|
|
102 |
LIBS="$ac_libiberty $LIBS"
|
|
|
103 |
fi
|
|
|
104 |
if test "$ac_libbfd" = "NONE"; then
|
|
|
105 |
AC_CHECK_LIB(bfd, bfd_openr)
|
|
|
106 |
ac_libbfd=auto
|
|
|
107 |
else
|
|
|
108 |
LIBS="$ac_libbfd $LIBS"
|
|
|
109 |
fi
|
|
|
110 |
if test "$ac_zlib_prefix" = "NONE"; then
|
|
|
111 |
AC_CHECK_LIB(z, deflate)
|
|
|
112 |
else
|
|
|
113 |
LIBS="-L$ac_zlib_prefix/lib -lz $LIBS"
|
|
|
114 |
fi
|
|
|
115 |
|
|
|
116 |
bfd_include_dir=
|
|
|
117 |
if test "$ac_bfd_include_dir" != "NONE"; then
|
|
|
118 |
bfd_include_dir="-I$ac_bfd_include_dir"
|
|
|
119 |
fi
|
|
|
120 |
|
|
|
121 |
binutils_include_dir=
|
|
|
122 |
if test "$ac_binutils_include_dir" != "NONE"; then
|
|
|
123 |
binutils_include_dir="-I$ac_binutils_include_dir"
|
|
|
124 |
fi
|
|
|
125 |
|
|
|
126 |
if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then
|
|
|
127 |
AC_MSG_ERROR([
|
|
|
128 |
|
|
|
129 |
You need to specify the location of the libfd.a and libiberty.a
|
|
|
130 |
host libraries from the binutils package.
|
|
|
131 |
|
|
|
132 |
Run configure again specifying these options:
|
|
|
133 |
|
|
|
134 |
./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
|
|
|
135 |
])
|
|
|
136 |
fi
|
|
|
137 |
|
|
|
138 |
if test "$ac_bfd_include_dir" = "NONE" ; then
|
|
|
139 |
AC_MSG_ERROR([
|
|
|
140 |
|
|
|
141 |
You need to specify the location of the bfd.h header from a
|
|
|
142 |
configured/compiled version of the binutils package for your target.
|
| 450 |
theseven |
143 |
Without this your elf2emcoreapp may crash as it will try to use the
|
| 445 |
theseven |
144 |
systems bfd.h which may be from a different binutils package.
|
|
|
145 |
|
|
|
146 |
Run configure again specifying these options:
|
|
|
147 |
|
|
|
148 |
./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
|
|
|
149 |
])
|
|
|
150 |
fi
|
|
|
151 |
|
|
|
152 |
SYMBOL_PREFIX=
|
|
|
153 |
case $target in
|
|
|
154 |
h8300|bfin*)
|
|
|
155 |
SYMBOL_PREFIX=_
|
|
|
156 |
;;
|
|
|
157 |
esac
|
|
|
158 |
|
|
|
159 |
dnl Make sure we resolve system symbols before libiberty/libbfd ones.
|
|
|
160 |
dnl Otherwise, things like getopt get screwed up because the system headers
|
|
|
161 |
dnl redirect some functions to the system symbols, but other local symbols
|
|
|
162 |
dnl come from libiberty/libbfd.
|
|
|
163 |
dnl int getopt(int, char * const [], const char *) __asm("_" "getopt" "$UNIX2003");
|
|
|
164 |
AC_CHECK_LIB(c, malloc, LIBS="-lc $LIBS")
|
|
|
165 |
|
|
|
166 |
dnl Checks for header files.
|
|
|
167 |
AC_HEADER_STDC
|
|
|
168 |
AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h)
|
|
|
169 |
|
|
|
170 |
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
171 |
AC_C_CONST
|
|
|
172 |
|
|
|
173 |
dnl Checks for library functions.
|
|
|
174 |
AC_FUNC_VPRINTF
|
|
|
175 |
|
|
|
176 |
AC_CHECK_FUNCS([ \
|
|
|
177 |
dcgettext \
|
|
|
178 |
getline \
|
|
|
179 |
libintl_dgettext \
|
|
|
180 |
strsignal \
|
|
|
181 |
])
|
|
|
182 |
|
|
|
183 |
test "$GCC" = yes && CFLAGS="-Wall $CFLAGS"
|
|
|
184 |
|
|
|
185 |
dnl Subsitute values
|
|
|
186 |
AC_SUBST(target)
|
|
|
187 |
AC_SUBST(target_alias)
|
|
|
188 |
AC_SUBST(target_cpu)
|
|
|
189 |
AC_SUBST(target_os)
|
|
|
190 |
AC_SUBST(target_vendor)
|
|
|
191 |
AC_SUBST(bfd_include_dir)
|
|
|
192 |
AC_SUBST(binutils_include_dir)
|
|
|
193 |
AC_SUBST(zlib_include_dir)
|
|
|
194 |
AC_SUBST(binutils_ldscript_dir)
|
|
|
195 |
AC_SUBST(use_ld_elf2flt_binary)
|
|
|
196 |
AC_SUBST(got_check)
|
|
|
197 |
AC_SUBST(emit_relocs)
|
|
|
198 |
AC_SUBST(emit_ctor_dtor)
|
|
|
199 |
AC_SUBST(always_reloc_text)
|
|
|
200 |
AC_SUBST(SYMBOL_PREFIX)
|
|
|
201 |
|
| 450 |
theseven |
202 |
AC_OUTPUT(Makefile)
|
| 445 |
theseven |
203 |
|