[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] Configure-test for vararg macros
From: |
Nicklas Lindgren |
Subject: |
[RP] Configure-test for vararg macros |
Date: |
Tue Nov 12 14:55:03 2002 |
Hello,
Here's a patch that adds a configure-test for vararg macros in the c
compiler, and provides a (hopefully) safe alternative if they are missing.
It also fixes a case of pointer-arithmetic on a void pointer, a missing
semicolon after a PRINT_DEBUG (which becomes a problem with it's alternate
definition), and makes sure that the compiler is gcc before providing more
CFLAGS.
This patch makes ratpoison compile under HP-UX 11 with hp's c-compiler.
--Nicklas
diff -r -u ratpoison-before/configure.in
/pkg/ratpoison/src/ratpoison-cvs.20021112/configure.in
--- ratpoison-before/configure.in 2002-03-10 21:42:55.000000000 +0100
+++ /pkg/ratpoison/src/ratpoison-cvs.20021112/configure.in 2002-11-12
23:07:34.395677000 +0100
@@ -43,11 +43,27 @@
term_prog=$withval, term_prog="xterm")
AC_DEFINE_UNQUOTED(TERM_PROG,"$term_prog")
+
+
+
dnl Checks for programs.
-CFLAGS="$CFLAGS -Wall -O2"
AC_CHECK_TOOL(CC, gcc)
AC_PROG_CC
+if test "x$CC" = "xgcc"; then
+ CFLAGS="$CFLAGS -Wall -O2"
+fi
+
+dnl Check for vararg macros
+AC_PROG_CPP
+AC_MSG_CHECKING(for vararg macros)
+AC_TRY_CPP([
+#define VARARGS(first, more...) foo(first, ## more)
+VARARGS(bar, gazonk)
+VARARGS(bar, gazonk, blahonga)
+], AC_DEFINE_UNQUOTED(HAVE_VARARG_MACROS, "1", The c preprocessor has support
for vararg macros) AC_MSG_RESULT(yes),
+AC_MSG_RESULT(no))
+
dnl check for an x terminal emulator
AC_MSG_CHECKING(terminal emulator)
AC_MSG_RESULT($term_prog)
diff -r -u ratpoison-before/src/actions.c
/pkg/ratpoison/src/ratpoison-cvs.20021112/src/actions.c
--- ratpoison-before/src/actions.c 2002-10-18 11:03:43.000000000 +0200
+++ /pkg/ratpoison/src/ratpoison-cvs.20021112/src/actions.c 2002-11-12
22:05:43.993583000 +0100
@@ -454,7 +454,7 @@
keydesc = (char*) xmalloc (strlen (data) + 1);
sscanf (data, "%s", keydesc);
- cmd = data + strlen (keydesc);
+ cmd = ((char *) data) + strlen (keydesc);
/* Gobble remaining whitespace before command starts */
while (*cmd == ' ')
diff -r -u ratpoison-before/src/events.c
/pkg/ratpoison/src/ratpoison-cvs.20021112/src/events.c
--- ratpoison-before/src/events.c 2002-04-25 15:22:34.000000000 +0200
+++ /pkg/ratpoison/src/ratpoison-cvs.20021112/src/events.c 2002-11-12
22:13:52.725188000 +0100
@@ -330,8 +330,8 @@
{
rp_window *win;
- PRINT_DEBUG ("WM_CHANGE_STATE\n")
-
+ PRINT_DEBUG ("WM_CHANGE_STATE\n");
+
win = find_window (ev->window);
if (win == NULL) return;
if (ev->format == 32 && ev->data.l[0] == IconicState)
diff -r -u ratpoison-before/src/ratpoison.h
/pkg/ratpoison/src/ratpoison-cvs.20021112/src/ratpoison.h
--- ratpoison-before/src/ratpoison.h 2001-12-21 12:58:56.000000000 +0100
+++ /pkg/ratpoison/src/ratpoison-cvs.20021112/src/ratpoison.h 2002-11-12
22:13:00.843594000 +0100
@@ -33,6 +33,7 @@
/* Some error reporting macros */
#define PRE_PRINT_LOCATION fprintf (stderr, "%s:%s():%d: ", __FILE__,
__FUNCTION__, __LINE__);
+#ifdef HAVE_VARARG_MACROS
#define PRINT_ERROR(format, args...) \
{ fprintf (stderr, PACKAGE ":error -- "); PRE_PRINT_LOCATION; fprintf
(stderr, format, ## args); }
@@ -43,6 +44,10 @@
#else
# define PRINT_DEBUG(format, args...)
#endif /* DEBUG */
+#else
+#define PRINT_ERROR (void)
+#define PRINT_DEBUG (void)
+#endif
extern XGCValues gv;
- [RP] Configure-test for vararg macros,
Nicklas Lindgren <=