summaryrefslogtreecommitdiffstats
path: root/toolchain/elf2flt/elf2flt/configure.in
blob: 73443c6a3be27a08bb87c13eef274046066b44dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
dnl Process this file with autoconf to produce a configure script.
AC_INIT(elf2flt.c)

AC_ARG_WITH(libbfd,
	[ --with-libbfd=<file>  path to libbfd.a library to use ],
	[ ac_libbfd=$withval ],
	[ ac_libbfd=NONE ]
)

AC_ARG_WITH(libiberty,
	[ --with-libiberty=<file>  path to libiberty.a library to use ],
	[ ac_libiberty=$withval ],
	[ ac_libiberty=NONE ]
)

AC_ARG_WITH(bfd-include-dir,
	[ --with-bfd-include-dir=<dir>  include path for correct bfd.h ],
	[ ac_bfd_include_dir=$withval ],
	[ ac_bfd_include_dir=NONE ]
)

AC_ARG_WITH(binutils-include-dir,
	[ --with-binutils-include-dir=<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=<dir>  path to install elf2flt.ld ],
	[ ac_binutils_ldscript_dir=$withval ],
	[ ac_binutils_ldscript_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_CANONICAL_HOST
AC_CANONICAL_TARGET

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL

dnl Checks for libraries.
if test "$ac_libiberty" = "NONE"; then
  AC_CHECK_LIB(iberty, objalloc_create)
  ac_libiberty=auto
else
  LIBS="$ac_libiberty $LIBS"
fi
if test "$ac_libbfd" = "NONE"; then
  AC_CHECK_LIB(bfd, bfd_openr)
  ac_libbfd=auto
else
  LIBS="$ac_libbfd $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

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
	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=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
])
fi

if test "$ac_bfd_include_dir" = "NONE" ; then
	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=<ARCH> --with-bfd-include-dir=<dir> --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>
])
fi

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl Checks for library functions.
AC_FUNC_VPRINTF

AC_CHECK_FUNCS(dcgettext)

dnl Subsitute values
AC_SUBST(target)
AC_SUBST(target_alias)
AC_SUBST(target_cpu)
AC_SUBST(target_os)
AC_SUBST(target_vendor)
AC_SUBST(bfd_include_dir)
AC_SUBST(binutils_include_dir)
AC_SUBST(binutils_ldscript_dir)
AC_SUBST(got_check)
AC_SUBST(emit_relocs)

AC_OUTPUT(Makefile ld-elf2flt)