...
 
Commits (2)
......@@ -4,15 +4,8 @@
## ./Configure
/Makefile
/config.h
/config/autom4te.cache/
/config/config.log
/config/config.status
/config/endiantuple
/config/endiantuple.c
/config/endiantuple.c.in
/config/endiantuple_ac.log
/config/endiantuple_ac.sh
/config/fpubits
/config/endiantuple
## make
/sympow
......
......@@ -19,7 +19,7 @@ echo "**ERROR**: Could not find rm"; exit;
fi
$RM -f $FILE
$RM -f $CONFIG
VERSION=2.023.5
VERSION=2.023.6
echo "#define PREFIX \"$PREFIX\"" >> $CONFIG
echo "#define VARPREFIX \"$VARPREFIX\"" >> $CONFIG
echo "#define VERSION \"$VERSION\"" >> $CONFIG
......@@ -62,18 +62,6 @@ SH=/bin/sh
echo "#define SH \"$SH\"" >> $CONFIG
echo "SH = $SH" >> $FILE
AUTOHEADER=`which \autoheader`
if [ -z "$AUTOHEADER" ];
then
echo "**ERROR**: Could not find autoheader"; exit;
fi
AUTOCONF=`which \autoconf`
if [ -z "$AUTOCONF" ];
then
echo "**ERROR**: Could not find autoconf"; exit;
fi
CC=${CC:-gcc} && echo "CC = $CC" >> $FILE
##if [ -z "$CC" ];
##then
......@@ -181,7 +169,7 @@ done
CC_ARGS="$ORIGINALCFLAGS -O3 $CFLAGS config/fpubits1.c config/fpubits2.c fpu.c -o config/fpubits"
$CC $CC_ARGS
if [ $? -ne 0 ]; then
echo >&2 "Error: the command below failed:"
echo >&2 "Error: the command below failed:"
echo >&2 "$CC $CC_ARGS"
exit 1
fi
......@@ -215,25 +203,15 @@ EOF
exit 1
fi
##
## inspired from fontconfig material (configure.ac and fcarch.h)
## non-sage material
#######################################################################
# Determine architecture endianess-tuple
#######################################################################
( \
cd config && \
$AUTOHEADER endiantuple.ac && $AUTOCONF -o endiantuple_ac.sh endiantuple.ac && \
$SH endiantuple_ac.sh > endiantuple_ac.log )
if [ $? -ne 0 -o ! -f config/endiantuple.c ]; then
echo >&2 "Error: failed to generate config/endiantuple.c"
exit 1
fi
$CC -o config/endiantuple config/endiantuple.c
CC_ARGS="config/endiantuple.c -o config/endiantuple"
$CC $CC_ARGS
if [ $? -ne 0 ]; then
echo >&2 "Error: the command below failed:"
echo >&2 "$CC -o config/endiantuple config/endiantuple.c"
echo >&2 "$CC $CC_ARGS"
exit 1
fi
ENDIANTUPLE=$(config/endiantuple) && echo "#define ENDIANTUPLE \"$ENDIANTUPLE\"" >> $CONFIG
......@@ -244,10 +222,7 @@ fi
echo "ENDIANTUPLE for SYMPOW: $ENDIANTUPLE"
echo "CONFETA = config/endiantuple_ac.sh config/endiantuple.c.in" >> $FILE
echo "CONFETC = config/endiantuple.c" >> $FILE
echo "CONFEXE = config/endiantuple config/fpubits" >> $FILE
echo "CONFO = \$(CONFETA) \$(CONFETC) \$(CONFEXE)" >> $FILE
##
......@@ -355,9 +330,7 @@ echo "clean:" >> $FILE
echo " \$(RM) -f \$(OBJS) sympow sympow.1 \$(TILDES)" >> $FILE
echo " \$(RM) -rf datafiles" >> $FILE
echo "distclean: clean" >> $FILE
echo " \$(RM) -rf config/autom4te.cache" >> $FILE
echo " \$(RM) -f config/config.status config/*.log" >> $FILE
echo " \$(RM) -f \$(CONFO) config/*.log" >> $FILE
echo " \$(RM) -f \$(CONFEXE)" >> $FILE
echo " \$(RM) -f config.h Makefile" >> $FILE
echo "install-arch: build-arch" >> $FILE
echo " install -d \$(DESTDIR)$PREFIX/bin" >> $FILE
......
......@@ -313,5 +313,5 @@ POSSIBILITY OF SUCH DAMAGE.
### forked code
Copyright: 2018 Jerome G. M. Benoit <[email protected]>
Copyright: 2018-2020 Jerome G. M. Benoit <[email protected]>
dnl config/endiantuple.ac AutoConf adhoc script
dnl
dnl Inspired from fontconfig material (configure.ac and fcarch.h)
dnl at the time of writing, Thu Oct 2 22:34:08 UTC 2014.
dnl
dnl Written for Debian on behalf of the Debian Science Team
dnl by Jerome Benoit <[email protected]>
dnl
dnl how to do:
dnl $ autoheader endiantuple.ac
dnl $ autoconf -o endiantuple_ac.sh endiantuple.ac
dnl $ chmod a+x endiantuple_ac.sh
dnl $ ./endiantuple_ac.sh
dnl $ gcc -o endiantuple endiantuple.c
dnl $ ./endiantuple
dnl
AC_INIT([adhoc],[2.71828],[[email protected]])
AC_CONFIG_HEADERS([endiantuple.c])
dnl
AC_C_BIGENDIAN
AC_CHECK_SIZEOF([void *])
AC_CHECK_ALIGNOF([double])
AH_TOP([#include <stdio.h>])
AH_BOTTOM([
#if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN
# define ADHOC_ARCH_ENDIAN "be"
#else /* !WORDS_BIGENDIAN */
# define ADHOC_ARCH_ENDIAN "le"
#endif
#if SIZEOF_VOID_P == 4
# if ALIGNOF_DOUBLE == 4
# define ADHOC_ARCH_SIZE_ALIGN "32d4"
# else /* ALIGNOF_DOUBLE != 4 */
# define ADHOC_ARCH_SIZE_ALIGN "32d8"
# endif
#else /* SIZEOF_VOID_P != 4 */
# define ADHOC_ARCH_SIZE_ALIGN "64"
#endif
#define ADHOC_ENDIANTUPLE ADHOC_ARCH_ENDIAN ADHOC_ARCH_SIZE_ALIGN
int main() { printf( ADHOC_ENDIANTUPLE "\n" ); return 0; }
])
AC_OUTPUT([])
dnl eos
/*
* Copyright Jerome G. M. Benoit <[email protected]> 2020
*
*/
#if !(__STDC_VERSION__ >= 201112L)
#error "require C11 or higher"
#endif
#include <sys/types.h>
#include <sys/param.h>
#include <stdalign.h>
#include <stdio.h>
int main() {
const char * ADHOC_ARCH_ENDIAN="";
const char * ADHOC_ARCH_SIZE_ALIGN="";
int is_bigendian=-1;
/* inspired by AC_C_BIGENDIAN */
#ifdef __APPLE_CC__
is_bigendian=0;
#elif (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN && \
BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
# if BYTE_ORDER == LITTLE_ENDIAN
is_bigendian=0;
# elif BYTE_ORDER == BIG_ENDIAN
is_bigendian=1;
# else
# error "unexpected event"
# endif
#elif (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
# ifndef _BIG_ENDIAN
is_bigendian=0;
# else
is_bigendian=1;
# endif
#else
/* From Harbison&Steele, section 6.1.2, ``Byte Ordering'' */
union {
long int l;
char c[sizeof(long int)];
} u;
u.l=1;
if (u.c[0] == 1) {
is_bigendian=0;
}
else if (u.c[sizeof(long int)-1] == 1) {
is_bigendian=1;
}
#endif
if (!(is_bigendian < 0)) {
if (is_bigendian == 0) {
ADHOC_ARCH_ENDIAN="le";
}
else if (0 < is_bigendian) {
ADHOC_ARCH_ENDIAN="be";
}
if (sizeof(void *) == 4) {
if (alignof(double) == 4) {
ADHOC_ARCH_SIZE_ALIGN="32d4";
}
else {
ADHOC_ARCH_SIZE_ALIGN="32d8";
}
}
else { /* (sizeof(void *) != 4) */
ADHOC_ARCH_SIZE_ALIGN="64";
}
}
printf("%s%s\n",ADHOC_ARCH_ENDIAN,ADHOC_ARCH_SIZE_ALIGN);
return 0; }