Skip to content

Commit

Permalink
Fix libm linking error
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeezley committed Oct 4, 2015
1 parent cdbde91 commit 16fe554
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Makefile.in
@@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.14 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2013 Free Software Foundation, Inc.
Expand Down Expand Up @@ -547,9 +547,10 @@ distcheck: dist
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
&& ../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
Expand Down
9 changes: 5 additions & 4 deletions aclocal.m4
@@ -1,4 +1,4 @@
# generated automatically by aclocal 1.14 -*- Autoconf -*-
# generated automatically by aclocal 1.14.1 -*- Autoconf -*-

# Copyright (C) 1996-2013 Free Software Foundation, Inc.

Expand Down Expand Up @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.14'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.14], [],
m4_if([$1], [1.14.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])

Expand All @@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.14])dnl
[AM_AUTOMAKE_VERSION([1.14.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
Expand Down Expand Up @@ -573,7 +573,8 @@ to "yes", and re-run configure.
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
fi])
fi
])

dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
Expand Down
51 changes: 49 additions & 2 deletions configure
Expand Up @@ -2734,6 +2734,7 @@ END
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
fi
fi

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Expand Down Expand Up @@ -3774,10 +3775,56 @@ fi




{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceil in -lm" >&5
$as_echo_n "checking for ceil in -lm... " >&6; }
if ${ac_cv_lib_m_ceil+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ceil ();
int
main ()
{
return ceil ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_m_ceil=yes
else
ac_cv_lib_m_ceil=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_ceil" >&5
$as_echo "$ac_cv_lib_m_ceil" >&6; }
if test "x$ac_cv_lib_m_ceil" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF

LIBS="-lm $LIBS"

fi


EXTRA_INCLUDES=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtiff" >&5
$as_echo_n "checking for libtiff... " >&6; }

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFGetField in -ltiff" >&5
$as_echo_n "checking for TIFFGetField in -ltiff... " >&6; }
if ${ac_cv_lib_tiff_TIFFGetField+:} false; then :
Expand Down Expand Up @@ -4353,7 +4400,7 @@ fi

EXTRA_INCLUDES=$EXTRA_INCLUDES

LIBS="-lgeotiff -ltiff"
LIBS="$LIBS -lgeotiff -ltiff"

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
Expand Down
4 changes: 3 additions & 1 deletion configure.ac
Expand Up @@ -2,6 +2,8 @@ AC_INIT([convert_geotiff], [0.1.0], [jon.beezley@gmail.com], [convert_geotiff],
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC

AC_CHECK_LIB([m],[ceil])

EXTRA_INCLUDES=""
AC_MSG_CHECKING([for libtiff])
AC_CHECK_LIB([tiff], [TIFFGetField], [HAVE_TIFF=yes], [AC_MSG_ERROR([Cannot find TIFF library. Try setting CFLAGS and LDFLAGS if it is installed in a non-standard location.])],[])
Expand All @@ -24,7 +26,7 @@ AC_CHECK_HEADER([geotiffio.h], [
[AC_MSG_ERROR([Cannot find GEOTIFF headers])],[])],[])

AC_SUBST(EXTRA_INCLUDES,$EXTRA_INCLUDES)
LIBS="-lgeotiff -ltiff"
LIBS="-lgeotiff -ltiff $LIBS"
AM_MAINTAINER_MODE([enable])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

0 comments on commit 16fe554

Please sign in to comment.