Fri Sep 8 16:32:43 1995 Ian Lance Taylor <ian@cygnus.com>
+ * configure.in: Call AC_HEADER_DIRENT.
+ * configure, config.in: Rebuild.
+ * emultempl/sunos.em: Use autoconf recommend mechanism to define
+ DIR and struct dirent.
+
* configure.tgt (mips*-*-bsd*): New case.
* configure.host (i[345]86-sequent-ptx* | i[345]86-sequent-sysv*)
#include <sys/types.h>
#include <sys/stat.h>
-/* FIXME: On some hosts we will need to include a different file.
- This is correct for SunOS, which is the only place this file will
- typically be compiled. However, if somebody configures the linker
- for all targets, they will run into trouble here. */
-#include <dirent.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "ld.h"
-#include "config.h"
#include "ldmain.h"
#include "ldemul.h"
#include "ldfile.h"
#include "ldexp.h"
#include "ldlang.h"
+#ifdef HAVE_DIRENT_H
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
static void gld${EMULATION_NAME}_create_output_section_statements
PARAMS ((void));
static void
gld${EMULATION_NAME}_create_output_section_statements ()
{
- if (config.dynamic_link)
- lang_for_each_input_file (gld${EMULATION_NAME}_find_so);
+ lang_for_each_input_file (gld${EMULATION_NAME}_find_so);
}
/* Search the directory for a .so file for each library search. */
struct stat st;
if (! inp->search_dirs_flag
- || ! inp->is_archive)
+ || ! inp->is_archive
+ || ! inp->dynamic)
return;
ASSERT (strncmp (inp->local_sym_name, "-l", 2) == 0);
{
force_maj = atoi (dot + 1);
len = dot - filename;
- alc = (char *) alloca (len + 1);
+ alc = (char *) xmalloc (len + 1);
strncpy (alc, filename, len);
alc[len] = '\0';
filename = alc;
/* Now look for the same file name, but with .sa instead of .so. If
found, add it to the list of input files. */
- alc = (char *) alloca (strlen (inp->filename) + 1);
+ alc = (char *) xmalloc (strlen (inp->filename) + 1);
strcpy (alc, inp->filename);
strstr (alc, ".so.")[2] = 'a';
if (stat (alc, &st) == 0)