fix build with (system-)md4c 0.5.x

since 689334c8b9.

the new stuff in case is not defined in 0.5.x, but since it's
fallthrough and break anyway one can probably #if(def) it out completely...

version detection using pkg-config. hopefully all distros have it
(didn't check.)

Change-Id: I1c97b0492c00dbd0ee631f98b207ee6e64744c9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211635
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Rene Engelhard
2026-10-05 13:51:53 +02:00
committed by Xisco Fauli
parent dfbde789ee
commit 1b1711a410
3 changed files with 27 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
#ifndef CONFIG_MD4C_H
#define CONFIG_MD4C_H
#undef MD4C_MAJOR
#undef MD4C_MINOR
#endif
+10
View File
@@ -10141,6 +10141,8 @@ if test "x$with_system_md4c" = "xauto"; then
fi
AC_MSG_CHECKING([which md4c to use])
MD4C_MAJOR=0
MD4C_MINOR=6
case "$with_system_md4c" in
yes)
AC_MSG_RESULT([system])
@@ -10160,6 +10162,10 @@ case "$with_system_md4c" in
AC_CHECK_LIB([md4c-html], [md_html],
[ MD4C_LIBS="$MD4C_LIBS -lmd4c-html" ],
[ AC_MSG_ERROR([system md4c-html library not found or broken.]) ])
MD4C_VERSION=`$PKG_CONFIG --modversion md4c 2>/dev/null`
MD4C_MAJOR=`echo $MD4C_VERSION | cut -d"." -f1`
MD4C_MINOR=`echo $MD4C_VERSION | cut -d"." -f2`
;;
""|no)
@@ -10180,6 +10186,9 @@ AC_SUBST(MD4C_LIBS)
AC_SUBST(MD4C_CFLAGS)
AC_SUBST(BUILD_TYPE)
AC_DEFINE_UNQUOTED(MD4C_MAJOR,$MD4C_MAJOR)
AC_DEFINE_UNQUOTED(MD4C_MINOR,$MD4C_MINOR)
dnl ===================================================================
dnl Check for system jpeg
dnl ===================================================================
@@ -16562,6 +16571,7 @@ AC_CONFIG_HEADERS([config_host/config_lgpl.h])
AC_CONFIG_HEADERS([config_host/config_libcxx.h])
AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
AC_CONFIG_HEADERS([config_host/config_locales.h])
AC_CONFIG_HEADERS([config_host/config_md4c.h])
AC_CONFIG_HEADERS([config_host/config_mpl.h])
AC_CONFIG_HEADERS([config_host/config_oox.h])
AC_CONFIG_HEADERS([config_host/config_options.h])
+10
View File
@@ -33,6 +33,8 @@
#include <mdiexp.hxx>
#include <tools/urlobj.hxx>
#include <config_md4c.h>
#include "swmd.hxx"
int SwMarkdownParser::enter_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata)
@@ -83,11 +85,13 @@ int SwMarkdownParser::enter_block_callback(MD_BLOCKTYPE type, void* detail, void
parser->StartTable(nRow, nCol);
break;
}
#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6)
case MD_BLOCK_ADMONITION:
case MD_BLOCK_BLANK:
case MD_BLOCK_FOOTNOTE_DEF:
case MD_BLOCK_FOOTNOTE_DEF_SECTION:
break;
#endif
case MD_BLOCK_THEAD:
case MD_BLOCK_TBODY:
break;
@@ -142,11 +146,13 @@ int SwMarkdownParser::leave_block_callback(MD_BLOCKTYPE type, void* /*detail*/,
case MD_BLOCK_TABLE:
parser->EndTable();
break;
#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6)
case MD_BLOCK_ADMONITION:
case MD_BLOCK_BLANK:
case MD_BLOCK_FOOTNOTE_DEF:
case MD_BLOCK_FOOTNOTE_DEF_SECTION:
break;
#endif
case MD_BLOCK_THEAD:
case MD_BLOCK_TBODY:
break;
@@ -226,6 +232,7 @@ int SwMarkdownParser::enter_span_callback(MD_SPANTYPE type, void* detail, void*
case MD_SPAN_LATEXMATH:
case MD_SPAN_LATEXMATH_DISPLAY:
break;
#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6)
case MD_SPAN_FOOTNOTE_REF:
case MD_SPAN_INS:
case MD_SPAN_MARK:
@@ -233,6 +240,7 @@ int SwMarkdownParser::enter_span_callback(MD_SPANTYPE type, void* detail, void*
case MD_SPAN_SUPERSCRIPT:
case MD_SPAN_SUBSCRIPT:
break;
#endif
case MD_SPAN_WIKILINK:
{
const MD_SPAN_WIKILINK_DETAIL* pWikilink
@@ -274,6 +282,7 @@ int SwMarkdownParser::leave_span_callback(MD_SPANTYPE type, void* /*detail*/, vo
case MD_SPAN_WIKILINK:
case MD_SPAN_U:
break;
#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6)
case MD_SPAN_FOOTNOTE_REF:
case MD_SPAN_INS:
case MD_SPAN_MARK:
@@ -281,6 +290,7 @@ int SwMarkdownParser::leave_span_callback(MD_SPANTYPE type, void* /*detail*/, vo
case MD_SPAN_SUBSCRIPT:
case MD_SPAN_SUPERSCRIPT:
break;
#endif
}
return 0;
}