SHA256
1
0
forked from pool/gpm
gpm/gpm-ceil.patch
2010-09-09 12:55:44 +00:00

66 lines
2.0 KiB
Diff

Note that GCC 4.0 will optimize ceil (constant), we therefore
have to make the argument non-constant.
================================================================================
Index: configure.ac
===================================================================
--- configure.ac.orig 2009-02-09 10:58:53.000000000 +0100
+++ configure.ac 2010-09-08 16:10:06.434722846 +0200
@@ -108,6 +108,25 @@ fi
AC_CHECK_FUNCS(vsyslog syslog)
AC_FUNC_ALLOCA
+AC_MSG_CHECKING(for ceil)
+AC_TRY_LINK([#define __NO_MATH_INLINES 1
+ double d;],
+ [d = ceil(1.0*d);],
+ SYNLDFLAGS=""
+ AC_MSG_RESULT(yes),
+ SYNLDFLAGS=-lm
+ AC_MSG_RESULT(no))
+
+if test "$SYNLDFLAGS" = "-lm" ; then
+ SAVE_LIBS="$LIBS"
+ AC_CHECK_LIB(m,
+ ceil,
+ ,
+ echo "libmath.so is needed due the ceil function"
+ exit 1)
+ LIBS="$SAVE_LIBS"
+fi
+
case $with_curses in
No|no|N|n) SHARED_LIBS=-lc ;;
*)
@@ -138,6 +157,7 @@ AC_SUBST(ELISP)
AC_SUBST(SHLIB)
AC_SUBST(PICFLAGS)
AC_SUBST(SOLDFLAGS)
+AC_SUBST(SYNLDFLAGS)
AC_SUBST(CURSES_OBJS)
AC_SUBST(SHARED_LIBS)
AC_SUBST(lispdir)
Index: src/Makefile.in
===================================================================
--- src/Makefile.in.orig 2010-09-08 16:06:46.812997967 +0200
+++ src/Makefile.in 2010-09-08 16:09:40.464506680 +0200
@@ -82,7 +82,7 @@ prog/%: prog/%.o
all: gpm lib/libgpm.so.@abi_lev@ lib/libgpm.a $(PROG)
gpm: $(GOBJ)
- $(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $(GOBJ) @LIBS@ $(LIBS) -lm
+ $(CC) @LDFLAGS@ @SYNLDFLAGS@ -o $@ $(GOBJ) @LIBS@ $(LIBS) -lm
# construct dependings of sourcefiles and link sourcefiles
$(DEPFILE) dep: prog/gpm-root.c
@@ -164,7 +164,8 @@ lib/libgpm.a: $(LOBJ)
lib/libgpm.so.@abi_full@: $(PICS)
$(CC) @SOLDFLAGS@libgpm.so.@abi_lev@ \
- @LDFLAGS@ $(LDFLAGS) -o lib/libgpm.so.@abi_full@ $^ @LIBS@ @SHARED_LIBS@ $(LIBS)
+ @LDFLAGS@ $(LDFLAGS) -o lib/libgpm.so.@abi_full@ $^ @LIBS@ @SHARED_LIBS@ @SYNLDFLAGS@ $(LIBS)
+
lib/libgpm.so.@abi_lev@: lib/libgpm.so.@abi_full@
$(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so.@abi_lev@
# unneeded, isn't it?