configure: Add check for log2

Adds check for log2 and only use it in exif library if it is
available.
This commit is contained in:
Thiago Santos 2010-08-25 11:19:31 -03:00
parent 4915090e01
commit aa3abae744
2 changed files with 12 additions and 0 deletions

View file

@ -219,6 +219,10 @@ dnl *** checks for functions ***
AC_CHECK_FUNCS([localtime_r gmtime_r]) AC_CHECK_FUNCS([localtime_r gmtime_r])
dnl *** checks for math functions *** dnl *** checks for math functions ***
LIBS_SAVE=$LIBS
LIBS="$LIBS $LIBM"
AC_CHECK_FUNCS(log2)
LIBS=$LIBS_SAVE
dnl *** checks for types/defines *** dnl *** checks for types/defines ***

View file

@ -2210,7 +2210,11 @@ serialize_shutter_speed (GstExifWriter * writer, const GstTagList * taglist,
gst_util_fraction_to_double (gst_value_get_fraction_numerator (value), gst_util_fraction_to_double (gst_value_get_fraction_numerator (value),
gst_value_get_fraction_denominator (value), &num); gst_value_get_fraction_denominator (value), &num);
#ifdef HAVE_LOG2
num = -log2 (num); num = -log2 (num);
#else
num = -log (num) / M_LN2;
#endif
/* now the value */ /* now the value */
gst_exif_writer_write_signed_rational_tag_from_double (writer, gst_exif_writer_write_signed_rational_tag_from_double (writer,
@ -2256,7 +2260,11 @@ serialize_aperture_value (GstExifWriter * writer, const GstTagList * taglist,
GST_WARNING ("Failed to get focal ratio from from tag list"); GST_WARNING ("Failed to get focal ratio from from tag list");
return; return;
} }
#ifdef HAVE_LOG2
num = 2 * log2 (num); num = 2 * log2 (num);
#else
num = 2 * (log (num) / M_LN2);
#endif
/* now the value */ /* now the value */
gst_exif_writer_write_rational_tag_from_double (writer, gst_exif_writer_write_rational_tag_from_double (writer,