133965Sjdpdnl Process this file with autoconf to produce a configure script
233965Sjdpdnl
3218822SdimAC_PREREQ(2.57)
433965SjdpAC_INIT(ldmain.c)
533965Sjdp
638889SjdpAC_CANONICAL_SYSTEM
777298SobrienAC_ISC_POSIX
838889Sjdp
978828Sobrienchangequote(,)dnl
1078828SobrienBFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ 	]*\([^ 	]*\)[ 	]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
1178828Sobrienchangequote([,])dnl
1278828SobrienAM_INIT_AUTOMAKE(ld, ${BFD_VERSION})
1338889Sjdp
1438889SjdpAM_PROG_LIBTOOL
1538889Sjdp
16130561SobrienAC_ARG_WITH(lib-path, [  --with-lib-path=dir1:dir2...  set default LIB_PATH],LIB_PATH=$withval)
1733965SjdpAC_ARG_ENABLE(targets,
1833965Sjdp[  --enable-targets        alternative target configurations],
1933965Sjdp[case "${enableval}" in
2033965Sjdp  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
2133965Sjdp            ;;
2233965Sjdp  no)       enable_targets= ;;
2333965Sjdp  *)        enable_targets=$enableval ;;
2433965Sjdpesac])dnl
2533965SjdpAC_ARG_ENABLE(64-bit-bfd,
2633965Sjdp[  --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)],
2733965Sjdp[case "${enableval}" in
2833965Sjdp  yes)  want64=true  ;;
2933965Sjdp  no)   want64=false ;;
3033965Sjdp  *)    AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
3133965Sjdpesac],[want64=false])dnl
3233965Sjdp
33130561SobrienAC_ARG_WITH(sysroot,
34130561Sobrien[  --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
35130561Sobrien[
36130561Sobrien case ${with_sysroot} in
37130561Sobrien yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
38130561Sobrien *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
39130561Sobrien esac
40130561Sobrien
41130561Sobrien TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
42130561Sobrien use_sysroot=yes
43130561Sobrien
44218822Sdim if test "x$prefix" = xNONE; then
45218822Sdim  test_prefix=/usr/local
46218822Sdim else
47218822Sdim  test_prefix=$prefix
48218822Sdim fi
49130561Sobrien if test "x$exec_prefix" = xNONE; then
50218822Sdim  test_exec_prefix=$test_prefix
51130561Sobrien else
52218822Sdim  test_exec_prefix=$exec_prefix
53130561Sobrien fi
54130561Sobrien case ${TARGET_SYSTEM_ROOT} in
55130561Sobrien "${test_prefix}"|"${test_prefix}/"*|\
56218822Sdim "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
57218822Sdim '${prefix}'|'${prefix}/'*|\
58130561Sobrien '${exec_prefix}'|'${exec_prefix}/'*)
59130561Sobrien   t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
60130561Sobrien   TARGET_SYSTEM_ROOT_DEFINE="$t"
61130561Sobrien   ;;
62130561Sobrien esac
63130561Sobrien], [
64130561Sobrien use_sysroot=no
65130561Sobrien TARGET_SYSTEM_ROOT=
66130561Sobrien TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
67130561Sobrien])
68130561SobrienAC_SUBST(use_sysroot)
69130561SobrienAC_SUBST(TARGET_SYSTEM_ROOT)
70130561SobrienAC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
71130561Sobrien
72218822SdimAM_BINUTILS_WARNINGS
7377298Sobrien
7438889SjdpAM_CONFIG_HEADER(config.h:config.in)
7533965Sjdp
7633965Sjdpif test -z "$target" ; then
7733965Sjdp    AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
7833965Sjdpfi
7933965Sjdpif test -z "$host" ; then
8033965Sjdp    AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
8133965Sjdpfi
8233965Sjdp
8333965Sjdp# host-specific stuff:
8433965Sjdp
8533965SjdpAC_PROG_CC
8660484SobrienAC_PROG_INSTALL
8733965Sjdp
88218822SdimALL_LINGUAS="fr sv tr es da vi zh_CN zh_TW ga"
89218822SdimZW_GNU_GETTEXT_SISTER_DIR
90218822SdimAM_PO_SUBDIRS
9160484Sobrien
9260484SobrienAC_EXEEXT
9360484Sobrien
9438889SjdpAC_PROG_YACC
9560484SobrienAM_PROG_LEX
9638889Sjdp
9738889SjdpAM_MAINTAINER_MODE
98218822SdimAM_CONDITIONAL(GENINSRC_NEVER, false)
9938889Sjdp
10033965Sjdp. ${srcdir}/configure.host
10133965Sjdp
10233965SjdpAC_SUBST(HDEFINES)
10333965SjdpAC_SUBST(HOSTING_CRT0)
10433965SjdpAC_SUBST(HOSTING_LIBS)
10533965SjdpAC_SUBST(NATIVE_LIB_DIRS)
10633965Sjdp
107218822SdimAC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h elf-hints.h limits.h sys/param.h)
108218822SdimAC_CHECK_FUNCS(glob mkstemp realpath sbrk waitpid)
10933965SjdpAC_HEADER_DIRENT
11033965Sjdp
111218822SdimAC_MSG_CHECKING(for a known getopt prototype in unistd.h)
112218822SdimAC_CACHE_VAL(ld_cv_decl_getopt_unistd_h,
113218822Sdim[AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
114218822Sdimld_cv_decl_getopt_unistd_h=yes, ld_cv_decl_getopt_unistd_h=no)])
115218822SdimAC_MSG_RESULT($ld_cv_decl_getopt_unistd_h)
116218822Sdimif test $ld_cv_decl_getopt_unistd_h = yes; then
117218822Sdim  AC_DEFINE([HAVE_DECL_GETOPT], 1,
118218822Sdim	    [Is the prototype for getopt in <unistd.h> in the expected format?])
119218822Sdimfi
120218822Sdim	
12133965SjdpBFD_BINARY_FOPEN
12233965Sjdp
123218822SdimAC_CHECK_DECLS([strstr, free, sbrk, getenv, environ])
12433965Sjdp
12560484Sobrien# When converting linker scripts into strings for use in emulation
12660484Sobrien# files, use astring.sed if the compiler supports ANSI string
12760484Sobrien# concatenation, or ostring.sed otherwise.  This is to support the
12860484Sobrien# broken Microsoft MSVC compiler, which limits the length of string
12960484Sobrien# constants, while still supporting pre-ANSI compilers which do not
13060484Sobrien# support string concatenation.
13160484SobrienAC_MSG_CHECKING([whether ANSI C string concatenation works])
13260484SobrienAC_CACHE_VAL(ld_cv_string_concatenation,
13360484Sobrien[AC_TRY_COMPILE(,[char *a = "a" "a";],
13460484Sobrien  [ld_cv_string_concatenation=yes],
13560484Sobrien  [ld_cv_string_concatenation=no])])
13660484SobrienAC_MSG_RESULT($ld_cv_string_concatenation)
13760484Sobrienif test "$ld_cv_string_concatenation" = "yes"; then
13860484Sobrien  STRINGIFY=astring.sed
13960484Sobrienelse
14060484Sobrien  STRINGIFY=ostring.sed
14160484Sobrienfi
14260484SobrienAC_SUBST(STRINGIFY)
14360484Sobrien
14433965Sjdp# target-specific stuff:
14533965Sjdp
14633965Sjdpall_targets=
14733965SjdpEMUL=
14833965Sjdpall_emuls=
14960484Sobrienall_emul_extras=
15060484Sobrienall_libpath=
15133965Sjdp
15260484Sobriendnl We need to get an arbitrary number of tdir definitions into
15360484Sobriendnl Makefile.  We can't do it using AC_SUBST, because autoconf does
15460484Sobriendnl not permit literal newlines in an AC_SUBST variables.  So we use a
15560484Sobriendnl file.
15660484Sobrienrm -f tdirs
15760484Sobrien
15833965Sjdpfor targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
15933965Sjdpdo
16033965Sjdp  if test "$targ_alias" = "all"; then
16133965Sjdp    all_targets=true
16233965Sjdp  else
16333965Sjdp    # Canonicalize the secondary target names.
16460484Sobrien    result=`$ac_config_sub $targ_alias 2>/dev/null`
16533965Sjdp    if test -n "$result"; then
16633965Sjdp	targ=$result
16733965Sjdp    else
16833965Sjdp	targ=$targ_alias
16933965Sjdp    fi
17033965Sjdp
17133965Sjdp    . ${srcdir}/configure.tgt
17233965Sjdp
17333965Sjdp    if test "$targ" = "$target"; then
17433965Sjdp      EMUL=$targ_emul
17533965Sjdp    fi
17633965Sjdp
177218822Sdim    if test x${want64} = xfalse; then
178218822Sdim      . ${srcdir}/../bfd/config.bfd
179218822Sdim    fi
180218822Sdim
181218822Sdim    if test x${want64} = xtrue; then
182218822Sdim      targ_extra_emuls="$targ_extra_emuls $targ64_extra_emuls"
183218822Sdim      targ_extra_libpath="$targ_extra_libpath $targ64_extra_libpath"
184218822Sdim    fi
185218822Sdim
18660484Sobrien    for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do
18733965Sjdp	case " $all_emuls " in
18833965Sjdp	*" e${i}.o "*) ;;
18933965Sjdp	*)
19033965Sjdp	  all_emuls="$all_emuls e${i}.o"
19133965Sjdp	  eval result=\$tdir_$i
19233965Sjdp	  test -z "$result" && result=$targ_alias
19360484Sobrien	  echo tdir_$i=$result >> tdirs
19433965Sjdp	  ;;
19533965Sjdp	esac
19633965Sjdp    done
19760484Sobrien
19860484Sobrien    for i in $targ_emul $targ_extra_libpath; do
19960484Sobrien	case " $all_libpath " in
20060484Sobrien	*" ${i} "*) ;;
20160484Sobrien	*)
20260484Sobrien	  if test -z "$all_libpath"; then
20360484Sobrien	    all_libpath=${i}
20460484Sobrien	  else
20560484Sobrien	    all_libpath="$all_libpath ${i}"
20660484Sobrien	  fi
20760484Sobrien	  ;;
20860484Sobrien	esac
20960484Sobrien    done
21060484Sobrien
21160484Sobrien    for i in $targ_extra_ofiles; do
21260484Sobrien	case " $all_emul_extras " in
21360484Sobrien	*" ${i} "*) ;;
21460484Sobrien	*)
21560484Sobrien	  all_emul_extras="$all_emul_extras ${i}"
21660484Sobrien	  ;;
21760484Sobrien	esac
21860484Sobrien    done
21933965Sjdp  fi
22033965Sjdpdone
22133965Sjdp
22233965SjdpAC_SUBST(EMUL)
22333965Sjdp
22460484SobrienTDIRS=tdirs
22560484SobrienAC_SUBST_FILE(TDIRS)
22660484Sobrien
22733965Sjdpif test x${all_targets} = xtrue; then
228218822Sdim  if test x${want64} = xfalse; then
229218822Sdim    AC_CHECK_SIZEOF(long)
230218822Sdim    if test "x${ac_cv_sizeof_long}" = "x8"; then
231218822Sdim      want64=true
232218822Sdim    fi
233218822Sdim  fi
23433965Sjdp  if test x${want64} = xtrue; then
23533965Sjdp    EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)'
23633965Sjdp  else
23733965Sjdp    EMULATION_OFILES='$(ALL_EMULATIONS)'
23833965Sjdp  fi
23960484Sobrien  EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)'
24033965Sjdpelse
24133965Sjdp  EMULATION_OFILES=$all_emuls
24260484Sobrien  EMUL_EXTRA_OFILES=$all_emul_extras
24333965Sjdpfi
24433965SjdpAC_SUBST(EMULATION_OFILES)
24560484SobrienAC_SUBST(EMUL_EXTRA_OFILES)
246130561SobrienAC_SUBST(LIB_PATH)
24733965Sjdp
24860484SobrienEMULATION_LIBPATH=$all_libpath
24960484SobrienAC_SUBST(EMULATION_LIBPATH)
25060484Sobrien
25138889Sjdpif test x${enable_static} = xno; then
25238889Sjdp  TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
25338889Sjdpelse
25438889Sjdp  TESTBFDLIB="../bfd/.libs/libbfd.a"
25538889Sjdpfi
25638889SjdpAC_SUBST(TESTBFDLIB)
25738889Sjdp
25860484Sobrientarget_vendor=${target_vendor=$host_vendor}
25960484Sobriencase "$target_vendor" in
26060484Sobrien  hp) EXTRA_SHLIB_EXTENSION=".sl" ;;
26160484Sobrien  *)  EXTRA_SHLIB_EXTENSION= ;;
26260484Sobrienesac
263218822Sdim
264218822Sdimcase "$target_os" in
265218822Sdim  lynxos) EXTRA_SHLIB_EXTENSION=".a" ;;
266218822Sdimesac
267218822Sdim
26860484Sobrienif test x${EXTRA_SHLIB_EXTENSION} != x ; then
26960484Sobrien  AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION",
27060484Sobrien   [Additional extension a shared object might have.])
27160484Sobrienfi
27260484Sobrien
273218822Sdimdnl Required by html and install-html
274218822SdimAC_SUBST(datarootdir)
275218822SdimAC_SUBST(docdir)
276218822SdimAC_SUBST(htmldir)
277218822Sdim
278218822SdimAC_OUTPUT(Makefile po/Makefile.in:po/Make-in)
279