Skip to content

Commit

Permalink
fsm_init: fix implicit function declaration _IceTransNoListen
Browse files Browse the repository at this point in the history
A declaration is required for `_IceTransNoListen` to link against libICE.

`_IceTransNoListen` is declared in X11/Xtrans/Xtrans.h (`xtrans-dev`) only when
configured for libICE by defining the following symbols: `ICE_t`
`TRANS_SERVER`.

(see [libICE configure.ac](https://gitlab.freedesktop.org/xorg/lib/libice/-/blob/master/configure.ac))

Add a check in configure.ac to determine if the build system has
X11/Xtrans/Xtrans.h, and define `ICE_t` and `TRANS_SERVER` if it does.

Add a preprocessor step in lib/fsm.c to switch between using Xtrans.h or
an extern declaration for the `_IceTransNoListen` symbol depending on
whether or not the build system has Xtrans.h.

Fixes #1031

Signed-off-by: Kara <[email protected]>
  • Loading branch information
kro-cat authored and ThomasAdam committed Jun 10, 2024
1 parent f036638 commit dfc46dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ if test ! x"$with_sm" = xno; then
[$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
ac_LIBS="$LIBS"
LIBS="$LIBS -lICE"
AC_CHECK_FUNCS([_IceTransNoListen])
AC_CHECK_FUNCS([_IceTransNoListen],
[AC_CHECK_HEADERS([X11/Xtrans/Xtrans.h],
[AC_DEFINE(ICE_t, 1, [Xtrans transport type])
dnl AC_DEFINE(TRANS_CLIENT, 1, [Xtrans transport client code])
AC_DEFINE(TRANS_SERVER, 1, [Xtrans transport server code])])])
LIBS="$ac_LIBS"
fi
dnl AC_SUBST(sm_LIBS)
Expand Down
5 changes: 5 additions & 0 deletions libs/fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
#include <X11/Xutil.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#if defined(HAVE_X11_XTRANS_XTRANS_H) && defined(HAVE__ICETRANSNOLISTEN)
#include <X11/Xtrans/Xtrans.h>
#elif defined(HAVE__ICETRANSNOLISTEN)
extern void _IceTransNoListen(char *protocol);
#endif

#include "fvwmlib.h"
#include "System.h"
Expand Down

0 comments on commit dfc46dd

Please sign in to comment.