wafsamba/CHECK_LIB: replace dots in library names

Ralph Böhme rb at sernet.de
Thu Mar 27 11:30:44 MDT 2014


Hi

just ran across an issue where in CHECK_LIB a library containing a
version number including a dot in the library name resulted in a
macro defintion including the dot, eg

  libtracker-sparql-0.16

resulting macro:

  HAVE_LIBTRACKER_SPARQL_0.16

Compiler diagnostic:

  default/include/config.h:945:33: warning: missing whitespace after
  the macro name [enabled by default]

<http://gcc.gnu.org/onlinedocs/cpp/Tokenization.html#Tokenization>:

   "An identifier is the same as an identifier in C: any sequence of
   letters, digits, or underscores, which begins with a letter or
   underscore."

I've crafted a small patch which fixes the issue by substituting the
dot with an underscore. Review appreciated!

Thanks!
-Ralph

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de
-------------- next part --------------
>From edaa1f5224cbdb56ae693cd41c3c7fc842bd3045 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <rb at sernet.de>
Date: Thu, 27 Mar 2014 16:37:18 +0100
Subject: [PATCH 1/2] wafsamba: replace dots in library names

Certain libraries use a version number with a dot in the library name,
eg libtracker-sparql-0.16. The dot is passed to the HAVE_LIBXXX macro
but dots aren't allowed in C macros, compiler diagnostic:

  warning: missing whitespace after the macro name

Signed-off-by: Ralph Boehme <rb at sernet.de>
---
 buildtools/wafsamba/samba_autoconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index e14f9cd..4da2c25 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -559,7 +559,7 @@ int foo()
                 if set_target:
                     SET_TARGET_TYPE(conf, lib, 'EMPTY')
         else:
-            conf.define('HAVE_LIB%s' % lib.upper().replace('-','_'), 1)
+            conf.define('HAVE_LIB%s' % lib.upper().replace('-','_').replace('.','_'), 1)
             conf.env['LIB_' + lib.upper()] = lib
             if set_target:
                 conf.SET_TARGET_TYPE(lib, 'SYSLIB')
-- 
1.8.5.3



More information about the samba-technical mailing list