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 ],
61 dnl Checks for programs.
65 if test "$ac_binutils_build_dir" != "NONE"; then
66 test "$ac_libbfd" = "NONE" && ac_libbfd="$ac_binutils_build_dir/bfd/libbfd.a"
67 test "$ac_libiberty" = "NONE" && ac_libiberty="$ac_binutils_build_dir/libiberty/libiberty.a"
68 test "$ac_bfd_include_dir" = "NONE" && ac_bfd_include_dir="$ac_binutils_build_dir/bfd"
69 test "$ac_binutils_include_dir" = "NONE" && ac_binutils_include_dir="$ac_binutils_build_dir/include"
72 dnl Checks for libraries.
73 if test "$ac_libiberty" = "NONE"; then
74 AC_CHECK_LIB(iberty, objalloc_create)
77 LIBS="$ac_libiberty $LIBS"
79 if test "$ac_libbfd" = "NONE"; then
80 AC_CHECK_LIB(bfd, bfd_openr)
83 LIBS="$ac_libbfd $LIBS"
85 if test "$ac_zlib_prefix" = "NONE"; then
86 AC_CHECK_LIB(z, deflate)
88 LIBS="-L$ac_zlib_prefix/lib -lz $LIBS"
92 if test "$ac_bfd_include_dir" != "NONE"; then
93 bfd_include_dir="-I$ac_bfd_include_dir"
97 if test "$ac_binutils_include_dir" != "NONE"; then
98 binutils_include_dir="-I$ac_binutils_include_dir"
102 if test "$ac_zlib_prefix" != "NONE"; then
103 zlib_include_dir="-I$ac_zlib_prefix/include"
106 binutils_ldscript_dir=
107 if test "$ac_binutils_ldscript_dir" = "NONE"; then
108 ac_binutils_ldscript_dir="\${TOOLDIR}/../${target_alias}/lib"
110 binutils_ldscript_dir="$ac_binutils_ldscript_dir"
112 if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then
115 You need to specify the location of the libfd.a and libiberty.a
116 host libraries from the binutils package.
118 Run configure again specifying these options:
120 ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
124 if test "$ac_bfd_include_dir" = "NONE" ; then
127 You need to specify the location of the bfd.h header from a
128 configured/compiled version of the binutils package for your target.
129 Without this your elf2flt may crash as it will try to use the
130 systems bfd.h which may be from a different binutils package.
132 Run configure again specifying these options:
134 ./configure --target=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
138 dnl Checks for header files.
140 AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h)
142 dnl Checks for typedefs, structures, and compiler characteristics.
145 dnl Checks for library functions.
148 AC_CHECK_FUNCS(dcgettext libintl_dgettext)
152 AC_SUBST(target_alias)
155 AC_SUBST(target_vendor)
156 AC_SUBST(bfd_include_dir)
157 AC_SUBST(binutils_include_dir)
158 AC_SUBST(zlib_include_dir)
159 AC_SUBST(binutils_ldscript_dir)
161 AC_SUBST(emit_relocs)
163 AC_OUTPUT(Makefile ld-elf2flt)