Bug#909965: apcalc hard codes location of standard C headers

2018-10-30 Thread Martin Buck
tags 909965 fixed-upstream
thanks

Your patch is now included in calc release 2.12.6.10. However, this is not
yet considered a stable release so I'm waiting for that before I do a new
Debian upload.

Thanks,
Martin



Bug#909965: apcalc hard codes location of standard C headers

2018-10-04 Thread Martin Buck
Thanks for your patch. There has been a discussion about a similar problem
on MacOS on the calc mailing list a few days ago. I'll forward your patch
there and see whether I can get it included upstream.

Martin



Bug#909965: apcalc hard codes location of standard C headers

2018-09-30 Thread Helmut Grohne
Source: apcalc
Version: 2.12.5.0-1
Tags: patch upstream
Control: block 798955 by -1

apcalc checks header existence by searching them in a few file system
locations. Unfortunately, Debian's /usr/include/ is not among
those locations and that makes apcalc fail to build when built against a
non-glibc or a glibc with multiarch headers (#798955). The attached
patch replaces those file existence tests with compile tests. The
compiler knows much better whether headers exists and thus the
complexity of the Makefile is reduced. Please consider applying the
attached patch.

Helmut
--- apcalc-2.12.5.0.orig/Makefile
+++ apcalc-2.12.5.0/Makefile
@@ -2254,22 +2254,13 @@
${Q} echo '' >> endian_calc.h
${Q} echo '/* what byte order are we? */' >> endian_calc.h
-${Q} if [ X"${CALC_BYTE_ORDER}" = X ]; then \
-   if [ -f ${INCDIR}/endian.h ]; then \
-   echo '#include ' >> endian_calc.h; \
-   echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
-   elif [ -f ${INCDIR}/machine/endian.h ]; then \
-   echo '#include ' >> endian_calc.h; \
-   echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
-   elif [ -f ${INCDIR}/sys/endian.h ]; then \
-   echo '#include ' >> endian_calc.h; \
-   echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
-   elif [ -f /usr/include/endian.h ]; then \
+   if echo '#include ' | ${CC} -E - >/dev/null 2>&1; then \
echo '#include ' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
-   elif [ -f /usr/include/machine/endian.h ]; then \
+   elif echo '#include ' | ${CC} -E - >/dev/null 
2>&1; then \
echo '#include ' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
-   elif [ -f /usr/include/sys/endian.h ]; then \
+   elif echo '#include ' | ${CC} -E- >/dev/null 2>&1; 
then \
echo '#include ' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
else \
@@ -2336,9 +2327,7 @@
echo '#define HAVE_TIMES_H  /* yes */' >> have_times.h; \
elif [ X"${HAVE_TIMES_H}" = X"NO" ]; then \
echo '#undef HAVE_TIMES_H  /* no */' >> have_times.h; \
-   elif [ -f ${INCDIR}/times.h ]; then \
-   echo '#define HAVE_TIMES_H  /* yes */' >> have_times.h; \
-   elif [ -f /usr/include/times.h ]; then \
+   elif echo '#include ' | ${CC} -E - >/dev/null 2>&1; then \
echo '#define HAVE_TIMES_H  /* yes */' >> have_times.h; \
else \
echo '#undef HAVE_TIMES_H  /* no */' >> have_times.h; \
@@ -2347,9 +2336,7 @@
echo '#define HAVE_SYS_TIMES_H  /* yes */' >> have_times.h; \
elif [ X"${HAVE_SYS_TIMES_H}" = X"NO" ]; then \
echo '#undef HAVE_SYS_TIMES_H  /* no */' >> have_times.h; \
-   elif [ -f ${INCDIR}/sys/times.h ]; then \
-   echo '#define HAVE_SYS_TIMES_H  /* yes */' >> have_times.h; \
-   elif [ -f /usr/include/sys/times.h ]; then \
+   elif echo '#include ' | ${CC} -E - >/dev/null 2>&1; then \
echo '#define HAVE_SYS_TIMES_H  /* yes */' >> have_times.h; \
else \
echo '#undef HAVE_SYS_TIMES_H  /* no */' >> have_times.h; \
@@ -2358,9 +2345,7 @@
echo '#define HAVE_TIME_H   /* yes */' >> have_times.h; \
elif [ X"${HAVE_TIME_H}" = X"NO" ]; then \
echo '#undef HAVE_TIME_H  /* no */' >> have_times.h; \
-   elif [ -f ${INCDIR}/time.h ]; then \
-   echo '#define HAVE_TIME_H  /* yes */' >> have_times.h; \
-   elif [ -f /usr/include/time.h ]; then \
+   elif echo '#include ' | ${CC} -E - >/dev/null 2>&1; then \
echo '#define HAVE_TIME_H  /* yes */' >> have_times.h; \
else \
echo '#undef HAVE_TIME_H  /* no */' >> have_times.h; \
@@ -2369,9 +2354,7 @@
echo '#define HAVE_SYS_TIME_H   /* yes */' >> have_times.h; \
elif [ X"${HAVE_SYS_TIME_H}" = X"NO" ]; then \
echo '#undef HAVE_SYS_TIME_H  /* no */' >> have_times.h; \
-   elif [ -f ${INCDIR}/sys/time.h ]; then \
-   echo '#define HAVE_SYS_TIME_H  /* yes */' >> have_times.h; \
-   elif [ -f /usr/include/sys/time.h ]; then \
+   elif echo '#include ' | ${CC} -E - >/dev/null 2>&1; then \
echo '#define HAVE_SYS_TIME_H  /* yes */' >> have_times.h; \
else \
echo '#undef HAVE_SYS_TIME_H  /* no */' >> have_times.h; \
@@ -2407,9 +2390,7 @@
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
elif [ X"${HAVE_STDLIB_H}" = X"NO" ]; then \
echo '#undef HAVE_STDLIB_H  /* no */' >> have_stdlib.h; \
-   elif [ -f ${INCDIR}/stdlib.h ]; then \
-   echo '#define HAVE_STDLIB_H  /* yes */' >> have_stdlib.h; \
-   elif [ -f