From: Chris Hanson Date: Fri, 14 Sep 2018 18:13:53 +0000 (-0400) Subject: Changes to get X11 module to compile on macos. X-Git-Tag: mit-scheme-pucked-9.2.18~7^2~8 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=7c56396f311e7787574c8ae62f3a5c31f376b695;p=mit-scheme.git Changes to get X11 module to compile on macos. --- diff --git a/src/x11/Makefile.am b/src/x11/Makefile.am index c55dbafb6..218243775 100644 --- a/src/x11/Makefile.am +++ b/src/x11/Makefile.am @@ -45,10 +45,9 @@ scmlib_sub_DATA += make.scm @MIT_SCHEME_PKD@ #AM_MAKEINFOHTMLFLAGS = --no-split AM_CPPFLAGS = -I@MIT_SCHEME_INCLUDEDIR@ -AM_CFLAGS = `pkg-config --cflags x11` -AM_CFLAGS += @MIT_CFLAGS@ +AM_CFLAGS = @MIT_CFLAGS@ -LIBS = `pkg-config --libs x11` +LIBS = @MIT_LIBS@ x11_shim_la_LIBADD = x11base.lo x11color.lo x11graph.lo x11term.lo c_sources = x11-shim.h x11.h x11base.c x11color.c x11graph.c x11term.c diff --git a/src/x11/configure.ac b/src/x11/configure.ac index 3d931ac01..6260f43ef 100644 --- a/src/x11/configure.ac +++ b/src/x11/configure.ac @@ -41,9 +41,12 @@ AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL +MIT_CFLAGS= +MIT_LIBS= + if test ${GCC} = yes; then - MIT_CFLAGS="-Wall -Wundef -Wpointer-arith -Winline" + MIT_CFLAGS="${MIT_CFLAGS} -Wall -Wundef -Wpointer-arith -Winline" MIT_CFLAGS="${MIT_CFLAGS} -Wstrict-prototypes -Wnested-externs" MIT_CFLAGS="${MIT_CFLAGS} -Wredundant-decls" @@ -72,10 +75,26 @@ if test ${GCC} = yes; then [AC_MSG_RESULT([no])]) fi +AC_PATH_X AC_CHECK_PROG([PKG_CONFIG], [pkg-config], [yes]) -if ! pkg-config --exists x11 2>/dev/null; then - AC_MSG_ERROR([X11 not found.]) +AC_CHECK_HEADERS([malloc.h]) + + +dnl Add support for X if present. +if test "${no_x}" != yes; then + if test "x${x_includes}" != x; then + FOO=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` + MIT_CFLAGS="${MIT_CFLAGS} ${FOO}" + elif pkg-config --exists x11 2>/dev/null; then + MIT_CFLAGS="${MIT_CFLAGS} `pkg-config --cflags x11`" + fi + if test "x${x_libraries}" != x; then + FOO=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"` + MIT_LIBS="${MIT_LIBS} ${FOO}" + elif pkg-config --exists x11 2>/dev/null; then + MIT_LIBS="${MIT_LIBS} `pkg-config --libs x11`" + fi fi MIT_SCHEME_PROJECT=mit-scheme @@ -116,6 +135,7 @@ MIT_SCHEME_DEPS="${MIT_SCHEME_DEPS} ${MIT_SCHEME_PKD}: stamp-scheme" AC_SUBST([MIT_CFLAGS]) +AC_SUBST([MIT_LIBS]) AC_SUBST([MIT_SCHEME_PROJECT]) AC_SUBST([MIT_SCHEME_EXE]) AC_SUBST([MIT_SCHEME_LIBDIR]) diff --git a/src/x11/x11.h b/src/x11/x11.h index 43f1620e9..9f53be069 100644 --- a/src/x11/x11.h +++ b/src/x11/x11.h @@ -28,7 +28,16 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. typedef unsigned long SCM; -#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_MALLOC_H +# include +#endif + #include #include #include diff --git a/src/x11/x11base.c b/src/x11/x11base.c index 92e666145..599ea18f9 100644 --- a/src/x11/x11base.c +++ b/src/x11/x11base.c @@ -25,10 +25,8 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. /* Common X11 support. */ -#include -#include -#include #include "x11.h" +#include #include #include diff --git a/src/x11/x11graph.c b/src/x11/x11graph.c index ad79a3e61..444ae3bab 100644 --- a/src/x11/x11graph.c +++ b/src/x11/x11graph.c @@ -26,10 +26,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. /* Simple graphics for X11 */ #include "x11.h" -#include -#include -#include -#include #define RESOURCE_NAME "schemeGraphics" #define RESOURCE_CLASS "SchemeGraphics" diff --git a/src/x11/x11term.c b/src/x11/x11term.c index cf37655e9..7430edff2 100644 --- a/src/x11/x11term.c +++ b/src/x11/x11term.c @@ -25,7 +25,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. /* X11 terminal for Edwin. */ -#include #include "x11.h" struct xterm_extra