* Makefile.in (clean): Remove $(DEMANGLER_PROG).1. From Ronald
[binutils-gdb.git] / binutils / configure.in
index 6912fef1c962d30a12f96b718071fa3644ba028b..7c23cd339de81203338fcc271ddf64deb32b95c5 100644 (file)
-# This file is a shell script that supplies the information necessary
-# to tailor a template configure script into the configure script
-# appropriate for this directory.  For more information, check any
-# existing configure script.
+dnl Process this file with autoconf to produce a configure script.
+dnl
+AC_PREREQ(2.0)
+AC_INIT(ar.c)
+
+AC_ARG_ENABLE(targets,
+[  --enable-targets        alternative target configurations],
+[case "${enableval}" in
+  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
+            ;;
+  no)       enable_targets= ;;
+  *)        enable_targets=$enableval ;;
+esac])dnl
+
+AC_CONFIG_HEADER(config.h:config.in)
+
+AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`)
+AC_CANONICAL_SYSTEM
+if test -z "$target" ; then
+    AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
+fi
+if test -z "$host" ; then
+    AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
+fi
+AC_ARG_PROGRAM
 
-srctrigger=ar.c
-srcname="Binutils"
+# host-specific stuff:
 
-# per-host:
+HDEFINES=
+LDFLAGS=
 
-case "${host_cpu}" in
+. ${srcdir}/../bfd/configure.host
 
-rs6000)        my_host=rs6000
-       ;;
+AC_PROG_CC
+AC_SUBST(CFLAGS)
+AC_SUBST(HDEFINES)
+AC_SUBST(LDFLAGS)
+AR=${AR-ar}
+AC_SUBST(AR)
+AC_PROG_RANLIB
+AC_PROG_INSTALL
 
-mips)
-       case "${host_vendor}" in
-       dec)    my_host=decstation ;;
-       sgi)    my_host=irix3 ;;
-       esac
-       ;;
-
-m88k)
-       case "${host_vendor}" in
-       motorola)
-               my_host=delta88 ;;
-       *)
-               case "${host_os}" in
-               dgux)   my_host=dgux ;;
-               esac
-               ;;
-       esac
-       ;;
-
-m68k)
-       case "${host_vendor}" in
-       cbm)
-               case ${host_os} in
-               amigados)       my_host=amigados ;;
-               svr4)           my_host=amix ;;
-               esac
-               ;;
-       hp)     
-               case "${host_os}" in
-               hpux)   my_host=hp9000 ;;
-               bsd)    my_host=hp300bsd ;;
-               esac
-               ;;
-       sony)   my_host=news ;;
-       sun)    my_host=sun3 ;;
-       apollo) 
-               case "${host_os}" in
-               sysv*)  my_host=apollov68 ;;
-               bsd*)   my_host=apollo68 ;;
-               esac
-               ;;
-       esac
-       ;;
-
-i386)
-       case "${host_vendor}" in
-       *)
-               case "${host_os}" in
-               go32)   my_host=go32 ;;
-               sco*)   my_host=i386v ;;
-               sysv)   my_host=i386v ;;
-               mach)   my_host=i386mach ;;
-               msdos)  my_host=dose ;;
-               esac
-               ;;
-       esac
-       ;;
+BFD_CC_FOR_BUILD
 
-sparc)
-       case "${host_os}" in
-       sunos64)        my_host=sparc-ll ;;
-       *)              my_host=sparc ;;
-       esac
-       ;;
+AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
+AC_HEADER_SYS_WAIT
+AC_CHECK_FUNCS(sbrk utimes)
 
-romp)  my_host=rtbsd
-       ;;
+AC_MSG_CHECKING(for time_t in time.h)
+AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
+[AC_TRY_COMPILE([#include <time.h>], [time_t i;],
+bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
+AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
+if test $bu_cv_decl_time_t_time_h = yes; then
+  AC_DEFINE([HAVE_TIME_T_IN_TIME_H])
+fi
 
-a29k)  my_host=ultra3
-       ;;
+AC_MSG_CHECKING(for time_t in sys/types.h)
+AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
+[AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
+bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
+AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
+if test $bu_cv_decl_time_t_types_h = yes; then
+  AC_DEFINE([HAVE_TIME_T_IN_TYPES_H])
+fi
 
-tahoe)
-       my_host=tahoe
-       ;;
+# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
+# by default.
+AC_MSG_CHECKING([for utime.h])
+AC_CACHE_VAL(bu_cv_header_utime_h,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#include <utime.h>],
+[struct utimbuf s;],
+bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
+AC_MSG_RESULT($bu_cv_header_utime_h)
+if test $bu_cv_header_utime_h = yes; then
+  AC_DEFINE(HAVE_GOOD_UTIME_H)
+fi
 
-vax)
-       case "${host_os}" in
-       ultrix) my_host=vaxult ;;
-       *) my_host=vaxbsd ;;
-       esac
-       ;;
-esac
+AC_MSG_CHECKING([whether fprintf must be declared])
+AC_CACHE_VAL(bu_cv_decl_needed_fprintf,
+[AC_TRY_COMPILE([#include <stdio.h>],
+[int (*pfn) = (int (*)) fprintf],
+bu_cv_decl_needed_fprintf=no, bu_cv_decl_needed_fprintf=yes)])
+AC_MSG_RESULT($bu_cv_decl_needed_fprintf)
+if test $bu_cv_decl_needed_fprintf = yes; then
+  AC_DEFINE(NEED_DECLARATION_FPRINTF)
+fi
 
-# Set up to make a link between the host's include file and "sysdep.h".
-files="../bfd/hosts/${my_host}.h"
+BFD_BINARY_FOPEN
 
-links="sysdep.h"
+# target-specific stuff:
 
-if [ ! -f ${srcdir}/${files} ] ; then
-       if [ -n "${my_host}" ] ; then
-               echo '***' No file ${srcdir}/${files}
+# Canonicalize the secondary target names.
+if test -n "$enable_targets"; then
+    for targ in `echo $enable_targets | sed 's/,/ /g'`
+    do
+       result=`$ac_config_sub $targ 2>/dev/null`
+       if test -n "$result"; then
+           canon_targets="$canon_targets $result"
+       else
+           # Allow targets that config.sub doesn't recognize, like "all".
+           canon_targets="$canon_targets $targ"
        fi
-       echo '***' ${srcname} does not support host ${host}
-       exit 1
+    done
 fi
 
-host_makefile_frag=
-if [ -f ${srcdir}/../bfd/config/${my_host}.mh ] ; then
-       host_makefile_frag=../bfd/config/${my_host}.mh
+all_targets=false
+BUILD_NLMCONV=
+NLMCONV_DEFS=
+BUILD_SRCONV=
+BUILD_DLLTOOL=
+DLLTOOL_DEFS=
+
+for targ in $target $canon_targets
+do
+    if test "x$targ" = "xall"; then
+        all_targets=true
+       BUILD_NLMCONV='$(NLMCONV_PROG)'
+       BUILD_SRCONV='$(SRCONV_PROG)'
+       NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
+    else
+       case $targ in
+changequote(,)dnl
+       i[345]86*-*-netware*) 
+changequote([,])dnl
+         BUILD_NLMCONV='$(NLMCONV_PROG)'
+         NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
+         ;;
+       alpha*-*-netware*)
+         BUILD_NLMCONV='$(NLMCONV_PROG)'
+         NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
+         ;;
+       powerpc*-*-netware*)
+         BUILD_NLMCONV='$(NLMCONV_PROG)'
+         NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
+         ;;
+       sparc*-*-netware*)
+         BUILD_NLMCONV='$(NLMCONV_PROG)'
+         NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
+         ;;
+       esac
+       case $targ in
+       *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
+       esac
+       case $targ in
+       arm-*pe*)
+         BUILD_DLLTOOL='$(DLLTOOL_PROG)'
+         DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
+        ;;
+changequote(,)dnl
+       i[3-6]86-*pe* | i[3-6]86-*-win32)
+changequote([,])dnl
+         BUILD_DLLTOOL='$(DLLTOOL_PROG)'
+         DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
+        ;;
+       esac
+    fi
+done
+
+AC_SUBST(NLMCONV_DEFS)
+AC_SUBST(BUILD_NLMCONV)
+AC_SUBST(BUILD_SRCONV)
+AC_SUBST(BUILD_DLLTOOL)
+AC_SUBST(DLLTOOL_DEFS)
+
+targ=$target
+. $srcdir/../bfd/config.bfd
+if test "x$targ_underscore" = "xyes"; then
+    UNDERSCORE=1
+else
+    UNDERSCORE=0
 fi
+AC_SUBST(UNDERSCORE)
 
-# per-target:
+AC_OUTPUT(Makefile,
+[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])