Skip to content

Commit

Permalink
fixup freeimage test for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterMute committed Jan 25, 2022
1 parent cc2a065 commit be5f2fa
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,40 @@ AC_CANONICAL_BUILD
AC_PROG_LIBTOOL
AM_PROG_CC_C_O

#
# check for libfreeimage
#
case "${host}" in
*-mingw32*)
WIN_FREEIMAGE_LIBS=-lws2_32
;;
case "$host" in
*-*-mingw*)
LIBS="$LIBS -lws2_32"
;;

esac

case "$host" in
*-apple-darwin*)
STDCPP_LIBS="-lc++"
;;

*)
STDCPP_LIBS="-lstdc++"
;;

esac

AC_CHECK_HEADER([FreeImage.h])

AC_MSG_CHECKING([for libfreeimage])
save_LIBS="$LIBS"
LIBS="$LIBS -lfreeimage ${WIN_FREEIMAGE_LIBS} -lstdc++ -lm"
LIBS="-lfreeimage ${LIBS} ${STDCPP_LIBS} -lm"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <FreeImage.h>]],
[[FreeImage_DeInitialise()]])],
[freeimage_result=yes],
[freeimage_result=no])
[AC_LANG_PROGRAM([[#include <FreeImage.h>]],
[[FreeImage_DeInitialise()]])],
[freeimage_result=yes],
[freeimage_result=no])
AC_MSG_RESULT([$freeimage_result])
LIBS="$save_LIBS"
if test "x$freeimage_result" = "xyes"; then
FREEIMAGE_LIBS="-lfreeimage ${WIN_FREEIMAGE_LIBS} -lstdc++ -lm"
FREEIMAGE_LIBS="-lfreeimage ${STDCPP_LIBS} -lm"
else
AC_MSG_ERROR(['libfreeimage' not found])
AC_MSG_ERROR(['libfreeimage' not found])
fi
AC_SUBST([FREEIMAGE_LIBS], [${FREEIMAGE_LIBS}])

Expand Down

0 comments on commit be5f2fa

Please sign in to comment.