OSDN Git Service

Improvements to the configure system from Miles Bader (miles@lsi.nec.co.jp).
authorgerg <gerg>
Thu, 14 Feb 2002 13:07:29 +0000 (13:07 +0000)
committergerg <gerg>
Thu, 14 Feb 2002 13:07:29 +0000 (13:07 +0000)
Makefile.in
configure
configure.in
elf2flt.c

index 5f0e6f7..8052eaf 100644 (file)
@@ -1,22 +1,38 @@
+srcdir = @srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+libdir = @libdir@
+includedir = @includedir@
 
 CC = @CC@
 CPU = @target_cpu@
 TARGET = @target_alias@
-CFLAGS = @CFLAGS@ -static -DTARGET_$(CPU)
-LDFLAGS = @LDFLAGS@ @LIBS@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@ -static
+LIBS = @LIBS@
 INSTALL = @INSTALL@
-INSTALLDIR = @prefix@
+DEFS = @DEFS@ -DTARGET_$(CPU)
+
+CCFLAGS = $(CFLAGS) $(DEFS) $(INCLUDES)
+
+
+target_bindir = $(prefix)/$(TARGET)/bin
+target_libdir = $(prefix)/$(TARGET)/lib
 
 PROGS = elf2flt flthdr
 
 
 all: $(PROGS)
 
-elf2flt: elf2flt.c Makefile
-       $(CC) $(CFLAGS) -o $@ elf2flt.c $(LDFLAGS)
+elf2flt: $(srcdir)/elf2flt.c Makefile
+       $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/elf2flt.c $(LIBS)
 
-flthdr: flthdr.c Makefile
-       $(CC) $(CFLAGS) -o $@ flthdr.c $(LDFLAGS)
+flthdr: $(srcdir)/flthdr.c Makefile
+       $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/flthdr.c $(LIBS)
 
 clean:
        -rm -f $(PROGS) *.[oa]
@@ -25,15 +41,15 @@ distclean: clean
        -rm -f Makefile config.log config.status config.cache
 
 install:
-       $(INSTALL) -s -m 755 flthdr $(INSTALLDIR)/bin/$(TARGET)-flthdr
-       $(INSTALL) -s -m 755 flthdr $(INSTALLDIR)/$(TARGET)/bin/flthdr
-       $(INSTALL) -s -m 755 elf2flt $(INSTALLDIR)/bin/$(TARGET)-elf2flt
-       $(INSTALL) -s -m 755 elf2flt $(INSTALLDIR)/$(TARGET)/bin/elf2flt
-       [ -f $(INSTALLDIR)/bin/$(TARGET)-ld.real ] || \
-               mv $(INSTALLDIR)/bin/$(TARGET)-ld $(INSTALLDIR)/bin/$(TARGET)-ld.real
-       [ -f $(INSTALLDIR)/$(TARGET)/bin/ld.real ] || \
-               mv $(INSTALLDIR)/$(TARGET)/bin/ld $(INSTALLDIR)/$(TARGET)/bin/ld.real
-       $(INSTALL) -m 755 ld-elf2flt $(INSTALLDIR)/bin/$(TARGET)-ld
-       $(INSTALL) -m 755 ld-elf2flt $(INSTALLDIR)/$(TARGET)/bin/ld
-       $(INSTALL) -m 644 elf2flt.ld $(INSTALLDIR)/$(TARGET)/lib
+       $(INSTALL) -s -m 755 flthdr $(bindir)/$(TARGET)-flthdr
+       $(INSTALL) -s -m 755 flthdr $(target_bindir)/flthdr
+       $(INSTALL) -s -m 755 elf2flt $(bindir)/$(TARGET)-elf2flt
+       $(INSTALL) -s -m 755 elf2flt $(target_bindir)/elf2flt
+       [ -f $(bindir)/$(TARGET)-ld.real ] || \
+               mv $(bindir)/$(TARGET)-ld $(bindir)/$(TARGET)-ld.real
+       [ -f $(target_bindir)/ld.real ] || \
+               mv $(target_bindir)/ld $(target_bindir)/ld.real
+       $(INSTALL) -m 755 $(srcdir)/ld-elf2flt $(bindir)/$(TARGET)-ld
+       $(INSTALL) -m 755 $(srcdir)/ld-elf2flt $(target_bindir)/ld
+       $(INSTALL) -m 644 $(srcdir)/elf2flt.ld $(target_libdir)
 
index ee5ae13..0ea7e75 100755 (executable)
--- a/configure
+++ b/configure
@@ -526,8 +526,6 @@ fi
 
 
 
-echo $ac_n "checking --with-libbfd=?""... $ac_c" 1>&6
-echo "configure:531: checking --with-libbfd=?" >&5
 # Check whether --with-libbfd or --without-libbfd was given.
 if test "${with_libbfd+set}" = set; then
   withval="$with_libbfd"
@@ -537,10 +535,7 @@ else
 
 fi
 
-echo "$ac_t""$ac_libbfd" 1>&6
 
-echo $ac_n "checking --with-libiberty=?""... $ac_c" 1>&6
-echo "configure:544: checking --with-libiberty=?" >&5
 # Check whether --with-libiberty or --without-libiberty was given.
 if test "${with_libiberty+set}" = set; then
   withval="$with_libiberty"
@@ -550,7 +545,6 @@ else
 
 fi
 
-echo "$ac_t""$ac_libiberty" 1>&6
 
 ac_aux_dir=
 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
@@ -578,7 +572,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:582: checking host system type" >&5
+echo "configure:576: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -599,7 +593,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:603: checking target system type" >&5
+echo "configure:597: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -620,7 +614,7 @@ echo "$ac_t""$target" 1>&6
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:624: checking for $ac_word" >&5
+echo "configure:618: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -650,7 +644,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:654: checking for $ac_word" >&5
+echo "configure:648: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -701,7 +695,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:705: checking for $ac_word" >&5
+echo "configure:699: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -733,7 +727,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:737: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:731: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -744,12 +738,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 748 "configure"
+#line 742 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -775,12 +769,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:779: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:773: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:784: checking whether we are using GNU C" >&5
+echo "configure:778: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -789,7 +783,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -808,7 +802,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:812: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:806: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -851,7 +845,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:855: checking for a BSD compatible install" >&5
+echo "configure:849: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -904,6 +898,111 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
+if test "$ac_libiberty" = "NONE"; then
+  echo $ac_n "checking for objalloc_create in -liberty""... $ac_c" 1>&6
+echo "configure:904: checking for objalloc_create in -liberty" >&5
+ac_lib_var=`echo iberty'_'objalloc_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-liberty  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 912 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char objalloc_create();
+
+int main() {
+objalloc_create()
+; return 0; }
+EOF
+if { (eval echo configure:923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo iberty | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-liberty $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  ac_libiberty=auto
+else
+  LIBS="$ac_libiberty $LIBS"
+fi
+if test "$ac_libbfd" = "NONE"; then
+  echo $ac_n "checking for bfd_openr in -lbfd""... $ac_c" 1>&6
+echo "configure:956: checking for bfd_openr in -lbfd" >&5
+ac_lib_var=`echo bfd'_'bfd_openr | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbfd  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 964 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char bfd_openr();
+
+int main() {
+bfd_openr()
+; return 0; }
+EOF
+if { (eval echo configure:975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo bfd | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lbfd $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  ac_libbfd=auto
+else
+  LIBS="$ac_libbfd $LIBS"
+fi
+
 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"
@@ -915,10 +1014,9 @@ if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then
        echo
        exit 1
 fi
-LDFLAGS="$LDFLAGS $ac_libbfd $ac_libiberty"
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:922: checking how to run the C preprocessor" >&5
+echo "configure:1020: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -933,13 +1031,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 937 "configure"
+#line 1035 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1041: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -950,13 +1048,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 954 "configure"
+#line 1052 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -967,13 +1065,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 971 "configure"
+#line 1069 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:977: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -998,12 +1096,12 @@ fi
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1002: checking for ANSI C header files" >&5
+echo "configure:1100: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1007 "configure"
+#line 1105 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1011,7 +1109,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1015: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1113: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1028,7 +1126,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1032 "configure"
+#line 1130 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1046,7 +1144,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1050 "configure"
+#line 1148 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1067,7 +1165,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1071 "configure"
+#line 1169 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1078,7 +1176,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:1082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1105,17 +1203,17 @@ for ac_hdr in fcntl.h unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1109: checking for $ac_hdr" >&5
+echo "configure:1207: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1114 "configure"
+#line 1212 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1119: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1143,12 +1241,12 @@ done
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1147: checking for working const" >&5
+echo "configure:1245: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1152 "configure"
+#line 1250 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1197,7 +1295,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1201: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1219,12 +1317,12 @@ fi
 
 
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:1223: checking for vprintf" >&5
+echo "configure:1321: checking for vprintf" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1228 "configure"
+#line 1326 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -1247,7 +1345,7 @@ vprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
@@ -1271,12 +1369,12 @@ fi
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:1275: checking for _doprnt" >&5
+echo "configure:1373: checking for _doprnt" >&5
 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1280 "configure"
+#line 1378 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -1299,7 +1397,7 @@ _doprnt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
index ff335a9..39b7072 100644 (file)
@@ -1,21 +1,17 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(elf2flt.c)
 
-AC_MSG_CHECKING(--with-libbfd=?)
 AC_ARG_WITH(libbfd,
        [ --with-libbfd=<file>  path to libbfd.a library to use ],
        [ ac_libbfd=$withval ],
        [ ac_libbfd=NONE ]
 )
-AC_MSG_RESULT($ac_libbfd)
 
-AC_MSG_CHECKING(--with-libiberty=?)
 AC_ARG_WITH(libiberty,
        [ --with-libiberty=<file>  path to libiberty.a library to use ],
        [ ac_libiberty=$withval ],
        [ ac_libiberty=NONE ]
 )
-AC_MSG_RESULT($ac_libiberty)
 
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
@@ -25,6 +21,19 @@ 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
+
 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"
@@ -36,7 +45,6 @@ if test "$ac_libbfd" = "NONE" -o "$ac_libiberty" = "NONE" ; then
        echo
        exit 1
 fi
-LDFLAGS="$LDFLAGS $ac_libbfd $ac_libiberty"
 
 dnl Checks for header files.
 AC_HEADER_STDC
index 44aa4f0..bf6d20f 100644 (file)
--- a/elf2flt.c
+++ b/elf2flt.c
@@ -77,11 +77,11 @@ int pic_with_got = 0; /* do elf/got processing with PIC code */
 int load_to_ram = 0;  /* instruct loader to allocate everything into RAM */
 int compress = 0;     /* 1 = compress everything, 2 = compress data only */
 int use_resolved = 0; /* If true, get the value of symbol references from */
-                      /* the program contents, not from the relocation table. */
-                                         /* In this case, the input ELF file must be already */
-                                         /* fully resolved (using the `-q' flag with recent */
-                      /* versions of GNU ld will give you a fully resolved */
-                                         /* output file with relocation entries).  */
+                     /* the program contents, not from the relocation table. */
+                     /* In this case, the input ELF file must be already */
+                     /* fully resolved (using the `-q' flag with recent */
+                     /* versions of GNU ld will give you a fully resolved */
+                     /* output file with relocation entries).  */
 
 const char *progname, *filename;
 int lineno;
@@ -138,9 +138,9 @@ einfo (int type, const char *format, ...) {
   if (type & E_WARNING) {
     fprintf (stderr, "warning: ");
     nwarnings++;
-  }
-  else
+  } else {
     nerrors++;
+  }
 
   va_start (args, format);
   vfprintf (stderr, format, args);
@@ -165,9 +165,8 @@ get_symbols (bfd *abfd, long *num)
   if (storage_needed < 0)
     abort ();
       
-  if (storage_needed == 0) {
+  if (storage_needed == 0)
     return NULL;
-  }
 
   symbol_table = (asymbol **) malloc (storage_needed);