core, more on chd support
authorkub <derkub@gmail.com>
Thu, 4 Mar 2021 21:38:11 +0000 (22:38 +0100)
committerkub <derkub@gmail.com>
Thu, 4 Mar 2021 21:38:11 +0000 (22:38 +0100)
Makefile
configure

index 99bfc6a..7a40eb1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -237,8 +237,7 @@ endif
 endif
 
 ifneq (,$(HAVE_LIBCHDR))
-CFLAGS += -DUSE_LIBCHDR -Iplatform/common/libchdr/include
-LDFLAGS += -Lplatform/common/libchdr -lchdr
+CFLAGS += -DUSE_LIBCHDR
 endif
 
 ifeq "$(PLATFORM_ZLIB)" "1"
index 9afcca6..df0a61b 100755 (executable)
--- a/configure
+++ b/configure
@@ -49,6 +49,7 @@ have_armv7=""
 have_arm_oabi=""
 have_arm_neon=""
 have_libavcodec=""
+have_libchdr=""
 need_sdl="no"
 need_zlib="no"
 # these are for known platforms
@@ -348,6 +349,15 @@ EOF
   compile_object "$@"
 }
 
+check_libchdr()
+{
+  cat > $TMPC <<EOF
+  #include <libchdr/chd.h>
+  int main (int argc, char *argv[]) { chd_open("", 0, NULL, NULL); }
+EOF
+  compile_object "$@"
+}
+
 check_zlib -lz && MAIN_LDLIBS="$MAIN_LDLIBS -lz" || need_zlib="yes"
 
 MAIN_LDLIBS="-lpng $MAIN_LDLIBS"
@@ -362,6 +372,10 @@ if check_libavcodec; then
   esac
 fi
 
+if check_libchdr; then
+  have_libchdr="yes"
+fi
+
 # find what audio support we can compile
 if [ "x$sound_drivers" = "x" ]; then
   if check_oss; then sound_drivers="$sound_drivers oss"; fi
@@ -402,6 +416,7 @@ fi
 test "x$have_armv6" != "x" || have_armv6="no"
 test "x$have_armv7" != "x" || have_armv7="no"
 test "x$have_libavcodec" != "x" || have_libavcodec="no"
+test "x$have_libchdr" != "x" || have_libchdr="no"
 
 echo "architecture        $ARCH"
 echo "platform            $platform"
@@ -411,6 +426,7 @@ echo "C compiler flags    $CFLAGS"
 echo "libraries           $MAIN_LDLIBS"
 echo "linker flags        $LDFLAGS"
 echo "libavcodec (mp3)    $have_libavcodec"
+echo "libchdr             $have_libchdr"
 # echo "ARMv7 optimizations $have_armv7"
 
 echo "# Automatically generated by configure" > $config_mak
@@ -434,6 +450,9 @@ echo "SOUND_DRIVERS = $sound_drivers" >> $config_mak
 if [ "$have_libavcodec" = "yes" ]; then
   echo "HAVE_LIBAVCODEC = 1" >> $config_mak
 fi
+if [ "$have_libchdr" = "yes" ]; then
+  echo "HAVE_LIBCHDR = 1" >> $config_mak
+fi
 if [ "$need_zlib" = "yes" ]; then
   echo "PLATFORM_ZLIB = 1" >> $config_mak
 fi