Permalink
Browse files

xorp: rtrmgr: Fix compiling of lex and yacc on BSD OSs

On BSD bison generates header files with .h suffix.
On other OSs it generates header files with .hh suffix.

Check which OS we use and include appropriate files.

Signed-off-by: Igor Maravic <igorm@etf.rs>
  • Loading branch information...
1 parent 8a06fc4 commit ecf035e957524765099b8f8051fb8acb5f2c1c70 @i-maravic i-maravic committed with Mar 14, 2012
Showing with 25 additions and 2 deletions.
  1. +3 −0 xorp/SConstruct
  2. +7 −2 xorp/rtrmgr/SConscript
  3. +5 −0 xorp/rtrmgr/boot.ll
  4. +5 −0 xorp/rtrmgr/op_commands.ll
  5. +5 −0 xorp/rtrmgr/template.ll
View
@@ -640,6 +640,9 @@ if not env.GetOption('clean') and \
osname = sys.platform.upper()
conf.Define('HOST_OS_NAME', '"' + osname + '"')
+ #export osname - needed for lex and yacc
+ env['osname'] = osname
+
# toolchain
conf.Define('CPP_SUPPORTS_C99_VA_ARGS')
conf.Define('CPP_SUPPORTS_GNU_VA_ARGS')
View
@@ -55,9 +55,14 @@ libxorp_rtrmgr_env = env.Clone()
#Create yacc files
yacc_env = env.Clone()
-yacc_env.Replace(YACCHXXFILESUFFIX='.hh')
-yacc_env.AppendUnique(YACCFLAGS='-d')
+# bison on BSD generates headers files with .h suffix,
+# while on other OSs it generates header files with .hh suffix
+if (env['osname'] == "FreeBSD" or env['osname'] == "NetBSD"):
+ yacc_env.Replace(YACCHXXFILESUFFIX='.h')
+else:
+ yacc_env.Replace(YACCHXXFILESUFFIX='.hh')
+yacc_env.AppendUnique(YACCFLAGS='-d')
tplt_env_y = yacc_env.Clone()
tplt_env_y.AppendUnique(YACCFLAGS='-ptplt')
View
@@ -12,7 +12,12 @@
#define YYSTYPE char*
#include "libxorp/xorp.h"
+
+#if defined(HOST_OS_FREEBSD) || defined(HOST_OS_NETBSD)
+#include "y.boot_tab.h"
+#else
#include "y.boot_tab.hh"
+#endif
#ifdef __xorp_unused
#define __unused __xorp_unused
@@ -12,7 +12,12 @@
#define YYSTYPE char*
#include "libxorp/xorp.h"
#include <string.h>
+
+#if defined(HOST_OS_FREEBSD) || defined(HOST_OS_NETBSD)
+#include "y.opcmd_tab.h"
+#else
#include "y.opcmd_tab.hh"
+#endif
#ifdef __xorp_unused
#define __unused __xorp_unused
View
@@ -11,7 +11,12 @@
#define YYSTYPE char*
#include "libxorp/xorp.h"
+
+#if defined(HOST_OS_FREEBSD) || defined(HOST_OS_NETBSD)
+#include "y.tplt_tab.h"
+#else
#include "y.tplt_tab.hh"
+#endif
#ifdef __xorp_unused
#define __unused __xorp_unused

0 comments on commit ecf035e

Please sign in to comment.