-AM_PROG_INSTALL
-
-AC_CHECK_HEADERS(string.h strings.h stdlib.h)
-
-# start-sanitize-cygnus
-use_cgen=no
-if test ${USE_MAINTAINER_MODE} = yes ; then
- for targ in $target $canon_targets
- do
- case $targ in
- all) use_cgen=yes ;;
- m32r-*-*) use_cgen=yes ;;
- esac
- done
-fi
-if test $use_cgen = yes ; then
- AC_CHECK_PROG(SCHEME, guile, guile, guile)
+AC_PROG_INSTALL
+
+AC_CHECK_HEADERS(string.h strings.h stdlib.h limits.h)
+
+AC_CHECK_DECLS([basename, stpcpy])
+
+cgen_maint=no
+cgendir='$(srcdir)/../cgen'
+
+AC_ARG_ENABLE(cgen-maint,
+[ --enable-cgen-maint[=dir] build cgen generated files],
+[case "${enableval}" in
+ yes) cgen_maint=yes ;;
+ no) cgen_maint=no ;;
+ *)
+ # argument is cgen install directory (not implemented yet).
+ # Having a `share' directory might be more appropriate for the .scm,
+ # .cpu, etc. files.
+ cgen_maint=yes
+ cgendir=${cgen_maint}/lib/cgen
+ ;;
+esac])dnl
+AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} = xyes)
+AC_SUBST(cgendir)
+
+using_cgen=no
+
+# Check if linker supports --as-needed and --no-as-needed options
+AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
+ [bfd_cv_ld_as_needed=no
+ if $LD --help 2>/dev/null | grep as-needed > /dev/null; then
+ bfd_cv_ld_as_needed=yes
+ fi
+ ])
+
+LT_LIB_M
+
+#Libs for generator progs
+if test "x$cross_compiling" = "xno"; then
+ BUILD_LIBS=../libiberty/libiberty.a
+ BUILD_LIB_DEPS=$BUILD_LIBS
+else
+ # if cross-compiling, assume that the system provides -liberty
+ # and that the version is compatible with new headers.
+ BUILD_LIBS=-liberty
+ BUILD_LIB_DEPS=