Note that GCC 4.0 will optimize ceil (constant), we therefore have to make the argument non-constant. ================================================================================ --- configure.ac.footer | 20 ++++++++++++++++++++ src/Makefile.in | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) Index: configure.ac.footer =================================================================== --- configure.ac.footer.orig 2012-10-26 23:21:38.000000000 +0200 +++ configure.ac.footer 2013-04-16 12:21:01.350791832 +0200 @@ -112,6 +112,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 ;; *) @@ -142,6 +161,7 @@ AC_SUBST(ELISP) AC_SUBST(SHLIB) AC_SUBST(PICFLAGS) AC_SUBST(SOLDFLAGS) +AC_SUBST(SYNLDFLAGS) AC_SUBST(LIBGPM_A) AC_SUBST(CURSES_OBJS) AC_SUBST(SHARED_LIBS) Index: src/Makefile.in =================================================================== --- src/Makefile.in.orig 2013-04-16 12:18:43.719054511 +0200 +++ src/Makefile.in 2013-04-16 12:18:43.762053491 +0200 @@ -166,7 +166,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?