configure.in: Add i386-pc-interix support.

* configure.in: Add i386-pc-interix support.
        * configure: Regenerate.
        * fixinc.interix: New file.
        * config/interix.h: New file.
        * config/x-interix: New file.
        * config/xm-interix.h: New file.
        * i386/interix.h: New file.
        * i386/interix.c: New file.
        * i386/t-interix: New file.

Co-Authored-By: Donn Terry <donn@interix.com>

From-SVN: r25910
This commit is contained in:
Mumit Khan 1999-03-22 22:59:48 +00:00 committed by Jeff Law
parent 65954bd8cb
commit 052dbd9e99
10 changed files with 1177 additions and 91 deletions

View File

@ -1,3 +1,16 @@
Mon Mar 22 23:52:01 1999 Mumit Khan <khan@xraylith.wisc.edu>
Donn Terry <donn@interix.com>
* configure.in: Add i386-pc-interix support.
* configure: Regenerate.
* fixinc.interix: New file.
* config/interix.h: New file.
* config/x-interix: New file.
* config/xm-interix.h: New file.
* i386/interix.h: New file.
* i386/interix.c: New file.
* i386/t-interix: New file.
Mon Mar 22 23:41:49 1999 Jeffrey A Law (law@cygnus.com)
* i386.h (PREFERRED_STACK_BOUNDARY): Define.

110
gcc/config/i386/interix.c Normal file
View File

@ -0,0 +1,110 @@
/* Subroutines for insn-output.c for Windows NT.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "rtl.h"
#include "regs.h"
#include "hard-reg-set.h"
#include "output.h"
#include "tree.h"
#include "flags.h"
/* Return string which is the former assembler name modified with a
suffix consisting of an atsign (@) followed by the number of bytes of
arguments */
char *
gen_stdcall_suffix (decl)
tree decl;
{
int total = 0;
/* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead
of DECL_ASSEMBLER_NAME. */
char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
char *newsym;
if (TYPE_ARG_TYPES (TREE_TYPE (decl)))
if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl))))
== void_type_node)
{
tree formal_type = TYPE_ARG_TYPES (TREE_TYPE (decl));
while (TREE_VALUE (formal_type) != void_type_node)
{
int parm_size
= TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type)));
/* Must round up to include padding. This is done the same
way as in store_one_arg. */
parm_size = ((parm_size + PARM_BOUNDARY - 1)
/ PARM_BOUNDARY * PARM_BOUNDARY);
total += parm_size;
formal_type = TREE_CHAIN (formal_type);
}
}
newsym = xmalloc (strlen (asmname) + 10);
sprintf (newsym, "%s@%d", asmname, total/BITS_PER_UNIT);
return IDENTIFIER_POINTER (get_identifier (newsym));
}
#if 0
/* Turn this back on when the linker is updated to handle grouped
.data$ sections correctly. See corresponding note in i386/interix.h.
MK. */
/* Cover function for UNIQUE_SECTION. */
void
i386_pe_unique_section (decl, reloc)
tree decl;
int reloc;
{
int len;
char *name,*string,*prefix;
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
/* Strip off any encoding in fnname. */
STRIP_NAME_ENCODING (name, name);
/* The object is put in, for example, section .text$foo.
The linker will then ultimately place them in .text
(everything from the $ on is stripped). Don't put
read-only data in .rdata section to avoid a PE linker
bug when .rdata$* grouped sections are used in code
without a .rdata section. */
if (TREE_CODE (decl) == FUNCTION_DECL)
prefix = ".text$";
else if (DECL_READONLY_SECTION (decl, reloc))
#ifdef READONLY_DATA_SECTION
prefix = ".rdata$";
#else
prefix = ".text$";
#endif
else
prefix = ".data$";
len = strlen (name) + strlen (prefix);
string = alloca (len + 1);
sprintf (string, "%s%s", prefix, name);
DECL_SECTION_NAME (decl) = build_string (len, string);
}
#endif /* 0 */

574
gcc/config/i386/interix.h Normal file
View File

@ -0,0 +1,574 @@
/* Target definitions for GNU compiler for Intel 80386 running Interix
Parts Copyright (C) 1991, 1999 Free Software Foundation, Inc.
Parts:
by Douglas B. Rupp (drupp@cs.washington.edu).
by Ron Guilmette (rfg@netcom.com).
by Donn Terry (donn@softway.com).
by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#define YES_UNDERSCORES
#define DBX_DEBUGGING_INFO
#define SDB_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
#include <interix.h>
#include <i386/gas.h> /* we're close enough ... */
#define HANDLE_SYSV_PRAGMA
#undef HANDLE_PRAGMA_WEAK /* until the link format can handle it */
/* By default, target has a 80387, uses IEEE compatible arithmetic,
and returns float values in the 387 and needs stack probes
We also align doubles to 64-bits for MSVC default compatability */
#undef TARGET_DEFAULT
#define TARGET_DEFAULT \
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE | \
MASK_ALIGN_DOUBLE)
#undef TARGET_CPU_DEFAULT
#define TARGET_CPU_DEFAULT 2 /* 486 */
#define WCHAR_UNSIGNED 1
#define WCHAR_TYPE_SIZE 16
#define WCHAR_TYPE "short unsigned int"
/* WinNT (and thus Interix) use unsigned int */
#define SIZE_TYPE "unsigned int"
#define ASM_LOAD_ADDR(loc, reg) " leal " #loc "," #reg "\n"
/* For the sake of libgcc2.c, indicate target supports atexit. */
#define HAVE_ATEXIT
/* cpp handles __STDC__ */
#undef CPP_PREDEFINES
#define CPP_PREDEFINES " \
-D__INTERIX \
-D__OPENNT \
-D_M_IX86=300 -D_X86_=1 \
-D__stdcall=__attribute__((__stdcall__)) \
-D__cdecl=__attribute__((__cdecl__)) \
-Asystem(unix) -Asystem(interix) -Asystem(interix) -Acpu(i386) -Amachine(i386)"
#undef CPP_SPEC
/* Write out the correct language type definition for the header files.
Unless we have assembler language, write out the symbols for C.
cpp_cpu is an Intel specific variant. See i386.h
mieee is an Alpha specific variant. Cross polination a bad idea.
*/
#define CPP_SPEC "\
%{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \
%{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
%{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
%{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C} \
-remap \
%(cpp_cpu) \
%{posix:-D_POSIX_SOURCE} \
-idirafter %$INTERIX_ROOT/usr/include"
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (i386 Interix)");
/* The global __fltused is necessary to cause the printf/scanf routines
for outputting/inputting floating point numbers to be loaded. Since this
is kind of hard to detect, we just do it all the time. */
#ifdef ASM_FILE_START
#undef ASM_FILE_START
#endif
#define ASM_FILE_START(FILE) \
do { fprintf (FILE, "\t.file\t"); \
output_quoted_string (FILE, dump_base_name); \
fprintf (FILE, "\n"); \
fprintf (FILE, ".global\t__fltused\n"); \
} while (0)
/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
corresponds to a particular byte value [0..255]. For any
given byte value, if the value in the corresponding table
position is zero, the given character can be output directly.
If the table value is 1, the byte must be output as a \ooo
octal escape. If the tables value is anything else, then the
byte value should be output as a \ followed by the value
in the table. Note that we can use standard UN*X escape
sequences for many control characters, but we don't use
\a to represent BEL because some svr4 assemblers (e.g. on
the i386) don't know about that. Also, we don't use \v
since some versions of gas, such as 2.2 did not accept it. */
#define ESCAPES \
"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
/* Some svr4 assemblers have a limit on the number of characters which
can appear in the operand of a .string directive. If your assembler
has such a limitation, you should define STRING_LIMIT to reflect that
limit. Note that at least some svr4 assemblers have a limit on the
actual number of bytes in the double-quoted string, and that they
count each character in an escape sequence as one byte. Thus, an
escape sequence like \377 would count as four bytes.
If your target assembler doesn't support the .string directive, you
should define this to zero.
*/
#define STRING_LIMIT ((unsigned) 256)
#define STRING_ASM_OP ".string"
/* The routine used to output NUL terminated strings. We use a special
version of this for most svr4 targets because doing so makes the
generated assembly code more compact (and thus faster to assemble)
as well as more readable, especially for targets like the i386
(where the only alternative is to output character sequences as
comma separated lists of numbers). */
#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
do \
{ \
register unsigned char *_limited_str = (unsigned char *) (STR); \
register unsigned ch; \
fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \
for (; ch = *_limited_str; _limited_str++) \
{ \
register int escape; \
switch (escape = ESCAPES[ch]) \
{ \
case 0: \
putc (ch, (FILE)); \
break; \
case 1: \
fprintf ((FILE), "\\%03o", ch); \
break; \
default: \
putc ('\\', (FILE)); \
putc (escape, (FILE)); \
break; \
} \
} \
fprintf ((FILE), "\"\n"); \
} \
while (0)
/* The routine used to output sequences of byte values. We use a special
version of this for most svr4 targets because doing so makes the
generated assembly code more compact (and thus faster to assemble)
as well as more readable. Note that if we find subparts of the
character sequence which end with NUL (and which are shorter than
STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
#undef ASM_OUTPUT_ASCII
#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
do \
{ \
register unsigned char *_ascii_bytes = (unsigned char *) (STR); \
register unsigned char *limit = _ascii_bytes + (LENGTH); \
register unsigned bytes_in_chunk = 0; \
for (; _ascii_bytes < limit; _ascii_bytes++) \
{ \
register unsigned char *p; \
if (bytes_in_chunk >= 64) \
{ \
fputc ('\n', (FILE)); \
bytes_in_chunk = 0; \
} \
for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
continue; \
if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
{ \
if (bytes_in_chunk > 0) \
{ \
fputc ('\n', (FILE)); \
bytes_in_chunk = 0; \
} \
ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
_ascii_bytes = p; \
} \
else \
{ \
if (bytes_in_chunk == 0) \
fprintf ((FILE), "\t.byte\t"); \
else \
fputc (',', (FILE)); \
fprintf ((FILE), "0x%02x", *_ascii_bytes); \
bytes_in_chunk += 5; \
} \
} \
if (bytes_in_chunk > 0) \
fprintf ((FILE), "\n"); \
} \
while (0)
/* This is how to output an element of a case-vector that is relative.
This is only used for PIC code. See comments by the `casesi' insn in
i386.md for an explanation of the expression this outputs.
PE format differs on what PC-relative offsets look like (see
coff_i386_rtype_to_howto), and we need to compensate (by one word) here. */
#undef ASM_OUTPUT_ADDR_DIFF_ELT
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
fprintf (FILE, "\t.long __GLOBAL_OFFSET_TABLE_+[.-%s%d+4]\n", LPREFIX, VALUE)
/* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION 1
/* Emit code to check the stack when allocating more that 4000
bytes in one go. */
#define CHECK_STACK_LIMIT 0x1000
/* the following are OSF linker (not gld) specific... we don't want them */
#undef HAS_INIT_SECTION
#undef LD_INIT_SWITCH
#undef LD_FINI_SWITCH
/* The following are needed for C++, but also needed for profiling */
/* Support const sections and the ctors and dtors sections for g++.
Note that there appears to be two different ways to support const
sections at the moment. You can either #define the symbol
READONLY_DATA_SECTION (giving it some code which switches to the
readonly data section) or else you can #define the symbols
EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
SELECT_RTX_SECTION. We do both here just to be on the safe side. */
#define USE_CONST_SECTION 1
#define CONST_SECTION_ASM_OP ".section\t.rdata,\"r\""
/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
Note that we want to give these sections the SHF_WRITE attribute
because these sections will actually contain data (i.e. tables of
addresses of functions in the current root executable or shared library
file) and, in the case of a shared library, the relocatable addresses
will have to be properly resolved/relocated (and then written into) by
the dynamic linker when it actually attaches the given shared library
to the executing process. (Note that on SVR4, you may wish to use the
`-z text' option to the ELF linker, when building a shared library, as
an additional check that you are doing everything right. But if you do
use the `-z text' option when building a shared library, you will get
errors unless the .ctors and .dtors sections are marked as writable
via the SHF_WRITE attribute.) */
#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
/* A default list of other sections which we might be "in" at any given
time. For targets that use additional sections (e.g. .tdesc) you
should override this definition in the target-specific file which
includes this file. */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
definition in the target-specific file which includes this file. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
CTORS_SECTION_FUNCTION \
DTORS_SECTION_FUNCTION
#undef READONLY_DATA_SECTION
#define READONLY_DATA_SECTION() const_section ()
extern void text_section ();
#define CONST_SECTION_FUNCTION \
void \
const_section () \
{ \
if (!USE_CONST_SECTION) \
text_section(); \
else if (in_section != in_const) \
{ \
fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
in_section = in_const; \
} \
}
#define CTORS_SECTION_FUNCTION \
void \
ctors_section () \
{ \
if (in_section != in_ctors) \
{ \
fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
in_section = in_ctors; \
} \
}
#define DTORS_SECTION_FUNCTION \
void \
dtors_section () \
{ \
if (in_section != in_dtors) \
{ \
fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
in_section = in_dtors; \
} \
}
#if 0
/* Currently gas chokes on this; that's not too hard to fix, but there's
not a lot of impeteus to do it, either. If it is done, gas will have
to handle long section name escapes (which are defined in the COFF/PE
document as /nnn where nnn is a string table index). The benefit:
section attributes and -ffunction-sections, neither of which seem to
be critical. */
/* gas may have been fixed? bfd was. */
/* Switch into a generic section.
This is currently only used to support section attributes.
We make the section read-only and executable for a function decl,
read-only for a const data decl, and writable for a non-const data decl. */
#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
(DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
(DECL) && TREE_READONLY (DECL) ? "a" : "aw")
#endif
#define INT_ASM_OP ".long"
/* The MS compilers take alignment as a number of bytes, so we do as well */
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
/* A C statement (sans semicolon) to output an element in the table of
global constructors. */
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
do { \
ctors_section (); \
fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
assemble_name (FILE, NAME); \
fprintf (FILE, "\n"); \
} while (0)
/* A C statement (sans semicolon) to output an element in the table of
global destructors. */
#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
do { \
dtors_section (); \
fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
assemble_name (FILE, NAME); \
fprintf (FILE, "\n"); \
} while (0)
/* The linker will take care of this, and having them causes problems with
ld -r (specifically -rU). */
#define CTOR_LISTS_DEFINED_EXTERNALLY 1
#define SET_ASM_OP ".set"
/* Output a definition (implements alias) */
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
do \
{ \
fprintf ((FILE), "\t%s\t", SET_ASM_OP); \
assemble_name (FILE, LABEL1); \
fprintf (FILE, ","); \
assemble_name (FILE, LABEL2); \
fprintf (FILE, "\n"); \
} \
while (0)
#define HOST_PTR_PRINTF "%p"
#define HOST_PTR_AS_INT unsigned long
#define PCC_BITFIELD_TYPE_MATTERS 1
#define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec)
#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
/* The following two flags are usually "off" for i386, because some non-gnu
tools (for the i386) don't handle them. However, we don't have that
problem, so.... */
/* Forward references to tags are allowed. */
#define SDB_ALLOW_FORWARD_REFERENCES
/* Unknown tags are also allowed. */
#define SDB_ALLOW_UNKNOWN_REFERENCES
/* The integer half of this list needs to be constant. However, there's
a lot of disagreement about what the floating point adjustments should
be. We pick one that works with gdb. (The underlying problem is
what to do about the segment registers. Since we have access to them
from /proc, we'll allow them to be accessed in gdb, even tho the
gcc compiler can't generate them. (There's some evidence that
MSVC does, but possibly only for certain special "canned" sequences.) */
#undef DBX_REGISTER_NUMBER
#define DBX_REGISTER_NUMBER(n) \
((n) == 0 ? 0 \
: (n) == 1 ? 2 \
: (n) == 2 ? 1 \
: (n) == 3 ? 3 \
: (n) == 4 ? 6 \
: (n) == 5 ? 7 \
: (n) == 6 ? 5 \
: (n) == 7 ? 4 \
: ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+8 \
: (-1))
/* Define this macro if references to a symbol must be treated
differently depending on something about the variable or
function named by the symbol (such as what section it is in).
Apply stddef, handle (as yet unimplemented) pic.
stddef renaming does NOT apply to Alpha. */
char *gen_stdcall_suffix ();
#undef ENCODE_SECTION_INFO
#define ENCODE_SECTION_INFO(DECL) \
do \
{ \
if (flag_pic) \
{ \
rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
= (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
|| ! TREE_PUBLIC (DECL)); \
} \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
if (lookup_attribute ("stdcall", \
TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
XEXP (DECL_RTL (DECL), 0) = \
gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \
} \
while (0)
/* This macro gets just the user-specified name
out of the string in a SYMBOL_REF. Discard
trailing @[NUM] encoded by ENCODE_SECTION_INFO. */
#undef STRIP_NAME_ENCODING
#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
do { \
char *_p; \
char *_name = SYMBOL_NAME; \
for (_p = _name; *_p && *_p != '@'; ++_p) \
; \
if (*_p == '@') \
{ \
int _len = _p - _name; \
(VAR) = (char *) alloca (_len + 1); \
strncpy ((VAR), _name, _len); \
(VAR)[_len] = '\0'; \
} \
else \
(VAR) = _name; \
} while (0)
#if 0
/* Turn this back on when the linker is updated to handle grouped
.data$ sections correctly. See corresponding note in i386/interix.c.
MK. */
/* Define this macro if in some cases global symbols from one translation
unit may not be bound to undefined symbols in another translation unit
without user intervention. For instance, under Microsoft Windows
symbols must be explicitly imported from shared libraries (DLLs). */
#define MULTIPLE_SYMBOL_SPACES
#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
extern void i386_pe_unique_section ();
#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC)
#define SUPPORTS_ONE_ONLY 1
/* A C statement to output something to the assembler file to switch to section
NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
NULL_TREE. Some target formats do not support arbitrary sections. Do not
define this macro in such cases. */
#undef ASM_OUTPUT_SECTION_NAME
#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
do { \
static struct section_info \
{ \
struct section_info *next; \
char *name; \
enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
} *sections; \
struct section_info *s; \
char *mode; \
enum sect_enum type; \
\
for (s = sections; s; s = s->next) \
if (!strcmp (NAME, s->name)) \
break; \
\
if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
type = SECT_EXEC, mode = "x"; \
else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
type = SECT_RO, mode = "r"; \
else \
type = SECT_RW, mode = "w"; \
\
if (s == 0) \
{ \
s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
strcpy (s->name, NAME); \
s->type = type; \
s->next = sections; \
sections = s; \
fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
/* Functions may have been compiled at various levels of \
optimization so we can't use `same_size' here. Instead, \
have the linker pick one. */ \
if ((DECL) && DECL_ONE_ONLY (DECL)) \
fprintf (STREAM, "\t.linkonce %s\n", \
TREE_CODE (DECL) == FUNCTION_DECL \
? "discard" : "same_size"); \
} \
else \
{ \
fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
} \
} while (0)
#endif /* 0 */
/* DWARF2 Unwinding doesn't work with exception handling yet. */
#define DWARF2_UNWIND_INFO 0
/* Don't assume anything about the header files. */
#define NO_IMPLICIT_EXTERN_C

10
gcc/config/i386/t-interix Normal file
View File

@ -0,0 +1,10 @@
# t-interix
LIBGCC1 = libgcc1-asm.a
CROSS_LIBGCC1 = libgcc1-asm.a
LIB1ASMSRC = i386/cygwin.asm
LIB1ASMFUNCS = _chkstk
interix.o: $(srcdir)/config/i386/interix.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/interix.c

86
gcc/config/interix.h Normal file
View File

@ -0,0 +1,86 @@
/* Operating system specific defines to be used when targeting GCC for
Interix
Copyright (C) 1994, 1995, 1999 Free Software Foundation, Inc.
Donn Terry, Softway Systems, Inc. (donn@softway.com)
Modified from code
Contributed by Douglas B. Rupp (drupp@cs.washington.edu).
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#define TARGET_MEM_FUNCTIONS
/* POSIX/Uni-thread only for now. Look at the winnt version
for windows/multi thread */
/* We need multiple -lc -lcpsx because they mutually refer;
that should go away someday */
#undef LIB_SPEC
#define LIB_SPEC "\
%{!shared:%{!dynamic:-lc -lcpsx -lc -lcpsx %$INTERIX_ROOT/usr/lib/psxdll.a \
%$INTERIX_ROOT/usr/lib/psxdll2.a \
}} \
%{!G:%{!dynamic:-lc -lcpsx -lc -lcpsx %$INTERIX_ROOT/usr/lib/psxdll.a \
%$INTERIX_ROOT/usr/lib/psxdll2.a \
}} \
%{dynamic:-lc %$INTERIX_ROOT/usr/lib/psxdll.a \
%$INTERIX_ROOT/usr/lib/psxdll2.a \
} \
%{v}"
#undef LINK_SPEC
#define LINK_SPEC "%{!shared:-stack 0x400000,0x10000} \
-subsystem posix \
%{g} \
%{dynamic:-Bdynamic} \
%{static:-Bstatic} \
%{shared:--shared -Bdynamic} \
%{G:--shared -Bdynamic} \
%{symbolic:--shared -Bsymbolic -Bdynamic} \
%{soname*:--soname %*} \
%{rpath*:--rpath %*} \
"
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
"%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}} %{shared:crti%O%s}"
#undef WORD_SWITCH_TAKES_ARG
#define WORD_SWITCH_TAKES_ARG(STR) \
((DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
|| !strcmp(STR, "rpath")) \
&& strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
&& strcmp (STR, "Tbss"))
#if 0
/* don't do this until we can sort out the default path issues. MK */
#undef STANDARD_EXEC_PREFIX
#define STANDARD_EXEC_PREFIX ""
#undef STANDARD_STARTFILE_PREFIX
#define STANDARD_STARTFILE_PREFIX ""
#undef TOOLDIR_BASE_PREFIX
#define TOOLDIR_BASE_PREFIX ""
#endif /* 0 */
#undef STDC_VALUE
#define STDC_VALUE 0

29
gcc/config/x-interix Normal file
View File

@ -0,0 +1,29 @@
# These are host overrides
# From config dir
# Interix doesn't yet have alloca; it's better to use the portable C version for
# bootstrapping. Do this by defining ALLOCA.
ALLOCA = alloca.o
# See all the declarations.
FIXPROTO_DEFINES = -D_XOPEN_SOURCE
# Don't run fixproto
STMP_FIXPROTO =
RANLIB = :
RANLIB_TEST = false
SHELL = sh
# Existing CC/GCC may not define -D__INTERIX, so need this here.
X_CFLAGS= -D__INTERIX
LIBGCC2_INCLUDES = -idirafter $${INTERIX_ROOT}/usr/include
# Headers come from a funny place
SYSTEM_HEADER_DIR=$${INTERIX_ROOT}/usr/include
EXTRA_PARTS += crti.o
crti.o: $(srcdir)/crti.c
$(GCC_FOR_TARGET) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/crti.c

75
gcc/config/xm-interix.h Normal file
View File

@ -0,0 +1,75 @@
/* Configuration for GNU compiler for processor running Interix
Copyright (C) 1993, 1995, 1999 Free Software Foundation, Inc.
Donn Terry, Softway Systems, Inc,
from code
Contributed by Douglas B. Rupp (drupp@cs.washington.edu)
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef USG
#define USG 1
#endif
#ifndef ONLY_INT_FIELDS
#define ONLY_INT_FIELDS 1
#endif
#ifndef USE_PROTOTYPES
#define USE_PROTOTYPES 1
#endif
/* If not compiled with GNU C, use the portable alloca. */
#ifndef __GNUC__
#define USE_C_ALLOCA 1
#endif
#define NO_SYS_SIGLIST 1
/* Our strategy for finding global constructors is a bit different, although
not a lot. */
#define DO_GLOBAL_CTORS_BODY \
do { \
int i; \
unsigned long nptrs; \
func_ptr *p; \
asm( \
" .section .ctor_head, \"rw\"\n" \
"1:\n" \
" .text \n" \
ASM_LOAD_ADDR(1b,%0) \
: "=r" (p) : : "cc"); \
for (nptrs = 0; p[nptrs] != 0; nptrs++); \
for (i = nptrs-1; i >= 0; i--) \
p[i] (); \
} while (0)
#define DO_GLOBAL_DTORS_BODY \
do { \
func_ptr *p; \
asm( \
" .section .dtor_head, \"rw\"\n" \
"1:\n" \
" .text \n" \
ASM_LOAD_ADDR(1b,%0) \
: "=r" (p) : : "cc"); \
while (*p) \
{ \
p++; \
(*(p-1)) (); \
} \
} while (0)

197
gcc/configure vendored
View File

@ -3773,6 +3773,21 @@ for machine in $build $host $target; do
fi
exeext=.exe
;;
i[34567]86-*-interix*)
tm_file=i386/interix.h
xm_file="${xm_file} xm-interix.h"
xm_defines="USG NO_SYS_SIGLIST"
tmake_file="i386/t-interix"
extra_objs=interix.o
xmake_file=x-interix
fixincludes=fixinc.interix
if [ x$enable_threads = xyes ]; then
thread_file='posix'
fi
if [ x$stabs = xyes ]; then
tm_file="${tm_file} dbxcoff.h"
fi
;;
i[34567]86-*-winnt3*)
tm_file=i386/win-nt.h
out_file=i386/i386.c
@ -5896,7 +5911,7 @@ fi
echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
echo "configure:5900: checking for strerror in -lcposix" >&5
echo "configure:5915: checking for strerror in -lcposix" >&5
ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -5904,7 +5919,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcposix $LIBS"
cat > conftest.$ac_ext <<EOF
#line 5908 "configure"
#line 5923 "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
@ -5915,7 +5930,7 @@ int main() {
strerror()
; return 0; }
EOF
if { (eval echo configure:5919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5934: \"$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
@ -5938,12 +5953,12 @@ fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:5942: checking for working const" >&5
echo "configure:5957: 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 5947 "configure"
#line 5962 "configure"
#include "confdefs.h"
int main() {
@ -5992,7 +6007,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:5996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -6013,21 +6028,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
echo "configure:6017: checking for inline" >&5
echo "configure:6032: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
#line 6024 "configure"
#line 6039 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
if { (eval echo configure:6031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6046: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@ -6053,12 +6068,12 @@ EOF
esac
echo $ac_n "checking for off_t""... $ac_c" 1>&6
echo "configure:6057: checking for off_t" >&5
echo "configure:6072: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6062 "configure"
#line 6077 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -6086,12 +6101,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:6090: checking for size_t" >&5
echo "configure:6105: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6095 "configure"
#line 6110 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -6121,19 +6136,19 @@ fi
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
echo "configure:6125: checking for working alloca.h" >&5
echo "configure:6140: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6130 "configure"
#line 6145 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
if { (eval echo configure:6137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@ -6154,12 +6169,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
echo "configure:6158: checking for alloca" >&5
echo "configure:6173: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6163 "configure"
#line 6178 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@ -6187,7 +6202,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
if { (eval echo configure:6191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@ -6219,12 +6234,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
echo "configure:6223: checking whether alloca needs Cray hooks" >&5
echo "configure:6238: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6228 "configure"
#line 6243 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@ -6249,12 +6264,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6253: checking for $ac_func" >&5
echo "configure:6268: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6258 "configure"
#line 6273 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -6277,7 +6292,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:6281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -6304,7 +6319,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
echo "configure:6308: checking stack direction for C alloca" >&5
echo "configure:6323: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6312,7 +6327,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
#line 6316 "configure"
#line 6331 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@ -6331,7 +6346,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
if { (eval echo configure:6335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:6350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@ -6356,17 +6371,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:6360: checking for $ac_hdr" >&5
echo "configure:6375: 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 6365 "configure"
#line 6380 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:6385: \"$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*
@ -6395,12 +6410,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6399: checking for $ac_func" >&5
echo "configure:6414: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6404 "configure"
#line 6419 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -6423,7 +6438,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:6427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -6448,7 +6463,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
echo "configure:6452: checking for working mmap" >&5
echo "configure:6467: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6456,7 +6471,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
#line 6460 "configure"
#line 6475 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@ -6596,7 +6611,7 @@ main()
}
EOF
if { (eval echo configure:6600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:6615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@ -6624,17 +6639,17 @@ unistd.h sys/param.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:6628: checking for $ac_hdr" >&5
echo "configure:6643: 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 6633 "configure"
#line 6648 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:6653: \"$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*
@ -6664,12 +6679,12 @@ done
strdup __argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6668: checking for $ac_func" >&5
echo "configure:6683: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6673 "configure"
#line 6688 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -6692,7 +6707,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:6696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -6721,12 +6736,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6725: checking for $ac_func" >&5
echo "configure:6740: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6730 "configure"
#line 6745 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -6749,7 +6764,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:6753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -6783,19 +6798,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
echo "configure:6787: checking for LC_MESSAGES" >&5
echo "configure:6802: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6792 "configure"
#line 6807 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
if { (eval echo configure:6799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_val_LC_MESSAGES=yes
else
@ -6816,7 +6831,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
echo "configure:6820: checking whether NLS is requested" >&5
echo "configure:6835: checking whether NLS is requested" >&5
# Check whether --enable-nls or --disable-nls was given.
if test "${enable_nls+set}" = set; then
enableval="$enable_nls"
@ -6836,7 +6851,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
echo "configure:6840: checking whether included gettext is requested" >&5
echo "configure:6855: checking whether included gettext is requested" >&5
# Check whether --with-included-gettext or --without-included-gettext was given.
if test "${with_included_gettext+set}" = set; then
withval="$with_included_gettext"
@ -6855,17 +6870,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
echo "configure:6859: checking for libintl.h" >&5
echo "configure:6874: checking for libintl.h" >&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 6864 "configure"
#line 6879 "configure"
#include "confdefs.h"
#include <libintl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:6884: \"$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*
@ -6882,19 +6897,19 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
echo "configure:6886: checking for gettext in libc" >&5
echo "configure:6901: checking for gettext in libc" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6891 "configure"
#line 6906 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
if { (eval echo configure:6898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
gt_cv_func_gettext_libc=yes
else
@ -6910,7 +6925,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
if test "$gt_cv_func_gettext_libc" != "yes"; then
echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
echo "configure:6914: checking for bindtextdomain in -lintl" >&5
echo "configure:6929: checking for bindtextdomain in -lintl" >&5
ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -6918,7 +6933,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 6922 "configure"
#line 6937 "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
@ -6929,7 +6944,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
if { (eval echo configure:6933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6948: \"$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
@ -6945,12 +6960,12 @@ fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
echo "configure:6949: checking for gettext in libintl" >&5
echo "configure:6964: checking for gettext in libintl" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6
echo "configure:6954: checking for gettext in -lintl" >&5
echo "configure:6969: checking for gettext in -lintl" >&5
ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -6958,7 +6973,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 6962 "configure"
#line 6977 "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
@ -6969,7 +6984,7 @@ int main() {
gettext()
; return 0; }
EOF
if { (eval echo configure:6973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6988: \"$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
@ -7008,7 +7023,7 @@ EOF
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7012: checking for $ac_word" >&5
echo "configure:7027: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7042,12 +7057,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:7046: checking for $ac_func" >&5
echo "configure:7061: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7051 "configure"
#line 7066 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -7070,7 +7085,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:7074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:7089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -7097,7 +7112,7 @@ done
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7101: checking for $ac_word" >&5
echo "configure:7116: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7133,7 +7148,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7137: checking for $ac_word" >&5
echo "configure:7152: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7165,7 +7180,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
#line 7169 "configure"
#line 7184 "configure"
#include "confdefs.h"
int main() {
@ -7173,7 +7188,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
if { (eval echo configure:7177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:7192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
CATOBJEXT=.gmo
DATADIRNAME=share
@ -7196,7 +7211,7 @@ fi
if test "$CATOBJEXT" = "NONE"; then
echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6
echo "configure:7200: checking whether catgets can be used" >&5
echo "configure:7215: checking whether catgets can be used" >&5
# Check whether --with-catgets or --without-catgets was given.
if test "${with_catgets+set}" = set; then
withval="$with_catgets"
@ -7209,7 +7224,7 @@ fi
if test "$nls_cv_use_catgets" = "yes"; then
echo $ac_n "checking for main in -li""... $ac_c" 1>&6
echo "configure:7213: checking for main in -li" >&5
echo "configure:7228: checking for main in -li" >&5
ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -7217,14 +7232,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-li $LIBS"
cat > conftest.$ac_ext <<EOF
#line 7221 "configure"
#line 7236 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:7228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:7243: \"$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
@ -7252,12 +7267,12 @@ else
fi
echo $ac_n "checking for catgets""... $ac_c" 1>&6
echo "configure:7256: checking for catgets" >&5
echo "configure:7271: checking for catgets" >&5
if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7261 "configure"
#line 7276 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char catgets(); below. */
@ -7280,7 +7295,7 @@ catgets();
; return 0; }
EOF
if { (eval echo configure:7284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:7299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_catgets=yes"
else
@ -7302,7 +7317,7 @@ EOF
# Extract the first word of "gencat", so it can be a program name with args.
set dummy gencat; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7306: checking for $ac_word" >&5
echo "configure:7321: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7338,7 +7353,7 @@ fi
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7342: checking for $ac_word" >&5
echo "configure:7357: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7375,7 +7390,7 @@ fi
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7379: checking for $ac_word" >&5
echo "configure:7394: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7410,7 +7425,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7414: checking for $ac_word" >&5
echo "configure:7429: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7468,7 +7483,7 @@ fi
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7472: checking for $ac_word" >&5
echo "configure:7487: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7502,7 +7517,7 @@ fi
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7506: checking for $ac_word" >&5
echo "configure:7521: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7538,7 +7553,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7542: checking for $ac_word" >&5
echo "configure:7557: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -7631,7 +7646,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
echo "configure:7635: checking for catalogs to be installed" >&5
echo "configure:7650: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@ -7659,17 +7674,17 @@ echo "configure:7635: checking for catalogs to be installed" >&5
if test "$CATOBJEXT" = ".cat"; then
ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
echo "configure:7663: checking for linux/version.h" >&5
echo "configure:7678: checking for linux/version.h" >&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 7668 "configure"
#line 7683 "configure"
#include "confdefs.h"
#include <linux/version.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7673: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:7688: \"$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*
@ -7901,7 +7916,7 @@ fi
# Figure out what assembler alignment features are present.
echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6
echo "configure:7905: checking assembler alignment features" >&5
echo "configure:7920: checking assembler alignment features" >&5
gcc_cv_as=
gcc_cv_as_alignment_features=
gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
@ -7974,7 +7989,7 @@ fi
echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6
echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6
echo "configure:7978: checking assembler subsection support" >&5
echo "configure:7993: checking assembler subsection support" >&5
gcc_cv_as_subsections=
if test x$gcc_cv_as != x; then
# Check if we have .subsection

View File

@ -1499,6 +1499,23 @@ changequote([,])dnl
fi
exeext=.exe
;;
changequote(,)dnl
i[34567]86-*-interix*)
changequote([,])dnl
tm_file=i386/interix.h
xm_file="${xm_file} xm-interix.h"
xm_defines="USG NO_SYS_SIGLIST"
tmake_file="i386/t-interix"
extra_objs=interix.o
xmake_file=x-interix
fixincludes=fixinc.interix
if [[ x$enable_threads = xyes ]]; then
thread_file='posix'
fi
if [[ x$stabs = xyes ]]; then
tm_file="${tm_file} dbxcoff.h"
fi
;;
changequote(,)dnl
i[34567]86-*-winnt3*)
changequote([,])dnl

157
gcc/fixinc.interix Normal file
View File

@ -0,0 +1,157 @@
#!/bin/sh
#
# fixinc.interix -- Install modified versions of Interix system include
# files.
#
# Based on fixinc.sco script by Ian Lance Taylor (ian@airs.com)).
# With modifications by Douglas Rupp (drupp@cs.washington.edu)
#
# This file is part of GNU CC.
#
# GNU CC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# GNU CC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU CC; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# ?????? fixup comment
# This script munges the native include files provided with Windows NT
# 3.5 SDK systems so as to provide a reasonable namespace when
# compiling with gcc. The header files by default do not
# provide many essential definitions and declarations if
# __STDC__ is 1. This script modifies the header files to check
# for __STRICT_ANSI__ being defined instead. Once munged, the
# resulting new system include files are placed in a directory
# that GNU C will search *before* searching the Include
# directory.
#
# See README-fixinc for more information.
ORIG_DIR=$(pwd)
# Fail if no arg to specify a directory for the output.
if [ x$1 = x ]; then
echo fixincludes: no output directory specified
echo usage $0 output input
exit 1
fi
# Fail if no arg to specify a directory for the input
if [ x$2 = x ]; then
echo fixincludes: no input directory specified
echo usage $0 output input
exit 1
fi
INPUT=$2
# Directory in which to store the results.
LIB=$1
mkdir -p $LIB || exit 1
# Make LIB absolute if it is relative.
# Don't do this if not necessary, since may screw up automounters.
case $LIB in
/*)
;;
*)
cd $LIB; LIB=$(pwd)
;;
esac
echo 'Building fixincludes in' ${LIB}
# Determine whether this filesystem has symbolic links.
if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
rm -f $LIB/ShouldNotExist
LINKS=true
else
LINKS=false
fi
cd ${INPUT}
if $LINKS; then
files=`ls -LR | sed -n s/:$//p`
else
files=`find . -type d -print | sed '/^.$/d'`
fi
if [ "x$files" = x ]; then
echo No files found in $INPUT\; skipped
exit 0
fi
echo 'Making directories:'
for file in $files; do
rm -rf $LIB/$file
if [ ! -d $LIB/$file ]; then
echo $LIB/$file
mkdir $LIB/$file
fi
done
# treetops gets an alternating list
# of old directories to copy
# and the new directories to copy to.
treetops="${INPUT} ${LIB}"
set - $treetops
while [ $# != 0 ]; do
# $1 is an old directory to copy, and $2 is the new directory to copy to.
echo "Finding header files in $1:"
cd ${INPUT}
cd $1
files=`find . -name '*.[hH]' -type f -print`
echo "Checking header files in $1; transforming into directory $2:"
for file in $files; do
echo " " $file
if [ -r $file ]; then
cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file"
chmod +w,a+r $2/$file
# The following have been removed from the sed command below
# because it is more useful to leave these things in.
# The only reason to remove them was for -pedantic,
# which isn't much of a reason. -- rms.
# ??? above/below
# /^[ ]*#[ ]*ident/d
# s/!__STDC__/!defined (__STRICT_ANSI__)/g
sed -e '/#[ ]*include.*[<"][A-Za-z]:\\/ s,\\,/,g' \
-e '/#[ ]*include.*[<"][A-Za-z]:\// s,\([A-Za-z]\):/,//\1/,' \
-e '\,#[ ]*include.*[<"]//[A-Za-z]/, y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,' \
-e '\,#[ ]*INCLUDE.*[<"]//[A-Za-z]/, s,INCLUDE,include,' \
$2/$file > $2/$file.sed
mv $2/$file.sed $2/$file
if cmp $file $2/$file >/dev/null 2>&1; then
rm $2/$file
else
echo Fixed $file
flip -u $2/$file
fi
fi
done
shift; shift
done
echo 'Removing unneeded directories:'
# (Rmdir leaf to root, and if the rmdir fails, who cares....)
cd $LIB
files=`find . -type d -print | sort -r`
for file in $files; do
rmdir $LIB/$file > /dev/null 2>&1
done
exit 0