configure autodetection problem

Started by Daniel Kalchevover 27 years ago1 messages
#1Daniel Kalchev
daniel@digsys.bg
1 attachment(s)

I am experimenting to compile postgresql-snapshot [Sep 15 07:01] on BSD/OS 3.1

configure however chooses the bsdi_4.0 template. (which uses different kind of
shared libraries)

Upon investigation, it turns out that there is template/.similar file that
'helps' configure choose the proper template with fewer hard-coded
instructions.
For BSD/OS it lists:

i386-pc-bsdi2.0=bsdi_2.0
i386-pc-bsdi2.1=bsdi_2.1
i386-pc-bsdi3.0=bsdi_2.1
i386-pc-bsdi4.0=bsdi_4.0

I tried adding

i386-pc-bsdi3.1=bsdi_2.1

there but the result was the same.

It turns out, that configure executes

GUESS=`grep "$host_no_ver" template/.similar | sed 's/.*=//' | tail -1`

to guess the template... but earlier host_no_ver is set using

host_no_ver=`echo "$host" | sed 's/[0-9.]*$//'`

which in my cases results in

i386-pc-bsdi

which apparently matches all rows in the .similar file and returns the last
one...

I understand the reasons to have such 'automatism', to pick the latest version
if other is not defined in the .similar file, but apparently this should pick
the longest match first.

Which can be done using two-pass selection, first with using '$host', then
with using '$host_no_ver' in configure.

The enclosed patch does that.

Daniel

Attachments:

atext/plain; charset=us-ascii; name=aDownload
*** configure.orig	Tue Sep 15 14:26:23 1998
--- configure	Tue Sep 15 14:28:20 1998
***************
*** 672,682 ****
    withval="$with_template"
      TEMPLATE=$withval 
  else
!     host_no_ver=`echo "$host" | sed 's/[0-9.]*$//'`
!        GUESS=`grep "$host_no_ver" template/.similar | sed 's/.*=//' | tail -1`
         if test "$GUESS"
         then	TEMPLATE="$GUESS"
!        else	TEMPLATE=`uname -s | tr A-Z a-z` 
         fi
      
  fi
--- 672,687 ----
    withval="$with_template"
      TEMPLATE=$withval 
  else
!        GUESS=`grep "$host" template/.similar | sed 's/.*=//' | tail -1`
         if test "$GUESS"
         then	TEMPLATE="$GUESS"
!        else
! 	  host_no_ver=`echo "$host" | sed 's/[0-9.]*$//'`
!           GUESS=`grep "$host_no_ver" template/.similar | sed 's/.*=//' | tail -1`
!           if test "$GUESS"
!           then TEMPLATE="$GUESS"
!           else	TEMPLATE=`uname -s | tr A-Z a-z` 
!           fi
         fi
      
  fi