1 dnl Process this file with autoconf to produce a configure script.
4 AC_ARG_WITH(zlib-prefix,
5 [ --with-zlib-prefix=<dir> path to installed zlib ],
6 [ ac_zlib_prefix=$withval ],
7 [ ac_zlib_prefix=NONE ]
11 [ --with-libbfd=<file> path to libbfd.a library to use ],
12 [ ac_libbfd=$withval ],
16 AC_ARG_WITH(libiberty,
17 [ --with-libiberty=<file> path to libiberty.a library to use ],
18 [ ac_libiberty=$withval ],
22 AC_ARG_WITH(bfd-include-dir,
23 [ --with-bfd-include-dir=<dir> include path for correct bfd.h ],
24 [ ac_bfd_include_dir=$withval ],
25 [ ac_bfd_include_dir=NONE ]
28 AC_ARG_WITH(binutils-include-dir,
29 [ --with-binutils-include-dir=<dir> include path for binutils headers ],
30 [ ac_binutils_include_dir=$withval ],
31 [ ac_binutils_include_dir=NONE ]
34 AC_ARG_WITH(binutils-ldscript-dir,
35 [ --with-binutils-ldscript-dir=<dir> path to install elf2flt.ld ],
36 [ ac_binutils_ldscript_dir=$withval ],
37 [ ac_binutils_ldscript_dir=NONE ]
40 AC_ARG_WITH(binutils-build-dir,
41 [ --with-binutils-build-dir=<dir> path to compiled binutils tree ],
42 [ ac_binutils_build_dir=$withval ],
43 [ ac_binutils_build_dir=NONE ]
46 AC_ARG_ENABLE(got-check,
47 [ --disable-got-check - disable check for GOT (needed on H8) ],
48 [ got_check=$enableval ],
52 AC_ARG_ENABLE(emit_relocs,
53 [ --disable-emit-relocs - don't use the --emit-relocs (-q) linker option ],
54 [ emit_relocs=$enableval ],
58 AC_ARG_ENABLE(emit_ctor_dtor,
59 AS_HELP_STRING([--enable-emit-ctor-dtor], [manually create ctor/dtor list]),
60 [ emit_ctor_dtor=$enableval ],
67 dnl Checks for programs.
71 if test "$ac_binutils_build_dir" != "NONE"; then
72 test "$ac_libbfd" = "NONE" && ac_libbfd="$ac_binutils_build_dir/bfd/libbfd.a"
73 test "$ac_libiberty" = "NONE" && ac_libiberty="$ac_binutils_build_dir/libiberty/libiberty.a"
74 test "$ac_bfd_include_dir" = "NONE" && ac_bfd_include_dir="$ac_binutils_build_dir/bfd"
75 test "$ac_binutils_include_dir" = "NONE" && ac_binutils_include_dir="$ac_binutils_build_dir/include"
78 dnl Checks for libraries.
79 if test "$ac_libiberty" = "NONE"; then
80 AC_CHECK_LIB(iberty, objalloc_create)
83 LIBS="$ac_libiberty $LIBS"
85 if test "$ac_libbfd" = "NONE"; then
86 AC_CHECK_LIB(bfd, bfd_openr)
89 LIBS="$ac_libbfd $LIBS"
91 if test "$ac_zlib_prefix" = "NONE"; then
92 AC_CHECK_LIB(z, deflate)
94 LIBS="-L$ac_zlib_prefix/lib -lz $LIBS"
98 if test "$ac_bfd_include_dir" != "NONE"; then
99 bfd_include_dir="-I$ac_bfd_include_dir"
102 binutils_include_dir=
103 if test "$ac_binutils_include_dir" != "NONE"; then
104 binutils_include_dir="-I$ac_binutils_include_dir"
108 if test "$ac_zlib_prefix" != "NONE"; then
109 zlib_include_dir="-I$ac_zlib_prefix/include"
112 binutils_ldscript_dir=
113 if test "$ac_binutils_ldscript_dir" = "NONE"; then
114 ac_binutils_ldscript_dir="\${TOOLDIR}/../${target_alias}/lib"
116 binutils_ldscript_dir="$ac_binutils_ldscript_dir"
118 if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then
121 You need to specify the location of the libfd.a and libiberty.a
122 host libraries from the binutils package.
124 Run configure again specifying these options:
126 ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
130 if test "$ac_bfd_include_dir" = "NONE" ; then
133 You need to specify the location of the bfd.h header from a
134 configured/compiled version of the binutils package for your target.
135 Without this your elf2flt may crash as it will try to use the
136 systems bfd.h which may be from a different binutils package.
138 Run configure again specifying these options:
140 ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
151 dnl Make sure we resolve system symbols before libiberty/libbfd ones.
152 dnl Otherwise, things like getopt get screwed up because the system headers
153 dnl redirect some functions to the system symbols, but other local symbols
154 dnl come from libiberty/libbfd.
155 dnl int getopt(int, char * const [], const char *) __asm("_" "getopt" "$UNIX2003");
156 AC_CHECK_LIB(c, malloc, LIBS="-lc $LIBS")
158 dnl Checks for header files.
160 AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h)
162 dnl Checks for typedefs, structures, and compiler characteristics.
165 dnl Checks for library functions.
168 AC_CHECK_FUNCS(dcgettext libintl_dgettext)
172 AC_SUBST(target_alias)
175 AC_SUBST(target_vendor)
176 AC_SUBST(bfd_include_dir)
177 AC_SUBST(binutils_include_dir)
178 AC_SUBST(zlib_include_dir)
179 AC_SUBST(binutils_ldscript_dir)
181 AC_SUBST(emit_relocs)
182 AC_SUBST(emit_ctor_dtor)
183 AC_SUBST(SYMBOL_PREFIX)
185 AC_OUTPUT(Makefile ld-elf2flt elf2flt.ld)