Hello Tim,

I looked at the ./configure script so I can reply more specifically
now. 

root <[EMAIL PROTECTED]> writes:

> The issue, as i understand it, is not that the configure script
> doesn't work on the systems where it was tested. The issue is that
> the configure script is not robust. Certain problems have to be
> decided.

I understand, this is the issue faced by all ./configure scripts.

You have two options to make it more robust:

 1. use the ./configure generated by autoconf tools. There is a lot of
    knowledge in them, but most of this knowledge is not needed for
    Axiom:

    - who needs to build Axiom on outdated systems like Ultrix?

    - most of autoconf knowledge is related to C issues, while most
      Axiom issues are Lisp ones (once GCL is built, and GCL is using
      autoconf),

    - when the generated configure script fails, it is a nightmare to
      understand *what* is going wrong;

 2. continue with the current hand-written script. It seems to me the
    most manageable way to *understand* what is happening and to solve
    portability issues.


> Given a particular system you need to output a symbol (e.g linux)
> which will be used selector for the inital Makefile. 
[...]
> In addition there are some other issues that arise. The noweb tool
> seems to want to use one of 'awk', 'gawk', or 'nawk'. Given that
> noweb is vital to the early processing we need to find which of
> the three is available on the current system and customize the
> main Makefile to use it. This is done on the command line:
>
>    make -f Makefile.linux AWK=nawk

This is currently done by the current configure script, right?

> Some systems use differen tool names (e.g. gtar) and those have to
> be able to be overriden also. However, given that it is a lot of
> effort to make sure axiom works on each new system all of this
> knowledge is embedded in the Makefile.pamphlet and selected by
> the system symbol ("solaris" ==> gtar).

This approach seems perfectly right to me.

> Another issue has arisen. It appears that some of the shell
> scripts aren't portable because they use #! paths to execute them.

However, this sentence is *very* surprising! #! has its origins to the
first Unix. On which system did #! failed? Any specific keyword so I can
google it (I already tried but found nothing)?

> Perhaps the configure program can help with the initial value
> selections but it would take some careful thought. It's probably
> better and more robust to rewrite the shell scripts not to use #!

I don't think so. Even autoconf's generated ./configure is using 
"#! /bin/sh".


After reading the current ./configure script, it seems relatively well
written and portable to me. I noticed a few things however:

 - better write:
fun () 
{

   instead of:
fun () {

 - use "exit 1" on error: 0 is ok return code for shells;

 - the "!" is said to be non portable and should not be used[1];

 - the equality of strings is "==", not "=" (as far as I know);

 - the handle the several tests, one could use a "case" shell
   construct. It would probably be cleaner. ("fix" not included in
   following patch)

Here is a patch that intend to fix those issues. Anybody willing to test
it on non Debian Linux system?

--- GOLD/axiom/configure	2005-06-05 05:59:28.000000000 +0200
+++ config/axiom/configure	2006-02-22 20:36:57.439491928 +0100
@@ -1,3 +1,5 @@
+#! /bin/sh
+
 # The sysname function uses uname -s to try to decode what kind of
 # system to build. Currently the return value of uname is mapped as
 #       Linux          --> linux
@@ -8,7 +10,8 @@
 #
 # The solaris platform needs patch->gpatch, awk->gawk, tar->gtar
 
-sysname () {
+sysname () 
+{
 if [ -f /etc/redhat-release ] ;
  then 
   SYSNAME=`cat /etc/redhat-release` 
@@ -21,16 +24,16 @@
  then
    SYSNAME=`uname -s`
    echo $SYSNAME 
-   if [ "$SYSNAME" = "Linux" ] ; then SYSNAME=linux
-   elif  [ "$SYSNAME" = "MINGW32_NT-5.1" ] ; then SYSNAME=windows
-   elif  [ "$SYSNAME" = "SunOS" ] ; then SYSNAME=solaris9
-   elif  [ "$SYSNAME" = "freebsd" ] ; then SYSNAME=freebsd
+   if [ "$SYSNAME" == "Linux" ] ; then SYSNAME=linux
+   elif  [ "$SYSNAME" == "MINGW32_NT-5.1" ] ; then SYSNAME=windows
+   elif  [ "$SYSNAME" == "SunOS" ] ; then SYSNAME=solaris9
+   elif  [ "$SYSNAME" == "freebsd" ] ; then SYSNAME=freebsd
    else
      echo Your system name is $SYSNAME
      echo We do not know how to build for this kind of system
      echo Send a note to [email protected] about it
      echo
-     exit 0
+     exit 1
    fi
 fi
 
@@ -39,7 +42,8 @@
 # This function checks for the gawk command. 
 # If it exists then AWKNAME is the complete pathname
 
-checkgawk() {
+checkgawk() 
+{
 AWKNAME=`which gawk 2>>trace`
 if [ -n "$AWKNAME" ] ; then
  if [ -x $AWKNAME ] ; then 
@@ -51,7 +55,8 @@
 # This function checks for the nawk command. 
 # If it exists then AWKNAME is the complete pathname
 
-checknawk() {
+checknawk() 
+{
 AWKNAME=`which nawk 2>>trace`
 if [ -n "$AWKNAME" ] ; then
  if [ -x $AWKNAME ] ; then 
@@ -63,7 +68,8 @@
 # This function checks for the awk command. 
 # If it exists then AWKNAME is the complete pathname
 
-checkawk() {
+checkawk() 
+{
 AWKNAME=`which awk 2>>trace`
 if [ -n "$AWKNAME" ] ; then
  if [ -x $AWKNAME ] ; then 
@@ -84,7 +90,7 @@
     checkawk
     if [ -z "$AWKNAME" ] ; then
       echo We need the commands gawk, nawk, or awk
-      exit 0
+      exit 1
     fi
   fi
 fi
@@ -101,7 +107,8 @@
 
 # We generate the appropriate command line that the user should use.
 
-mustSet() {
+mustSet() 
+{
 echo
 echo ===================================================
 echo You must set your AXIOM and PATH variables. Type:
@@ -110,16 +117,16 @@
 echo
 echo export AXIOM=`pwd`/mnt/$SYSNAME
 echo 'export PATH=$AXIOM/bin:$PATH'
-if [ "$SYSNAME" = "freebsd" ] ; then
+if [ "$SYSNAME" == "freebsd" ] ; then
   echo Note that freebsd usually has noweb available
   echo If you wish to use the standard version you must type
   echo touch noweb 
   echo If you wish to use a pre-installed GCL you must type
   echo make GCLVERSION=gcl-system
 fi
-if [ "$SYSNAME" = "solaris9" ] ; 
+if [ "$SYSNAME" == "solaris9" ] ; 
  then echo make AWK=gawk TAR=gtar PATCH=gpatch
-elif [ "`basename $AWKNAME`" = "gawk"  ] ; 
+elif [ "`basename $AWKNAME`" == "gawk"  ] ; 
  then echo make
  else echo make AWK=$AWKNAME
 fi
@@ -146,10 +153,10 @@
 sysname
 needAwk
 
-if [ "x$AXIOM" = "x" ] ;
+if [ "x$AXIOM" == "x" ] ;
  then mustSet
  else 
-  if [ ! "`dirname $AXIOM`" = "`pwd`/mnt" ]
+  if [ "`dirname $AXIOM`" != "`pwd`/mnt" ]
     then mustSet
     else 
      echo Configure complete. Now type


Regarding the current unsatisfying approach where the user need to type
export commands, I propose following solution (not included in above
patch):

 - ./configure generates a "Makefile.config" file. This makefile
   contains the needed variable definition;

 - file "Makefile.config" is included by main Makefile with an "include"
   directive. The main Makefile in turn generates Makefile.linux and
   calls it as usual.

What do you think of it? From my readings, the "include" make directive
is portable[2].


Best wishes,
d.

Footnotes: 
[1]  
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_chapter/autoconf_10.html#SEC122
<<<
 !

    You can't use !; you'll have to rewrite your code.
>>>

[2]  Autoconf manual, section 10. Portable Shell Programming
     
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_chapter/autoconf_10.html#SEC114

-- 
David MENTRE <[EMAIL PROTECTED]> -- http://wiki.axiom-developer.org/FrontPage
_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to