Brent Dax:
# Sent: Thursday, September 13, 2001 14:17
# To: Simon Cozens; [EMAIL PROTECTED]
# Subject: RE: Things we need to do.
#
#
# Simon Cozens:
# #     2) Extend the Configure.pl system to autogenerate the
# #        Makefile as well. Use Makefile.in as a template, and
# #        fill in things like LIBS.
#
# I'll take care of Configure.pl. This will also give me a chance to let
# you select a different C compiler, which may help on Windows.  (My
# system has a copy of gcc with DJGPP, but it's broken somehow--keeps
# complaining about compiling header files.)

It didn't take very long.  Patch for Configure.pl below my sig (yes, I
finally did get PPT to work); delete Makefile and add the attached
Makefile.in.

--Brent Dax
[EMAIL PROTECTED]

They *will* pay for what they've done.


--- Configure.pl.old    Thu Sep 13 15:34:06 2001
+++ Configure.pl        Thu Sep 13 15:31:34 2001
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 #so we get -w

-#Configre.pl, written by Brent Dax
+#Configure.pl, written by Brent Dax

 use strict;
 use Config;
@@ -22,11 +22,18 @@
 #defaults for them.
 #XXX Figure out better defaults
 my(%c)=(
-       iv => ($Config{ivtype}||'long'),
-       nv => ($Config{nvtype}||'long double')
+       iv =>           ($Config{ivtype}||'long'),
+       nv =>           ($Config{nvtype}||'long double'),
+       cc =>           $Config{cc},
+       ccflags =>      '-Wall -o $@',
+       libs =>         $Config{libs}
 );

 #inquire about numeric sizes
+
+prompt("What C compiler do you want to use?", 'cc');
+prompt("What flags would you like passed to your C compiler?",
'ccflags');
+prompt("Which libraries would you like your C compiler to include?" ,
'libs');
 prompt("How big would you like integers to be?", 'iv');
 prompt("How about your floats?", 'nv');

@@ -43,22 +50,16 @@
        $c{headers}.=defineifdef((/^i_(.*)$/));
 }

-#now let's assemble the config.h file
-my $config_h;
-{
-       local $/;
-       open(CONFIG_HT, "<config.h.in") or die $!;
-       $config_h=<CONFIG_HT>;
-       close CONFIG_HT;
-}
+print <<"END";

-# ${field} is replaced with $c{field}
-$config_h =~ s/\$\{(\w+)\}/$c{$1}/g;
+Okay, that's finished.  I'm now going to write your very
+own Makefile and config.h to disk.
+END

-#write out the config.h file
-open(CONFIG_H, ">config.h");
-print CONFIG_H $config_h;
-close CONFIG_H;
+#now let's assemble the config.h file
+buildfile("config.h");
+#and the makefile
+buildfile("Makefile");

 print <<"END";

@@ -91,3 +92,17 @@
        $c{$field}=$input||$c{$field};
 }

+sub buildfile {
+       my($filename)=shift;
+
+       local $/;
+       open(IN, "<$filename.in");
+       my $text=<IN>;
+       close(IN);
+
+       $text =~ s/\$\{(\w+)\}/$c{$1}/g;
+
+       open(OUT, ">$filename");
+       print OUT $text;
+       close(OUT);
+}

Makefile.in

Reply via email to