From be5f2fa9b66582c6ff50260227ac72dbdb5b2f0f Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Tue, 25 Jan 2022 19:26:48 +0000 Subject: [PATCH] fixup freeimage test for macOS --- configure.ac | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index e9e4aa1..1b66675 100644 --- a/configure.ac +++ b/configure.ac @@ -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_DeInitialise()]])], - [freeimage_result=yes], - [freeimage_result=no]) + [AC_LANG_PROGRAM([[#include ]], + [[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}])