X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=configure.in;h=e18e41cab24805ce463e0ee2ea1638238d8cc427;hb=bc99aad17cf56721b03e8ad185b7121e679a7179;hp=a8a176296689bb2c99407a8c2658a4e34b655d68;hpb=72195bfee8cee38b1e235ffe930786e9b6d0f201;p=uclinux-h8%2Felf2flt.git diff --git a/configure.in b/configure.in index a8a1762..e18e41c 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,12 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(elf2flt.c) +AC_ARG_WITH(zlib-prefix, + [ --with-zlib-prefix= path to installed zlib ], + [ ac_zlib_prefix=$withval ], + [ ac_zlib_prefix=NONE ] +) + AC_ARG_WITH(libbfd, [ --with-libbfd= path to libbfd.a library to use ], [ ac_libbfd=$withval ], @@ -19,6 +25,42 @@ AC_ARG_WITH(bfd-include-dir, [ ac_bfd_include_dir=NONE ] ) +AC_ARG_WITH(binutils-include-dir, + [ --with-binutils-include-dir= include path for binutils headers ], + [ ac_binutils_include_dir=$withval ], + [ ac_binutils_include_dir=NONE ] +) + +AC_ARG_WITH(binutils-ldscript-dir, + [ --with-binutils-ldscript-dir= path to install elf2flt.ld ], + [ ac_binutils_ldscript_dir=$withval ], + [ ac_binutils_ldscript_dir=NONE ] +) + +AC_ARG_WITH(binutils-build-dir, + [ --with-binutils-build-dir= path to compiled binutils tree ], + [ ac_binutils_build_dir=$withval ], + [ ac_binutils_build_dir=NONE ] +) + +AC_ARG_ENABLE(got-check, + [ --disable-got-check - disable check for GOT (needed on H8) ], + [ got_check=$enableval ], + [ got_check=yes ] +) + +AC_ARG_ENABLE(emit_relocs, + [ --disable-emit-relocs - don't use the --emit-relocs (-q) linker option ], + [ emit_relocs=$enableval ], + [ emit_relocs=yes ] +) + +AC_ARG_ENABLE(emit_ctor_dtor, + AS_HELP_STRING([--enable-emit-ctor-dtor], [manually create ctor/dtor list]), + [ emit_ctor_dtor=$enableval ], + [ emit_ctor_dtor=no ] +) + AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -26,6 +68,13 @@ dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL +if test "$ac_binutils_build_dir" != "NONE"; then + test "$ac_libbfd" = "NONE" && ac_libbfd="$ac_binutils_build_dir/bfd/libbfd.a" + test "$ac_libiberty" = "NONE" && ac_libiberty="$ac_binutils_build_dir/libiberty/libiberty.a" + test "$ac_bfd_include_dir" = "NONE" && ac_bfd_include_dir="$ac_binutils_build_dir/bfd" + test "$ac_binutils_include_dir" = "NONE" && ac_binutils_include_dir="$ac_binutils_build_dir/include" +fi + dnl Checks for libraries. if test "$ac_libiberty" = "NONE"; then AC_CHECK_LIB(iberty, objalloc_create) @@ -39,38 +88,73 @@ if test "$ac_libbfd" = "NONE"; then else LIBS="$ac_libbfd $LIBS" fi +if test "$ac_zlib_prefix" = "NONE"; then + AC_CHECK_LIB(z, deflate) +else + LIBS="-L$ac_zlib_prefix/lib -lz $LIBS" +fi bfd_include_dir= if test "$ac_bfd_include_dir" != "NONE"; then bfd_include_dir="-I$ac_bfd_include_dir" fi +binutils_include_dir= +if test "$ac_binutils_include_dir" != "NONE"; then + binutils_include_dir="-I$ac_binutils_include_dir" +fi + +zlib_include_dir= +if test "$ac_zlib_prefix" != "NONE"; then + zlib_include_dir="-I$ac_zlib_prefix/include" +fi + +binutils_ldscript_dir= +if test "$ac_binutils_ldscript_dir" = "NONE"; then + ac_binutils_ldscript_dir="\${TOOLDIR}/../${target_alias}/lib" +fi +binutils_ldscript_dir="$ac_binutils_ldscript_dir" + if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then - echo - echo "You need to specify the location of the libfd.a and libiberty.a" - echo "host libraries from the binutils package." - echo - echo "Run configure again specifying these options:" - echo - echo " ./configure --target= --with-bfd-include-dir= --with-libbfd= --with-libiberty=" - echo - exit 1 + AC_MSG_ERROR([ + +You need to specify the location of the libfd.a and libiberty.a +host libraries from the binutils package. + +Run configure again specifying these options: + + ./configure --target= --with-bfd-include-dir= --with-libbfd= --with-libiberty= +]) fi if test "$ac_bfd_include_dir" = "NONE" ; then - echo - echo "You need to specify the location of the bfd.h header from a" - echo "configured/compiled version of the binutils package for your target." - echo "Without this your elf2flt may crash as it will try to use the" - echo "systems bfd.h which may be from a different binutils package." - echo - echo "Run configure again specifying these options:" - echo - echo " ./configure --target= --with-bfd-include-dir= --with-libbfd= --with-libiberty=" - echo - exit 1 + AC_MSG_ERROR([ + +You need to specify the location of the bfd.h header from a +configured/compiled version of the binutils package for your target. +Without this your elf2flt may crash as it will try to use the +systems bfd.h which may be from a different binutils package. + +Run configure again specifying these options: + + ./configure --target= --with-bfd-include-dir= --with-libbfd= --with-libiberty= +]) fi +SYMBOL_PREFIX= +case $target in + bfin*) + SYMBOL_PREFIX=_ + ;; +esac + +dnl Make sure we resolve system symbols before libiberty/libbfd ones. +dnl Otherwise, things like getopt get screwed up because the system headers +dnl redirect some functions to the system symbols, but other local symbols +dnl come from libiberty/libbfd. +dnl int getopt(int, char * const [], const char *) __asm("_" "getopt" "$UNIX2003"); +AC_CHECK_LIB(c, malloc, LIBS="-lc $LIBS") + dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h) @@ -81,6 +165,8 @@ AC_C_CONST dnl Checks for library functions. AC_FUNC_VPRINTF +AC_CHECK_FUNCS(dcgettext libintl_dgettext) + dnl Subsitute values AC_SUBST(target) AC_SUBST(target_alias) @@ -88,6 +174,13 @@ AC_SUBST(target_cpu) AC_SUBST(target_os) AC_SUBST(target_vendor) AC_SUBST(bfd_include_dir) +AC_SUBST(binutils_include_dir) +AC_SUBST(zlib_include_dir) +AC_SUBST(binutils_ldscript_dir) +AC_SUBST(got_check) +AC_SUBST(emit_relocs) +AC_SUBST(emit_ctor_dtor) +AC_SUBST(SYMBOL_PREFIX) -AC_OUTPUT(Makefile) +AC_OUTPUT(Makefile ld-elf2flt elf2flt.ld)