117 lines
3.6 KiB
Diff
117 lines
3.6 KiB
Diff
Hello,
|
|
|
|
Gpm 1.20.1 fails to build for me for the mipsel-linux host. This happens
|
|
because the platform only defines ceil() in libm (as expected), while a
|
|
few others only work by an accident because they have an inline equivalent
|
|
in <math.h>. The failure also happens for these platforms if optimization
|
|
is disabled in CFLAGS. Following is a fix that adds an autoconf test for
|
|
<math.h> and whether linking against libm is needed to make use of ceil().
|
|
|
|
I've only tested the fix with autoconf 2.57 (I only use 2.5x for a long
|
|
time), hence that's the required version. It may work with older
|
|
versions; if not, fixing shouldn't be that difficult. Alternatively you
|
|
may consider upgrading autoconf -- the current version is much cleaner and
|
|
the transition should be painless as gpm's scripts seem to have no
|
|
incompatible hacks.
|
|
|
|
Please apply,
|
|
|
|
Maciej
|
|
|
|
--
|
|
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
|
|
+--------------------------------------------------------------+
|
|
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
|
|
|
|
gpm-1.20.1-ceil.patch
|
|
diff -up --recursive --new-file gpm-1.20.1.macro/configure.in gpm-1.20.1/configure.in
|
|
--- gpm-1.20.1.macro/configure.in 2002-12-24 22:57:16.000000000 +0000
|
|
+++ gpm-1.20.1/configure.in 2003-01-19 03:27:16.000000000 +0000
|
|
@@ -4,7 +4,7 @@ dnl Process this file with autoconf to p
|
|
dnl written jan/1997 - T.E.Dickey <dickey@clark.net>
|
|
|
|
AC_INIT(src/gpm.c)
|
|
-AC_PREREQ(2.12)
|
|
+AC_PREREQ(2.57)
|
|
AC_CONFIG_HEADER(src/headers/config.h)
|
|
|
|
release=1.20.1
|
|
@@ -112,6 +112,41 @@ No|no|N|n) SHARED_LIBS=-lc ;;
|
|
LIBS=$SAVELIBS ;;
|
|
esac
|
|
|
|
+dnl ceil() may be an inline, so check with no libm first
|
|
+AC_CHECK_HEADERS([math.h], , [AC_MSG_ERROR([a mandatory header is missing])])
|
|
+AC_CACHE_CHECK([whether libm is needed for ceil], [gpm_cv_ceil_libm],
|
|
+[ceil_found=no
|
|
+for i in "" "-lm"; do
|
|
+ SAVELIBS=$LIBS
|
|
+ LIBS=$i
|
|
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
|
+[#ifdef HAVE_MATH_H
|
|
+#include <math.h>
|
|
+#endif], [ceil(0.0);])], [ceil_found=yes])
|
|
+ LIBS=$SAVELIBS
|
|
+ if test x$ceil_found = xyes; then
|
|
+ break
|
|
+ fi
|
|
+done
|
|
+if test x$ceil_found = xno; then
|
|
+ gpm_cv_ceil_libm=missing
|
|
+elif test x$i = x-lm; then
|
|
+ gpm_cv_ceil_libm=yes
|
|
+else
|
|
+ gpm_cv_ceil_libm=no
|
|
+fi])
|
|
+case $gpm_cv_ceil_libm in
|
|
+no)
|
|
+ LIBM=
|
|
+ ;;
|
|
+yes)
|
|
+ LIBM=-lm
|
|
+ ;;
|
|
+*)
|
|
+ AC_MSG_ERROR([a mandatory function is missing])
|
|
+ ;;
|
|
+esac
|
|
+
|
|
GPMXTERM=
|
|
AC_SUBST(GPMXTERM)
|
|
AC_SUBST(release)
|
|
@@ -125,6 +160,7 @@ AC_SUBST(PICFLAGS)
|
|
AC_SUBST(SOLDFLAGS)
|
|
AC_SUBST(CURSES_OBJS)
|
|
AC_SUBST(SHARED_LIBS)
|
|
+AC_SUBST(LIBM)
|
|
AC_SUBST(lispdir)
|
|
|
|
CPPFLAGS='-I$(srcdir) $(DEFS) -include headers/config.h -Wall -DSYSCONFDIR="\"$(sysconfdir)\"" -DSBINDIR="\"$(sbindir)\""'
|
|
diff -up --recursive --new-file gpm-1.20.1.macro/src/Makefile.in gpm-1.20.1/src/Makefile.in
|
|
--- gpm-1.20.1.macro/src/Makefile.in 2002-12-24 22:57:16.000000000 +0000
|
|
+++ gpm-1.20.1/src/Makefile.in 2003-01-19 03:30:44.000000000 +0000
|
|
@@ -70,6 +70,10 @@ prog/%: prog/%.o
|
|
all: gpm lib/@SHLIB@ lib/libgpm.a $(PROG)
|
|
|
|
gpm: $(GOBJ)
|
|
+ $(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $^ @LIBS@ @LIBM@ $(LIBS)
|
|
+
|
|
+prog/mouse-test: prog/mouse-test.o
|
|
+ $(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $^ @LIBS@ @LIBM@ $(LIBS)
|
|
|
|
# construct dependings of sourcefiles and link sourcefiles
|
|
$(DEPFILE) dep: prog/gpm-root.c
|
|
diff -up --recursive --new-file gpm-1.20.1.macro/src/synaptics.c gpm-1.20.1/src/synaptics.c
|
|
--- gpm-1.20.1.macro/src/synaptics.c 2002-12-24 22:57:16.000000000 +0000
|
|
+++ gpm-1.20.1/src/synaptics.c 2003-01-19 03:32:31.000000000 +0000
|
|
@@ -209,7 +209,9 @@
|
|
*/
|
|
|
|
|
|
+#ifdef HAVE_MATH_H
|
|
#include <math.h> /* ceil */
|
|
+#endif
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|