bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] 4.7: Changes to permit cross-compiling


From: Maciej W. Rozycki
Subject: [patch] 4.7: Changes to permit cross-compiling
Date: Fri, 30 Jul 2004 15:03:24 +0200 (CEST)

Hello,

 As of 4.7 texinfo assumes a native compiling environment by attempting to 
execute programs built for the host.  This obviously doesn't work if 
cross-compiling.  Here is an attempt to let cross-compilation work.

 To minimize changes, in the case of cross-compiling `makeinfo' and
`install-info' programs already installed in the build system are used.  
Since the `makedoc' program is never installed, but executed during
compilation, it's built with a compiler for the build system.

2004-07-30  Maciej W. Rozycki  <address@hidden>

        * configure.ac: Set CC_FOR_BUILD.  Use installed makeinfo and 
        install-info if cross-compiling.
        * configure: Regenerate.
        * doc/Makefile.am: Subst MAKEINFO and INSTALL_INFO from configure.
        * doc/Makefile.in: Regenerate.
        * info/Makefile.am: Build makedoc with CC_FOR_BUILD.
        * info/Makefile.in: Regenerate.
        * info/makedoc.c: Rename x-functions throughout to standard C 
        library ones to build in a simple environment.

 Please consider.

  Maciej

texinfo-4.7-cross.patch
diff -up --recursive --new-file texinfo-4.7.macro/configure.ac 
texinfo-4.7/configure.ac
--- texinfo-4.7.macro/configure.ac      2004-04-09 21:21:56.000000000 +0000
+++ texinfo-4.7/configure.ac    2004-06-05 19:24:51.000000000 +0000
@@ -29,6 +29,19 @@ AC_PROG_MAKE_SET
 AC_PROG_RANLIB
 AM_MISSING_PROG(HELP2MAN, help2man)
 
+if test "x$cross_compiling" = xyes; then
+  test "${CC_FOR_BUILD+set}" = set || CC_FOR_BUILD="$CC"
+  AC_PATH_PROG(MAKEINFO, makeinfo)
+  AC_PATH_PROG(INSTALL_INFO, install-info)
+else
+  CC_FOR_BUILD="$CC"
+  MAKEINFO=../makeinfo/makeinfo
+  INSTALL_INFO=../util/install-info
+  AC_SUBST(MAKEINFO)
+  AC_SUBST(INSTALL_INFO)
+fi
+AC_SUBST(CC_FOR_BUILD)
+
 AC_ISC_POSIX
 AC_MINIX
 
diff -up --recursive --new-file texinfo-4.7.macro/doc/Makefile.am 
texinfo-4.7/doc/Makefile.am
--- texinfo-4.7.macro/doc/Makefile.am   2003-12-06 01:31:15.000000000 +0000
+++ texinfo-4.7/doc/Makefile.am 2004-06-05 19:24:51.000000000 +0000
@@ -18,8 +18,8 @@ man_MANS = info.1 infokey.1 install-info
            info.5 texinfo.5
 
 # Use the programs built in our distribution.
-MAKEINFO = ../makeinfo/makeinfo
-INSTALL_INFO = ../util/install-info
+MAKEINFO = @MAKEINFO@
+INSTALL_INFO = @INSTALL_INFO@
 
 TXI_XLATE = txi-cs.tex txi-de.tex txi-en.tex txi-es.tex txi-fr.tex \
            txi-it.tex txi-nl.tex txi-no.tex txi-pl.tex txi-pt.tex txi-tr.tex
diff -up --recursive --new-file texinfo-4.7.macro/info/Makefile.am 
texinfo-4.7/info/Makefile.am
--- texinfo-4.7.macro/info/Makefile.am  2004-01-09 14:19:40.000000000 +0000
+++ texinfo-4.7/info/Makefile.am        2004-06-05 19:24:51.000000000 +0000
@@ -38,6 +38,8 @@ BUILT_SOURCES = doc.c funs.h key.c
 EXTRA_DIST = README pcterm.c $(BUILT_SOURCES)
 
 makedoc_SOURCES = makedoc.c
+makedoc_LDADD =
+
 ginfo_SOURCES = dir.c display.c display.h doc.h dribble.c dribble.h \
   echo-area.c echo-area.h \
   filesys.c filesys.h footnotes.c footnotes.h gc.c gc.h \
@@ -54,6 +56,18 @@ cmd_sources = $(srcdir)/session.c $(srcd
   $(srcdir)/m-x.c $(srcdir)/indices.c $(srcdir)/nodemenu.c \
   $(srcdir)/footnotes.c $(srcdir)/variables.c
 
+CC_FOR_BUILD = @CC_FOR_BUILD@
+COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(INCLUDES)
+CCLD_FOR_BUILD = $(CC_FOR_BUILD)
+LINK_FOR_BUILD = $(CCLD_FOR_BUILD) -o $@
+
+makedoc.o: makedoc.c
+       $(COMPILE_FOR_BUILD) -c $<
+
+makedoc$(EXEEXT): $(makedoc_OBJECTS)
+       @rm -f makedoc$(EXEEXT)
+       $(LINK_FOR_BUILD) $(makedoc_OBJECTS)
+
 # The $(EXEEXT) should be added by Automake, but isn't. Fine.
 $(BUILT_SOURCES): makedoc$(EXEEXT) $(cmd_sources)
        rm -f $(BUILT_SOURCES)
diff -up --recursive --new-file texinfo-4.7.macro/info/makedoc.c 
texinfo-4.7/info/makedoc.c
--- texinfo-4.7.macro/info/makedoc.c    2004-04-06 22:58:25.000000000 +0000
+++ texinfo-4.7/info/makedoc.c  2004-06-05 19:28:29.000000000 +0000
@@ -28,6 +28,8 @@
 #include "info.h"
 #include "infokey.h"
 
+#define xrealloc realloc
+
 static void fatal_file_error (char *filename);
 
 /* Name of the header file which receives the declarations of functions. */
@@ -287,8 +289,8 @@ make_emacs_tag_block (char *filename)
 {
   EMACS_TAG_BLOCK *block;
 
-  block = (EMACS_TAG_BLOCK *)xmalloc (sizeof (EMACS_TAG_BLOCK));
-  block->filename = xstrdup (filename);
+  block = (EMACS_TAG_BLOCK *)malloc (sizeof (EMACS_TAG_BLOCK));
+  block->filename = strdup (filename);
   block->entrylen = 0;
   block->entries = (EMACS_TAG **)NULL;
   block->entries_index = 0;
@@ -302,7 +304,7 @@ add_tag_to_block (EMACS_TAG_BLOCK *block
 {
   EMACS_TAG *tag;
 
-  tag = (EMACS_TAG *)xmalloc (sizeof (EMACS_TAG));
+  tag = (EMACS_TAG *)malloc (sizeof (EMACS_TAG));
   tag->name = name;
   tag->line = line;
   tag->char_offset = char_offset;
@@ -333,7 +335,7 @@ process_one_file (char *filename, FILE *
     fatal_file_error (filename);
 
   file_size = (long) finfo.st_size;
-  buffer = (char *)xmalloc (1 + file_size);
+  buffer = (char *)malloc (1 + file_size);
   /* On some systems, the buffer will actually contain
      less characters than the full file's size, because
      the CR characters are removed from line endings.  */
@@ -406,7 +408,7 @@ process_one_file (char *filename, FILE *
 
       /* Now looking at name of function.  Get it. */
       for (offset = point; buffer[offset] != ','; offset++);
-      func = (char *)xmalloc (1 + (offset - point));
+      func = (char *)malloc (1 + (offset - point));
       strncpy (func, buffer + point, offset - point);
       func[offset - point] = '\0';
 
@@ -414,7 +416,7 @@ process_one_file (char *filename, FILE *
       {
         char *tag_name;
 
-        tag_name = (char *)xmalloc (1 + (offset - line_start));
+        tag_name = (char *)malloc (1 + (offset - line_start));
         strncpy (tag_name, buffer + line_start, offset - line_start);
         tag_name[offset - line_start] = '\0';
         add_tag_to_block (block, tag_name, line_number, point);
@@ -431,14 +433,14 @@ process_one_file (char *filename, FILE *
         if (strncmp (name_start, "info_", 5) == 0)
           name_start += 5;
 
-        func_name = xstrdup (name_start);
+        func_name = strdup (name_start);
 
         /* Fix up "ea" commands. */
         if (strncmp (func_name, "ea_", 3) == 0)
           {
             char *temp_func_name;
 
-            temp_func_name = (char *)xmalloc (10 + strlen (func_name));
+            temp_func_name = (char *)malloc (10 + strlen (func_name));
             strcpy (temp_func_name, "echo_area_");
             strcat (temp_func_name, func_name + 3);
             free (func_name);
@@ -490,7 +492,7 @@ process_one_file (char *filename, FILE *
       if (offset >= file_size)
         break;
 
-      doc = (char *)xmalloc (1 + (offset - point));
+      doc = (char *)malloc (1 + (offset - point));
       strncpy (doc, buffer + point, offset - point);
       doc[offset - point] = '\0';
 
@@ -548,7 +550,7 @@ static void
 fatal_file_error (char *filename)
 {
   fprintf (stderr, _("Couldn't manipulate the file %s.\n"), filename);
-  xexit (2);
+  exit (2);
 }
 
 static FILE *




reply via email to

[Prev in Thread] Current Thread [Next in Thread]