diff --git a/Makefile.am b/Makefile.am index b8c7eab0..4d75567f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,20 @@ MAINTAINERCLEANFILES = Makefile.in \ config.h.in \ install-sh -SUBDIRS = util lib programs include fonts +# motif/ first: its own configure made these Makefiles (configure.ac, +# AC_CONFIG_SUBDIRS); only the parts MCDE uses are built and installed +if PRIVATE_MOTIF +MOTIF_DIRS = motif/config motif/lib motif/tools motif/clients/uil +endif +SUBDIRS = util $(MOTIF_DIRS) lib programs include fonts + +# Motif's programs for the build itself (configure.ac, CC_FOR_BUILD) +AM_MAKEFLAGS = CC_FOR_BUILD='$(CC_FOR_BUILD)' \ + CFLAGS_FOR_BUILD='$(CFLAGS_FOR_BUILD)' \ + CPPFLAGS_FOR_BUILD='$(CPPFLAGS_FOR_BUILD)' \ + LDFLAGS_FOR_BUILD='$(LDFLAGS_FOR_BUILD)' \ + LIBS_FOR_BUILD='$(LIBS_FOR_BUILD)' \ + AR_FOR_BUILD='$(AR_FOR_BUILD)' RANLIB_FOR_BUILD='$(RANLIB_FOR_BUILD)' if BUILD_DOCS SUBDIRS += doc diff --git a/configure.ac b/configure.ac index 45973475..d446ad21 100644 --- a/configure.ac +++ b/configure.ac @@ -604,8 +604,30 @@ AC_CHECK_LIB(ICE, IceCloseConnection, [XTOOLLIB="-lICE ${XTOOLLIB}"], , [${EXTRA_INCS} ${EXTRA_LIBS}]) AC_CHECK_LIB(SM, SmcOpenConnection, [XTOOLLIB="-lSM ${XTOOLLIB}"], , [${EXTRA_INCS} ${EXTRA_LIBS}]) -AC_CHECK_LIB(Xm, XmTextSetString, [XTOOLLIB="-lXm ${XTOOLLIB}"], , - [${EXTRA_INCS} ${EXTRA_LIBS}]) +dnl MCDE: Motif is MCDE's toolkit and comes from this tree (motif/, IMPORT). +dnl On Makronix it is the system's Motif, the package x11/motif built from +dnl motif/, and MCDE links it like any program (--without-private-motif, the +dnl pkgsrc recipe). Anywhere else MCDE builds motif/ itself and installs it +dnl in ${prefix}/lib, for its own programs only: the system's Motif stays as +dnl it is (Konrad, 2026-11-11). +AC_ARG_WITH([private-motif], + [AS_HELP_STRING([--without-private-motif], + [link the system's Motif (on Makronix x11/motif, built from motif/) instead of building motif/ into ${prefix}/lib (default: build it)])], + [], [with_private_motif=yes]) +AM_CONDITIONAL([PRIVATE_MOTIF], [test "x$with_private_motif" != xno]) +if test "x$with_private_motif" != xno; then + dnl what Motif reads pictures with; never a Motif without them + AC_CHECK_LIB(jpeg, jpeg_read_header, [:], + [AC_MSG_ERROR([libjpeg not found: Motif needs it for JPEG pictures])]) + XTOOLLIB='$(top_builddir)/motif/lib/Xm/libXm.la '"${XTOOLLIB}" + MOTIF_UIL_LIBS='$(top_builddir)/motif/clients/uil/libUil.la $(top_builddir)/motif/lib/Mrm/libMrm.la' +else + AC_CHECK_LIB(Xm, XmTextSetString, [XTOOLLIB="-lXm ${XTOOLLIB}"], + [AC_MSG_ERROR([no Motif (libXm) to link with])], + [${EXTRA_INCS} ${EXTRA_LIBS}]) + MOTIF_UIL_LIBS='-lUil -lMrm' +fi +AC_SUBST(MOTIF_UIL_LIBS) XTOOLLIB="${EXTRA_INCS} ${EXTRA_LIBS} ${X_EXTRA_LIBS} ${XTOOLLIB}" AC_SUBST([XTOOLLIB]) @@ -1027,4 +1049,35 @@ include/Dt/Dt.h lib/tt/bin/ttauth/ttauth.man ]) +if test "x$with_private_motif" != xno; then + dnl MCDE: Motif (motif/) is configured as a package of its own, with the + dnl options of pkgsrc x11/motif, and built by our Makefile.am in the parts + dnl MCDE uses (libXm, libMrm, libUil and uil; not mwm, xmbind, the demos). + dnl Motif's sources are C of the 1990s (int f(); declarations): the dialect + dnl MCDE is built with (MCDE_DIALECT_CFLAGS, above), not the compiler's C23. + ac_configure_args="$ac_configure_args --enable-xft --enable-png --enable-jpeg --disable-printing 'CFLAGS=$CFLAGS $MCDE_DIALECT_CFLAGS'" + AC_CONFIG_SUBDIRS([motif]) + dnl Motif builds programs it runs during the build (makestrs, wml): with the + dnl build machine's compiler. pkgsrc's patches to its Makefile.in use these + dnl and x11/motif passes them as MAKE_FLAGS; Makefile.am passes them on in + dnl AM_MAKEFLAGS. A cross build sets them to the build machine's tools. + : ${CC_FOR_BUILD:=$CC} + : ${CFLAGS_FOR_BUILD:="$CFLAGS $MCDE_DIALECT_CFLAGS"} + : ${CPPFLAGS_FOR_BUILD:="$CPPFLAGS $X_CFLAGS -DHAVE_FCNTL_H"} + : ${LDFLAGS_FOR_BUILD:="$LDFLAGS $X_LIBS"} + : ${LIBS_FOR_BUILD:=-lXt} + : ${AR_FOR_BUILD:=ar} + : ${RANLIB_FOR_BUILD:=ranlib} + AC_SUBST(CC_FOR_BUILD) + AC_SUBST(CFLAGS_FOR_BUILD) + AC_SUBST(CPPFLAGS_FOR_BUILD) + AC_SUBST(LDFLAGS_FOR_BUILD) + AC_SUBST(LIBS_FOR_BUILD) + AC_SUBST(AR_FOR_BUILD) + AC_SUBST(RANLIB_FOR_BUILD) + dnl its headers before any other Motif's (after every test: make expands + dnl these, the shell would not) + CPPFLAGS='-I$(top_builddir)/motif/lib -I$(top_srcdir)/motif/lib '"$CPPFLAGS" +fi + AC_OUTPUT diff --git a/motif/lib/Xm/XmRenderT.c b/motif/lib/Xm/XmRenderT.c index 8b966df4..f52f4c7f 100644 --- a/motif/lib/Xm/XmRenderT.c +++ b/motif/lib/Xm/XmRenderT.c @@ -2038,9 +2038,17 @@ ValidateAndLoadFont(XmRendition rend, Display *display) XmDisplay dsp = NULL; XmDisplayCallbackStruct cb; - if ((_XmRendFont(rend) == NULL) && + /* MCDE: an Xft rendition is loaded when its Xft font is missing, even + * if a core font came with it from the resources (-dt-interface ...): + * before, it stayed without Xft font and XmStringExtent read through a + * NULL pointer (dtsystemsettings, ComputeMetrics, XmString.c) */ + if ( #ifdef USE_XFT - (_XmRendXftFont (rend) == NULL) && + (_XmRendFontType(rend) == XmFONT_IS_XFT ? + (_XmRendXftFont(rend) == NULL) : + ((_XmRendFont(rend) == NULL) && (_XmRendXftFont(rend) == NULL))) && +#else + (_XmRendFont(rend) == NULL) && #endif (_XmRendFontName(rend) != NULL)) { diff --git a/motif/lib/Xm/XmString.c b/motif/lib/Xm/XmString.c index c1eb528a..e9dd13f8 100644 --- a/motif/lib/Xm/XmString.c +++ b/motif/lib/Xm/XmString.c @@ -2419,9 +2419,15 @@ OptLineMetrics(XmRenderTable r, rend = NULL; } - /* 4b/5a. Emit warning and don't render. */ + /* 4b/5a. Emit warning and don't render. MCDE: an Xft rendition + * without its Xft font has nothing to measure with either. */ if ((rend == NULL) || - (_XmRendFont(rend) == NULL && _XmRendXftFont(rend) == NULL)) + (_XmRendFont(rend) == NULL && _XmRendXftFont(rend) == NULL) +#ifdef USE_XFT + || (_XmRendFontType(rend) == XmFONT_IS_XFT && + _XmRendXftFont(rend) == NULL) +#endif + ) { /* Don't emit warning if no tags, e.g. just a dir component. */ if (_XmStrRendBegin(opt) || diff --git a/motif/lib/Xm/XpmI.h b/motif/lib/Xm/XpmI.h index ac1ab0f6..5746a5dd 100644 --- a/motif/lib/Xm/XpmI.h +++ b/motif/lib/Xm/XpmI.h @@ -129,8 +129,10 @@ extern "C" { extern FILE *popen(); #endif -#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32) || defined (_SVID_SOURCE) +/* MCDE: on every system (POSIX): strlen, strcpy, strdup and + * strcmp were undeclared on NetBSD and Linux, an error since GCC 14 */ #include +#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32) || defined (_SVID_SOURCE) #ifndef index #define index strchr diff --git a/programs/dtappbuilder/src/ab/Makefile.am b/programs/dtappbuilder/src/ab/Makefile.am index 38302f72..93267e71 100644 --- a/programs/dtappbuilder/src/ab/Makefile.am +++ b/programs/dtappbuilder/src/ab/Makefile.am @@ -46,7 +46,7 @@ SOURCES.msg = \ dtbuilder_LDADD = ../libABil/libABil.a ../libABobjXm/libABobjXm.a \ ../libABobj/libABobj.a ../libAButil/libAButil.a \ $(LIBWIDGET) $(LIBTERM) $(LIBHELP) $(LIBSVC) \ - $(LIBTT) $(LIBXIN) -lUil $(MRESOURCELIB) $(XTOOLLIB) ${X_LIB} \ + $(LIBTT) $(LIBXIN) $(MOTIF_UIL_LIBS) $(XTOOLLIB) ${X_LIB} \ $(UTILLIB) dtbuilder_CFLAGS = -DPIXMAP_WORKAROUND $(ABINCLUDES)