# New Ticket Created by  Lars Balker Rasmussen 
# Please include the string:  [perl #22914]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22914 >


Having publically and repeatedly embarrassed myself on perl6-internals
today, I'll try posting to the right mailing list now.  Sigh.

gcc on FreeBSD (and I'd imagine others) complains over an fprintf
in exceptions.c.

malloc.h is deprecated on FreeBSD 5, and will make various
configuration tests fail.  The following patch tests for the validity
of malloc.h, and uses either malloc.h or stdlib.h in the tests.

And finally, a couple of small patches to Makefile, so test_main gets
removed when cleaning, and fixed a mention of test_main.o.

Cheers,
-- 
Lars Balker Rasmussen                                      Consult::Perl



-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/60590/44833/862c8a/exceptions.patch

-- attachment  2 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/60590/44834/0e7ceb/malloc.patch

-- attachment  3 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/60590/44835/dcb940/Makefile.patch

Index: exceptions.c
===================================================================
RCS file: /cvs/public/parrot/exceptions.c,v
retrieving revision 1.17
diff -u -a -r1.17 exceptions.c
--- exceptions.c	10 Jul 2003 16:56:46 -0000	1.17
+++ exceptions.c	11 Jul 2003 13:29:01 -0000
@@ -119,7 +119,7 @@
     } while (1);
     m = string_to_cstring(interpreter, message);
     if (m && *m) {
-        fprintf(stderr, m);
+        fputs(m, stderr);
         if (m[strlen(m-1)] != '\n')
             fprintf(stderr, "%c", '\n');
     }
Index: config/auto/headers.pl
===================================================================
RCS file: /cvs/public/parrot/config/auto/headers.pl,v
retrieving revision 1.7
diff -u -a -r1.7 headers.pl
--- config/auto/headers.pl	26 Jun 2003 13:11:22 -0000	1.7
+++ config/auto/headers.pl	11 Jul 2003 13:47:39 -0000
@@ -28,7 +28,7 @@
     # some headers may not be probed-for by perl 5, or might not be
     # properly reflected in %Config (i_fcntl seems to be wrong on my machine,
     # for instance).
-    my @extra_headers = qw(fcntl.h setjmp.h pthread.h signal.h);
+    my @extra_headers = qw(malloc.h fcntl.h setjmp.h pthread.h signal.h);
 
     foreach my $header (@extra_headers) {
         my $flag = "i_$header";
Index: config/auto/memalign.pl
===================================================================
RCS file: /cvs/public/parrot/config/auto/memalign.pl,v
retrieving revision 1.3
diff -u -a -r1.3 memalign.pl
--- config/auto/memalign.pl	11 Jun 2003 20:26:47 -0000	1.3
+++ config/auto/memalign.pl	11 Jul 2003 13:47:39 -0000
@@ -9,6 +9,13 @@
 sub runstep {
     my $test = 0;
 
+    if (Configure::Data->get('i_malloc')) {
+	Configure::Data->set('malloc_header', 'malloc.h');
+    }
+    else {
+	Configure::Data->set('malloc_header', 'stdlib.h');
+    }
+
     cc_gen('config/auto/memalign/test_c.in');
     eval { cc_build(); };
     unless ($@ || cc_run() !~ /ok/) {
@@ -24,6 +31,8 @@
 	$test2 = 1;
     }
     cc_clean();
+
+    Configure::Data->set('malloc_header', undef);
 
     my $f = $test2 ? 'posix_memalign' :
             $test  ? 'memalign'       : '';
Index: config/auto/signal.pl
===================================================================
RCS file: /cvs/public/parrot/config/auto/signal.pl,v
retrieving revision 1.2
diff -u -a -r1.2 signal.pl
--- config/auto/signal.pl	11 Jul 2003 12:25:06 -0000	1.2
+++ config/auto/signal.pl	11 Jul 2003 13:47:39 -0000
@@ -18,6 +18,14 @@
     if (defined $miniparrot) {
 	return;
     }
+
+    if (Configure::Data->get('i_malloc')) {
+	Configure::Data->set('malloc_header', 'malloc.h');
+    }
+    else {
+	Configure::Data->set('malloc_header', 'stdlib.h');
+    }
+
     cc_gen('config/auto/signal/test_1.in');
     eval { cc_build(); };
     unless ($@ || cc_run() !~ /ok/) {
@@ -37,6 +45,8 @@
 	print " (sigaction)";
     }
     cc_clean();
+
+    Configure::Data->set('malloc_header', undef);
 
     # now generate signal constants
     open O, ">runtime/parrot/include/signal.pasm" or die
Index: config/auto/gc/test_c.in
===================================================================
RCS file: /cvs/public/parrot/config/auto/gc/test_c.in,v
retrieving revision 1.1
diff -u -a -r1.1 test_c.in
--- config/auto/gc/test_c.in	5 Oct 2002 09:40:35 -0000	1.1
+++ config/auto/gc/test_c.in	11 Jul 2003 13:47:39 -0000
@@ -4,7 +4,7 @@
  * This file is automatically generated by Configure
  * from gc.in.
  */
-#include <malloc.h>
+#include <${malloc_header}>
 #include <stdio.h>
 int main(int argc, char **argv) {
         void *p = malloc(128);
Index: config/auto/memalign/test_c.in
===================================================================
RCS file: /cvs/public/parrot/config/auto/memalign/test_c.in,v
retrieving revision 1.3
diff -u -a -r1.3 test_c.in
--- config/auto/memalign/test_c.in	19 Jun 2003 14:39:18 -0000	1.3
+++ config/auto/memalign/test_c.in	11 Jul 2003 13:47:39 -0000
@@ -4,7 +4,7 @@
  * This file is automatically generated by Configure
  * from test_c.in.
  */
-#include <malloc.h>
+#include <${malloc_header}>
 #include <stdio.h>
 
 int main(int argc, char **argv) {
Index: config/auto/memalign/test_c2.in
===================================================================
RCS file: /cvs/public/parrot/config/auto/memalign/test_c2.in,v
retrieving revision 1.2
diff -u -a -r1.2 test_c2.in
--- config/auto/memalign/test_c2.in	19 Jun 2003 14:39:18 -0000	1.2
+++ config/auto/memalign/test_c2.in	11 Jul 2003 13:47:39 -0000
@@ -4,7 +4,7 @@
  * This file is automatically generated by Configure
  * from test_c.in.
  */
-#include <malloc.h>
+#include <${malloc_header}>
 #include <stdlib.h>
 #include <stdio.h>
 
Index: config/auto/signal/test_1.in
===================================================================
RCS file: /cvs/public/parrot/config/auto/signal/test_1.in,v
retrieving revision 1.2
diff -u -a -r1.2 test_1.in
--- config/auto/signal/test_1.in	11 Jul 2003 12:25:10 -0000	1.2
+++ config/auto/signal/test_1.in	11 Jul 2003 13:47:39 -0000
@@ -4,7 +4,7 @@
  * This file is automatically generated by Configure
  * from test_1.in.
  */
-#include <malloc.h>
+#include <${malloc_header}>
 #include <stdio.h>
 #include <signal.h>
 
Index: config/auto/signal/test_2.in
===================================================================
RCS file: /cvs/public/parrot/config/auto/signal/test_2.in,v
retrieving revision 1.1
diff -u -a -r1.1 test_2.in
--- config/auto/signal/test_2.in	11 Jul 2003 11:31:55 -0000	1.1
+++ config/auto/signal/test_2.in	11 Jul 2003 13:47:39 -0000
@@ -4,7 +4,7 @@
  * This file is automatically generated by Configure
  * from test_2.in.
  */
-#include <malloc.h>
+#include <${malloc_header}>
 #include <stdio.h>
 #include <signal.h>
 
Index: config/gen/platform/generic.c
===================================================================
RCS file: /cvs/public/parrot/config/gen/platform/generic.c,v
retrieving revision 1.11
diff -u -a -r1.11 generic.c
--- config/gen/platform/generic.c	11 Jul 2003 11:31:59 -0000	1.11
+++ config/gen/platform/generic.c	11 Jul 2003 13:47:39 -0000
@@ -156,7 +156,12 @@
 }
 
 #elif defined(HAS_MEMALIGN)
+
+#if defined(HAS_HEADER_MALLOC)
 #include <malloc.h>
+#else
+#include <stdlib.h>
+#endif
 
 void *
 Parrot_memalign(size_t align, size_t size)
Index: config/gen/makefiles/root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.92
diff -u -a -r1.92 root.in
--- config/gen/makefiles/root.in	11 Jul 2003 11:31:58 -0000	1.92
+++ config/gen/makefiles/root.in	11 Jul 2003 13:47:39 -0000
@@ -615,7 +615,7 @@
 
 progclean:
 	$(RM_F) $(O_FILES) \
-	        $(TEST_PROG) test_main$(O) \
+	        $(TEST_PROG) test_main$(O) test_main$(EXE) \
 	        $(PDUMP) pdump$(O) packdump$(O) \
 	        $(PDB) pdb$(O) \
 	        $(DIS) disassemble$(O)
@@ -704,7 +704,7 @@
 	@tools/dev/rebuild_miniparrot.pl --action=copy_src $(GEN_CONFIGS) $(FLUID_FILES) $(ALL_H_FILES)
 	@tools/dev/rebuild_miniparrot.pl --action=copy_src classes/*.h test_main.c $(INC)/debug.h
 	@tools/dev/rebuild_miniparrot.pl --action=copy_src_from_obj $(O_FILES)
-	@tools/dev/rebuild_miniparrot.pl --action=write_buildscripts --executable=parrot $(O_FILES) test_main.o
+	@tools/dev/rebuild_miniparrot.pl --action=write_buildscripts --executable=parrot $(O_FILES) test_main$(O)
 
 miniparrot-update :
 	tools/dev/rebuild_miniparrot.pl

Reply via email to