delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/02/22/10:54:05

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Date: Mon, 22 Feb 1999 16:52:09 +0100
From: Teun Burgers <burgers AT ecn DOT nl>
Subject: configure and cpp problem (Was: bug: missing include files in B20.1)
Sender: burgers AT ecn DOT nl
To: cygwin AT sourceware DOT cygnus DOT com
Message-id: <36D17D29.58E89B39@ecn.nl>
Organization: Netherlands Energy Research Foundation ECN
X-Envelope-to: cygwin AT sourceware DOT cygnus DOT com
MIME-version: 1.0
X-Mailer: Mozilla 4.5 [en] (X11; I; OSF1 V4.0 alpha)
X-Accept-Language: nl

--------------7DE82A4CE3601ADA9731F21D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

There is a problem that the configure script for
perl 5002.02 can not find stdarg.h for cygnus B20.1.
This turns out to be caused by the location of stdarg.h in
combination with bugs in the configure script and non-unixy
output of the C preprocessor gcc -E. This mesage contains
a fix for the configure script that solves the problem.

stdarg.h (and varargs.h, float.h, stddef.h) are
in the H-i586-cygwin32/lib/gcc-lib/egcs-2.91.57/include directory,
but not in the H-i586-cygwin32/i586-cygwin32/include directory from
the B20 full.exe distribution where most include files reside.

The configure script (relevant part in fhdr.old) creates
a script findhdr that looks for the header file. findhr first
simply tests for existance (test -f) of the .h file in
H-i586-cygwin32/i586-cygwin32/include and if not found there
it uses the C preprocessor gcc -E -.

Because stdarg.h is not found in the first step it must be found
in the second step. This second step goes wrong for two reasons:

1) the shell scripts tests whether the expanded include file
   name by gcc -E matches */stdarg.h. This test fails because
   gcc returns a DOS filename with \ e.g.
   d:\\cygnus\\cygwin-b20  etc, so it does not match.

   There are two solutions:
   - change the matching condition in findhdr from
     */stdarg.h  to  *[/\\]stdarg.h
   - make gcc -E - return a unixy file name

2) Even with this test fixed it still goes wrong.
   This seems to be a bug in the configure script.
   The configure scripts sets variable name in a while
   loop that is the end of a pipe. Because the while is
   in a pipe, it runs in a subshell and variable settings
   are local to that subshell.

The fhdr.new file fixes both problems.

Thanks to Mumit for his suggestions

references:

http://sourceware.cygnus.com/ml/cygwin/1999-02/msg00616.html
http://sourceware.cygnus.com/ml/cygwin/1999-02/msg00512.html
http://www.cygnus.com/ml/gnu-win32/1998-Nov/0399.html

-- 
Drs A.R. Burgers        Netherlands Energy Research Foundation ECN
Phone: +31-224-564703   Renewable Energy, PV Cells & Modules
Fax  : +31-224-563214   P.O. Box 1
email: burgers AT ecn DOT nl   1755 ZG Petten, The Netherlands
--------------7DE82A4CE3601ADA9731F21D
Content-Type: text/plain; charset=us-ascii;
 name="fhdr.new"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="fhdr.new"

#!/bin/bash


startsh='#!/bin/sh.exe'
usrinc='//d/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include'
awk='//d/cygnus/cygwin-b20/H-i586-cygwin32/bin/awk.exe'
cat='//d/cygnus/cygwin-b20/H-i586-cygwin32/bin/cat.exe'
rm='//d/cygnus/cygwin-b20/H-i586-cygwin32/bin/rm.exe'
tr='//d/cygnus/cygwin-b20/H-i586-cygwin32/bin/tr.exe'
grep='//d/cygnus/cygwin-b20/H-i586-cygwin32/bin/grep.exe'

fieldn='3'
cppstdin='gcc2 -E'
cppminus='-'
cppflags=''

$cat >findhdr <<EOF
$startsh
wanted=\$1
if test -f $usrinc/\$wanted; then
	echo "$usrinc/\$wanted"
	exit 0
fi
awkprg='{ print \$$fieldn }'
echo "#include <\$wanted>" > foo\$\$.c
$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
$grep "^[ 	]*#.*\$wanted" | \
while read cline; do
	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
	case "\$name" in
	*[/\\\\]\$wanted) echo "\$name";exit 1;;
	*) exit 2;;
	esac;
done;
#
#status=0: grep returned 0 lines, case statement not executed
#status=1: headerfile found
#status=2: while loop executed, no headerfile found
#
status=\$?
$rm -f foo\$\$.c;
if test \$status -eq 1; then
	exit 0;
fi
exit 1;
EOF
chmod +x findhdr



--------------7DE82A4CE3601ADA9731F21D
Content-Type: text/plain; charset=us-ascii;
 name="fhdr.old"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="fhdr.old"

#!/bin/sh
$cat >findhdr <<EOF
$startsh
wanted=\$1
name=''
if test -f $usrinc/\$wanted; then
	echo "$usrinc/\$wanted"
	exit 0
fi
awkprg='{ print \$$fieldn }'
echo "#include <\$wanted>" > foo\$\$.c
$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
$grep "^[ 	]*#.*\$wanted" | \
while read cline; do
	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
	case "\$name" in
	*/\$wanted) echo "\$name"; exit 0;;
	*) name='';;
	esac;
done;
$rm -f foo\$\$.c;
case "\$name" in
'') exit 1;;
esac
EOF
chmod +x findhdr




--------------7DE82A4CE3601ADA9731F21D
Content-Type: text/plain; charset=

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
--------------7DE82A4CE3601ADA9731F21D--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019