The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1999 Jarkko Hietaniemi
?RCS:
?RCS: You may distribute under the terms of either the GNU General Public
?RCS: License or the Artistic License, as specified in the README file.
?RCS:
?MAKE:d_PRIfldbl sPRIfldbl d_PRIgldbl d_PRIFUldbl sPRIGUldbl d_PRIEUldbl \
	sPRIgldbl d_PRIeldbl sPRIeldbl sPRIFUldbl d_PRIGUldbl sPRIEUldbl \
	d_SCNfldbl \
	sSCNfldbl: \
	d_longdbl longdblsize doublesize test cat rm \
	Setvar Compile run
?MAKE:	-pick add $@ %<
?S:d_PRIfldbl:
?S:	This variable conditionally defines the PERL_PRIfldbl symbol, which
?S:	indiciates that stdio has a symbol to print long doubles.
?S:.
?S:d_PRIgldbl:
?S:	This variable conditionally defines the PERL_PRIfldbl symbol, which
?S:	indiciates that stdio has a symbol to print long doubles.
?S:.
?S:d_PRIeldbl:
?S:	This variable conditionally defines the PERL_PRIfldbl symbol, which
?S:	indiciates that stdio has a symbol to print long doubles.
?S:.
?S:d_PRIFUldbl:
?S:	This variable conditionally defines the PERL_PRIfldbl symbol, which
?S:	indiciates that stdio has a symbol to print long doubles.
?S:	The 'U' in the name is to separate this from d_PRIfldbl so that even
?S:	case-blind systems can see the difference.
?S:.
?S:d_PRIGUldbl:
?S:	This variable conditionally defines the PERL_PRIfldbl symbol, which
?S:	indiciates that stdio has a symbol to print long doubles.
?S:	The 'U' in the name is to separate this from d_PRIgldbl so that even
?S:	case-blind systems can see the difference.
?S:.
?S:d_PRIEUldbl:
?S:	This variable conditionally defines the PERL_PRIfldbl symbol, which
?S:	indiciates that stdio has a symbol to print long doubles.
?S:	The 'U' in the name is to separate this from d_PRIeldbl so that even
?S:	case-blind systems can see the difference.
?S:.
?S:d_SCNfldbl:
?S:	This variable conditionally defines the PERL_PRIfldbl symbol, which
?S:	indiciates that stdio has a symbol to scan long doubles.
?S:.
?S:sPRIfldbl:
?S:	This variable, if defined, contains the string used by stdio to
?S:	format long doubles (format 'f') for output.
?S:.
?S:sPRIgldbl:
?S:	This variable, if defined, contains the string used by stdio to
?S:	format long doubles (format 'g') for output.
?S:.
?S:sPRIeldbl:
?S:	This variable, if defined, contains the string used by stdio to
?S:	format long doubles (format 'e') for output.
?S:.
?S:sPRIFUldbl:
?S:	This variable, if defined, contains the string used by stdio to
?S:	format long doubles (format 'F') for output.
?S:	The 'U' in the name is to separate this from sPRIfldbl so that even
?S:	case-blind systems can see the difference.
?S:.
?S:sPRIGUldbl:
?S:	This variable, if defined, contains the string used by stdio to
?S:	format long doubles (format 'G') for output.
?S:	The 'U' in the name is to separate this from sPRIgldbl so that even
?S:	case-blind systems can see the difference.
?S:.
?S:sPRIEUldbl:
?S:	This variable, if defined, contains the string used by stdio to
?S:	format long doubles (format 'E') for output.
?S:	The 'U' in the name is to separate this from sPRIeldbl so that even
?S:	case-blind systems can see the difference.
?S:.
?S:sSCNfldbl:
?S:	This variable, if defined, contains the string used by stdio to
?S:	format long doubles (format 'f') for input.
?S:.
?C:PERL_PRIfldbl:
?C:	This symbol, if defined, contains the string used by stdio to
?C:	format long doubles (format 'f') for output.
?C:.
?C:PERL_PRIgldbl:
?C:	This symbol, if defined, contains the string used by stdio to
?C:	format long doubles (format 'g') for output.
?C:.
?C:PERL_PRIeldbl:
?C:	This symbol, if defined, contains the string used by stdio to
?C:	format long doubles (format 'e') for output.
?C:.
?C:PERL_PRIFldbl:
?C:	This symbol, if defined, contains the string used by stdio to
?C:	format long doubles (format 'f') for output.
?C:.
?C:PERL_PRIGldbl:
?C:	This symbol, if defined, contains the string used by stdio to
?C:	format long doubles (format 'g') for output.
?C:.
?C:PERL_PRIEldbl:
?C:	This symbol, if defined, contains the string used by stdio to
?C:	format long doubles (format 'e') for output.
?C:.
?C:PERL_SCNfldbl:
?C:	This symbol, if defined, contains the string used by stdio to
?C:	format long doubles (format 'f') for input.
?C:.
?H:#$d_PRIfldbl PERL_PRIfldbl	$sPRIfldbl	/**/
?H:#$d_PRIgldbl PERL_PRIgldbl	$sPRIgldbl	/**/
?H:#$d_PRIeldbl PERL_PRIeldbl	$sPRIeldbl	/**/
?H:#$d_PRIFUldbl PERL_PRIFldbl	$sPRIFUldbl	/**/
?H:#$d_PRIGUldbl PERL_PRIGldbl	$sPRIGUldbl	/**/
?H:#$d_PRIEUldbl PERL_PRIEldbl	$sPRIEUldbl	/**/
?H:#$d_SCNfldbl PERL_SCNfldbl	$sSCNfldbl	/**/
?H:.
?T:yyy
echo " "

if $test X"$d_longdbl" = X"$define"; then

echo "Checking how to print long doubles..." >&4

if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
	$cat >try.c <<'EOCP'
#include <sys/types.h>
#include <stdio.h>
int main() {
  double d = 123.456;
  printf("%.3f\n", d);
}
EOCP
	set try
	if eval $compile; then
		yyy=`$run ./try`
		case "$yyy" in
		123.456)
			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
                	sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
			echo "We will use %f."
			;;
		esac
	fi
fi

if $test X"$sPRIfldbl" = X; then
	$cat >try.c <<'EOCP'
#include <sys/types.h>
#include <stdio.h>
int main() {
  long double d = 123.456;
  printf("%.3Lf\n", d);
}
EOCP
	set try
	if eval $compile; then
		yyy=`$run ./try`
		case "$yyy" in
		123.456)
			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
                	sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
			echo "We will use %Lf."
			;;
		esac
	fi
fi

if $test X"$sPRIfldbl" = X; then
	$cat >try.c <<'EOCP'
#include <sys/types.h>
#include <stdio.h>
int main() {
  long double d = 123.456;
  printf("%.3llf\n", d);
}
EOCP
	set try
	if eval $compile; then
		yyy=`$run ./try`
		case "$yyy" in
		123.456)
			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
                	sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
			echo "We will use %llf."
			;;
		esac
	fi
fi

if $test X"$sPRIfldbl" = X; then
	$cat >try.c <<'EOCP'
#include <sys/types.h>
#include <stdio.h>
int main() {
  long double d = 123.456;
  printf("%.3lf\n", d);
}
EOCP
	set try
	if eval $compile; then
		yyy=`$run ./try`
		case "$yyy" in
		123.456)
			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
                	sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
			echo "We will use %lf."
			;;
		esac
	fi
fi

if $test X"$sPRIfldbl" = X; then
	echo "Cannot figure out how to print long doubles." >&4
else
	sSCNfldbl=$sPRIfldbl	# expect consistency
fi

$rm -f try try.*

fi # d_longdbl

case "$sPRIfldbl" in
'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
	d_SCNfldbl="$undef";
	;;
*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
	d_SCNfldbl="$define";
	;;
esac