Skip to content

Commit

Permalink
build: support macos
Browse files Browse the repository at this point in the history
Add the bare minimum to make fvwm3 compile on MacOS.  Albeit for
now with some warnings.
  • Loading branch information
ThomasAdam committed Dec 2, 2023
1 parent b725f2e commit 342733d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
23 changes: 22 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,34 @@ AC_CANONICAL_HOST
AC_MSG_CHECKING(platform)
case "$host_os" in
freebsd*)
PLATFORM=freebsd
AC_MSG_RESULT(FreeBSD)
AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
;;
*openbsd*)
PLATFORM=openbsd
AC_MSG_RESULT(OpenBSD)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
;;
*darwin*)
PLATFORM=macos
AC_MSG_RESULT(MacOS)
;;
*)
PLATFORM=unknown
AC_MSG_RESULT(unknown)
;;
esac

AC_SUBST(PLATFORM)

AM_CONDITIONAL([HOST_MACOS], [test "$PLATFORM" = "macos"])

if test "x$PLATFORM" = "xmacos"; then
AC_DEFINE([HOST_MACOS], [macos], [Host is MacOS])
fi

PKG_PROG_PKG_CONFIG

PKG_CHECK_MODULES([xt],[xt],
Expand Down Expand Up @@ -1359,13 +1375,18 @@ AH_VERBATIM([_ZEND_EXPLICIT_DEFINITIONS],
#define SUPPRESS_UNUSED_VAR_WARNING(x) \
do { void *p; p = (void *)&x; (void)p; } while (0);
#ifdef HOST_MACOS
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
#else
#ifndef HAVE_STRLCAT
# include "libs/strlcat.h"
#endif
#ifndef HAVE_STRLCPY
# include "libs/strlcpy.h"
#endif
#endif
#ifndef HAVE_ASPRINTF
int asprintf(char **, const char *, ...);
Expand Down Expand Up @@ -1488,4 +1509,4 @@ Fvwm3 Configuration:
Build man pages? $with_mandoc$problem_mandoc
Build html man pages? $with_htmldoc$problem_htmldoc

"
"
10 changes: 8 additions & 2 deletions libs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ libfvwm3_a_SOURCES = \
XError.h XResource.h charmap.h defaults.h envvar.h fio.h flist.h fqueue.h \
fsm.h ftime.h fvwm_sys_stat.h fvwm_x11.h fvwmlib.h fvwmrect.h fvwmsignal.h \
gravity.c gravity.h getpwuid.h lang-strings.h log.h modifiers.h queue.h \
safemalloc.h setpgrp.h strlcat.h strlcpy.h timeout.h vpacket.h wcontext.h wild.h \
safemalloc.h setpgrp.h timeout.h vpacket.h wcontext.h wild.h \
cJSON.h tree.h strtonum.h \
\
BidiJoin.c Flocale.c PictureUtils.c FScreen.c Graphics.c \
Expand All @@ -27,9 +27,15 @@ libfvwm3_a_SOURCES = \
fvwmrect.c FRenderInit.c safemalloc.c FBidi.c \
wild.c Grab.c Event.c ClientMsg.c setpgrp.c FShape.c \
FGettext.c Rectangles.c timeout.c flist.c charmap.c wcontext.c \
modifiers.c fsm.c FTips.c fio.c fvwmlib3.c strlcat.c strlcpy.c \
modifiers.c fsm.c FTips.c fio.c fvwmlib3.c \
getpwuid.c cJSON.c strtonum.c

if HOST_MACOS
foo=
else
libfvwm3_a_SOURCES += strlcpy.h strlcat.h strlcpy.c strlcat.c
endif

libfvwm3_a_LIBADD = @LIBOBJS@

AM_CPPFLAGS = -I$(top_srcdir) $(xpm_CFLAGS) $(Xft_CFLAGS) $(X_CFLAGS) \
Expand Down
7 changes: 6 additions & 1 deletion modules/FvwmMFL/FvwmMFL.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
#include <stdbool.h>
#include <unistd.h>

#ifdef HOST_MACOS
#include <event.h>
#else
#include <event2/event.h>
#endif

/* FIXME: including event_struct.h won't be binary comaptible with future
* versions of libevent.
*/
Expand Down Expand Up @@ -898,4 +903,4 @@ int main(int argc, char **argv)
unlink(sock_pathname);

return (0);
}
}
2 changes: 1 addition & 1 deletion modules/FvwmMFL/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ LDADD = -L$(top_builddir)/libs $(X_LIBS) -lfvwm3 \
$(X_PRE_LIBS) -lXext -lX11 $(X_EXTRA_LIBS) $(XRandR_LIBS) \
$(libevent_LIBS) $(Xft_LIBS)

AM_CPPFLAGS = -I$(top_srcdir) $(X_CFLAGS) $(Xft_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir) $(X_CFLAGS) $(Xft_CFLAGS) $(libevent_CFLAGS)

0 comments on commit 342733d

Please sign in to comment.