[prev in list] [next in list] [prev in thread] [next in thread]
List: pcc-list
Subject: Overriding default as and ld
From: Gregory McGarry <greg () bitlynx ! com>
Date: 2007-11-28 2:13:27
Message-ID: 7D171DE0-688C-4DC1-91A7-5D093809FE45 () bitlynx ! com
[Download RAW message or body]
Here is a patch to configure and cc.c to support overriding the
default as and ld. Configure now has options
--with-assembler=<path>
--with-linker=<path>
--with-stdinc=<path>
So now the following command will successfully generate a cross-
compiler for me with minimal pain:
./configure --with-assembler=mips-as --with-linker=mips-ld --with-
stdinc=/usr/local/mipsel-netbsdelf/include --target=mipsel-netbsdelf
Index: configure.ac
===================================================================
RCS file: /cvsroot/pcc/configure.ac,v
retrieving revision 1.32
diff -u -r1.32 configure.ac
--- configure.ac 26 Nov 2007 05:12:08 -0000 1.32
+++ configure.ac 28 Nov 2007 01:59:24 -0000
@@ -84,13 +84,52 @@
fi
if test "X$endian" = "Xbig" ; then
- AC_DEFINE(TARGET_BIG_ENDIAN, 1, [target byteorder is big endian])
+ AC_DEFINE(TARGET_BIG_ENDIAN, 1, [Target is BIG endian])
else
- AC_DEFINE(TARGET_LITTLE_ENDIAN, 1, [target byteorder is little
endian])
+ AC_DEFINE(TARGET_LITTLE_ENDIAN, 1, [Target is LITTLE endian])
fi
# Byteorder of host
-AC_C_BIGENDIAN([AC_DEFINE(HOST_BIG_ENDIAN,[],[Host is BIG endian])],
[AC_DEFINE(HOST_LITTLE_ENDIAN,[],[Host is LITTLE endian])],,)
+AC_C_BIGENDIAN([AC_DEFINE(HOST_BIG_ENDIAN,[],[Host is BIG endian])],
+ [AC_DEFINE(HOST_LITTLE_ENDIAN,[],[Host is LITTLE endian])],
+ [],[])
+
+# Whether the host has <stab.h> and whether the user wants it disabled.
+AC_ARG_ENABLE(stabs,
+ AC_HELP_STRING([--disable-stabs],
+ [Disable stabs debugging information.]),
+ enable_stabs = $enableval,
+ enable_stabs = yes)
+AC_CHECK_HEADERS([stab.h],have_stabs=yes,have_stabs=no)
+if test "X$enable_stabs" == "Xyes"; then
+ if test "X$have_stabs" != "Xyes"; then
+ AC_MSG_ERROR([Cannot find <stab.h>. \
+ Try using --disable-stabs])
+ else
+ AC_DEFINE(STABS, [], [Define to 1 if you want stabs \
+ debugging information])
+ fi
+fi
+
+# Specify alternative assembler, linker and include path
+AC_ARG_WITH(assembler,
+ AC_HELP_STRING([--with-assembler=<path>],
+ [Specify alternative assember.]),
+ AC_DEFINE_UNQUOTED(ASSEMBLER, "$withval",
+ [Path to alternative assembler]),
+ [])
+AC_ARG_WITH(linker,
+ AC_HELP_STRING([--with-linker=<path>],
+ [Specify alternative linker.]),
+ AC_DEFINE_UNQUOTED(LINKER, "$withval",
+ [Path to alternative linker]),
+ [])
+AC_ARG_WITH(stdinc,
+ AC_HELP_STRING([--with-stdinc=<path>],
+ [Specify the standard include path.]),
+ AC_DEFINE_UNQUOTED(STDINC, "$withval",
+ [Alternative stdinc directory]),
+ [])
# Checks for programs.
AC_PROG_CC
@@ -125,13 +164,13 @@
pcc_minorminor=`echo $PACKAGE_VERSION | awk -F. '{print $3}'`
versstr="\"$PACKAGE_STRING for $target, $USER@`hostname` `date`\""
-AC_DEFINE_UNQUOTED(TARGOS, $targos,[Target OS])
-AC_DEFINE_UNQUOTED(PCC_MAJOR, $pcc_major,[Major version no])
-AC_DEFINE_UNQUOTED(PCC_MINOR, $pcc_minor,[Minor version no])
-AC_DEFINE_UNQUOTED(PCC_MINORMINOR, $pcc_minorminor,[Minor minor
verions no])
-AC_DEFINE_UNQUOTED(VERSSTR, $versstr,[Version string])
+AC_DEFINE_UNQUOTED(TARGOS, $targos, [Target OS])
+AC_DEFINE_UNQUOTED(PCC_MAJOR, $pcc_major, [Major version no])
+AC_DEFINE_UNQUOTED(PCC_MINOR, $pcc_minor, [Minor version no])
+AC_DEFINE_UNQUOTED(PCC_MINORMINOR, $pcc_minorminor, [Minor minor
verions no])
+AC_DEFINE_UNQUOTED(VERSSTR, $versstr, [Version string])
if test "$LEX" = flex ; then
- AC_DEFINE_UNQUOTED(ISFLEX, 1,[lex is flex])
+ AC_DEFINE_UNQUOTED(ISFLEX, 1, [lex is flex])
fi
AC_CONFIG_FILES([Makefile
Index: cc.c
===================================================================
RCS file: /cvsroot/pcc/cc/cc/cc.c,v
retrieving revision 1.78
diff -u -r1.78 cc.c
--- cc.c 26 Nov 2007 05:08:07 -0000 1.78
+++ cc.c 28 Nov 2007 01:59:51 -0000
@@ -1,4 +1,4 @@
-/* $Id: cc.c,v 1.78 2007/11/26 05:08:07 gmcgarry Exp $ */
+/* $Id: cc.c,v 1.77 2007/11/22 21:42:39 stefan Exp $ */
/*
* Copyright(C) Caldera International Inc. 2001-2002. All rights
reserved.
*
@@ -71,7 +71,18 @@
/*
* Many specific definitions, should be declared elsewhere.
*/
-#define STDINC "/usr/include/"
+
+#ifndef STDINC
+#define STDINC "/usr/include/"
+#endif
+
+#ifndef ASSEMBLER
+#define ASSEMBLER "as"
+#endif
+
+#ifndef LINKER
+#define LINKER "ld"
+#endif
#define MAXFIL 10000
#define MAXLIB 10000
@@ -123,6 +134,8 @@
char *pass0 = LIBEXECDIR "/ccom";
char *passp = LIBEXECDIR "/cpp";
+char *as = ASSEMBLER;
+char *ld = LINKER;
char *Bflag;
char *cppadd[] = CPPADD;
char *dynlinker[] = DYNLINKER;
@@ -477,7 +490,7 @@
*/
assemble:
na = 0;
- av[na++] = "as";
+ av[na++] = as;
if (vflag)
av[na++] = "-v";
if (kflag)
@@ -491,7 +504,7 @@
if (dflag)
av[na++] = alist;
av[na++] = 0;
- if (callsys("/bin/as", av)) {
+ if (callsys(as, av)) {
cflag++;
eflag++;
cunlink(tmp4);
@@ -509,7 +522,7 @@
nocom:
if (cflag==0 && nl!=0) {
j = 0;
- av[j++] = "ld";
+ av[j++] = ld;
if (vflag)
av[j++] = "-v";
av[j++] = "-X";
@@ -552,7 +565,7 @@
av[j++] = endfiles[i];
}
av[j++] = 0;
- eflag |= callsys("/bin/ld", av);
+ eflag |= callsys(ld, av);
if (nc==1 && nxo==1 && eflag==0)
cunlink(setsuf(clist[0], 'o'));
else if (nc > 0 && eflag == 0) {
@@ -676,7 +689,7 @@
execv(a, v);
}
}
- execv(f, v);
+ execvp(f, v);
if ((s = strrchr(f, '/')))
execvp(s+1, v);
fprintf(stderr, "Can't find %s\n", f);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic