* Patch to fix cross-compiling
@ 2012-11-02 16:11 George McCollister
2012-11-05 14:28 ` Steve Grubb
0 siblings, 1 reply; 5+ messages in thread
From: George McCollister @ 2012-11-02 16:11 UTC (permalink / raw)
To: linux-audit
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
I've created a patch against your SVN trunk which uses
ax_cc_for_build.m4 to provide CC_FOR_BUILD which is then used in
auparse/Makefile.am and lib/Makefile.am to build the utilities that run
on the build machine.
I was able to use this patch to cross-compile audit for my ARM platform.
I'm still in the process of testing audit on the ARM platform.
Comments, questions and critiques welcome.
Regards,
George McCollister
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-CC_FOR_BUILD-to-make-cross-compiling-work.patch --]
[-- Type: text/x-patch; name="0001-Use-CC_FOR_BUILD-to-make-cross-compiling-work.patch", Size: 21330 bytes --]
From 851be06769db3c21df166900aa1a281cf32324ec Mon Sep 17 00:00:00 2001
From: George McCollister <George.McCollister@gmail.com>
Date: Thu, 1 Nov 2012 13:28:49 -0500
Subject: [PATCH] Use CC_FOR_BUILD to make cross-compiling work
Signed-off-by: George McCollister <George.McCollister@gmail.com>
---
auparse/Makefile.am | 129 ++++++++++++++++++++++++++++---------------------
autogen.sh | 2 +-
configure.ac | 1 +
lib/Makefile.am | 91 ++++++++++++++++++----------------
m4/ax_cc_for_build.m4 | 77 +++++++++++++++++++++++++++++
5 files changed, 200 insertions(+), 100 deletions(-)
create mode 100644 m4/ax_cc_for_build.m4
diff --git a/auparse/Makefile.am b/auparse/Makefile.am
index 2f7306f..b9a6753 100644
--- a/auparse/Makefile.am
+++ b/auparse/Makefile.am
@@ -47,125 +47,142 @@ BUILT_SOURCES = captabs.h clocktabs.h clone-flagtabs.h epoll_ctls.h famtabs.h \
mmaptabs.h mounttabs.h nfprototabs.h open-flagtabs.h \
persontabs.h prottabs.h ptracetabs.h rlimittabs.h recvtabs.h \
signaltabs.h socktabs.h socktypetabs.h typetabs.h
-noinst_PROGRAMS = gen_captabs_h gen_clock_h gen_clone-flagtabs_h \
- gen_epoll_ctls_h gen_famtabs_h \
- gen_fcntl-cmdtabs_h gen_flagtabs_h \
- gen_icmptypetabs_h gen_ipctabs_h gen_nfprototabs_h \
- gen_mmaptabs_h gen_mounttabs_h \
- gen_open-flagtabs_h gen_persontabs_h gen_prottabs_h \
- gen_recvtabs_h gen_rlimit_h gen_ptracetabs_h \
- gen_signals_h gen_socktabs_h gen_socktypetabs_h gen_typetabs_h
-
-gen_captabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h captab.h
-gen_captabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="captab.h"'
+
+gen_captabs_h: ../lib/gen_tables.c ../lib/gen_tables.h captab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"captab.h\" \
+ -o $@ ../lib/gen_tables.c
captabs.h: gen_captabs_h Makefile
./gen_captabs_h --i2s cap > $@
-gen_clock_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h clocktab.h
-gen_clock_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="clocktab.h"'
+gen_clock_h: ../lib/gen_tables.c ../lib/gen_tables.h clocktab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"clocktab.h\" \
+ -o $@ ../lib/gen_tables.c
clocktabs.h: gen_clock_h Makefile
./gen_clock_h --i2s clock > $@
-gen_clone_flagtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h \
- clone-flagtab.h
-gen_clone_flagtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="clone-flagtab.h"'
+gen_clone-flagtabs_h: ../lib/gen_tables.c ../lib/gen_tables.h \
+ clone-flagtab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) \
+ -DTABLE_H=\"clone-flagtab.h\" -o $@ ../lib/gen_tables.c
clone-flagtabs.h: gen_clone-flagtabs_h Makefile
./gen_clone-flagtabs_h --i2s-transtab clone_flag > $@
-gen_epoll_ctls_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h epoll_ctl.h
-gen_epoll_ctls_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="epoll_ctl.h"'
+gen_epoll_ctls_h: ../lib/gen_tables.c ../lib/gen_tables.h epoll_ctl.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"epoll_ctl.h\" \
+ -o $@ ../lib/gen_tables.c
epoll_ctls.h: gen_epoll_ctls_h Makefile
./gen_epoll_ctls_h --i2s epoll_ctl > $@
-gen_famtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h famtab.h
-gen_famtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="famtab.h"'
+gen_famtabs_h: ../lib/gen_tables.c ../lib/gen_tables.h famtab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"famtab.h\" \
+ -o $@ ../lib/gen_tables.c
famtabs.h: gen_famtabs_h Makefile
./gen_famtabs_h --i2s fam > $@
-gen_flagtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h flagtab.h
# ../auparse/ is used to avoid using ../lib/flagtab.h
-gen_flagtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="../auparse/flagtab.h"'
+gen_flagtabs_h: ../lib/gen_tables.c ../lib/gen_tables.h flagtab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) \
+ -DTABLE_H=\"../auparse/flagtab.h\" -o $@ ../lib/gen_tables.c
flagtabs.h: gen_flagtabs_h Makefile
./gen_flagtabs_h --i2s-transtab flag > $@
-gen_fcntl_cmdtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h \
- fcntl-cmdtab.h
-gen_fcntl_cmdtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="fcntl-cmdtab.h"'
+gen_fcntl-cmdtabs_h: ../lib/gen_tables.c ../lib/gen_tables.h fcntl-cmdtab.h \
+ Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"fcntl-cmdtab.h\" \
+ -o $@ ../lib/gen_tables.c
fcntl-cmdtabs.h: gen_fcntl-cmdtabs_h Makefile
./gen_fcntl-cmdtabs_h --i2s fcntl > $@
-gen_icmptypetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h icmptypetab.h
-gen_icmptypetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="icmptypetab.h"'
+gen_icmptypetabs_h: ../lib/gen_tables.c ../lib/gen_tables.h icmptypetab.h \
+ Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"icmptypetab.h\" \
+ -o $@ ../lib/gen_tables.c
icmptypetabs.h: gen_icmptypetabs_h Makefile
./gen_icmptypetabs_h --i2s icmptype > $@
-gen_ipctabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h ipctab.h
-gen_ipctabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ipctab.h"'
+gen_ipctabs_h: ../lib/gen_tables.c ../lib/gen_tables.h ipctab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"ipctab.h\" \
+ -o $@ ../lib/gen_tables.c
ipctabs.h: gen_ipctabs_h Makefile
./gen_ipctabs_h --i2s ipc > $@
-gen_mmaptabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h mmaptab.h
-gen_mmaptabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="mmaptab.h"'
+gen_mmaptabs_h: ../lib/gen_tables.c ../lib/gen_tables.h mmaptab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"mmaptab.h\" \
+ -o $@ ../lib/gen_tables.c
mmaptabs.h: gen_mmaptabs_h Makefile
./gen_mmaptabs_h --i2s-transtab mmap > $@
-gen_mounttabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h mounttab.h
-gen_mounttabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="mounttab.h"'
+gen_mounttabs_h: ../lib/gen_tables.c ../lib/gen_tables.h mounttab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"mounttab.h\" \
+ -o $@ ../lib/gen_tables.c
mounttabs.h: gen_mounttabs_h Makefile
./gen_mounttabs_h --i2s-transtab mount > $@
-gen_nfprototabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h nfprototab.h
-gen_nfprototabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="nfprototab.h"'
+gen_nfprototabs_h: ../lib/gen_tables.c ../lib/gen_tables.h nfprototab.h \
+ Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"nfprototab.h\" \
+ -o $@ ../lib/gen_tables.c
nfprototabs.h: gen_nfprototabs_h Makefile
./gen_nfprototabs_h --i2s nfproto > $@
-gen_open_flagtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h \
- open-flagtab.h
-gen_open_flagtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="open-flagtab.h"'
+gen_open-flagtabs_h: ../lib/gen_tables.c ../lib/gen_tables.h open-flagtab.h \
+ Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"open-flagtab.h\" \
+ -o $@ ../lib/gen_tables.c
open-flagtabs.h: gen_open-flagtabs_h Makefile
./gen_open-flagtabs_h --i2s-transtab open_flag > $@
-gen_persontabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h persontab.h
-gen_persontabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="persontab.h"'
+gen_persontabs_h: ../lib/gen_tables.c ../lib/gen_tables.h persontab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"persontab.h\" \
+ -o $@ ../lib/gen_tables.c
persontabs.h: gen_persontabs_h Makefile
./gen_persontabs_h --i2s person > $@
-gen_ptracetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h ptracetab.h
-gen_ptracetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ptracetab.h"'
+gen_ptracetabs_h: ../lib/gen_tables.c ../lib/gen_tables.h ptracetab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"ptracetab.h\" \
+ -o $@ ../lib/gen_tables.c
ptracetabs.h: gen_ptracetabs_h Makefile
./gen_ptracetabs_h --i2s ptrace > $@
-gen_prottabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h prottab.h
-gen_prottabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="prottab.h"'
+gen_prottabs_h: ../lib/gen_tables.c ../lib/gen_tables.h prottab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"prottab.h\" \
+ -o $@ ../lib/gen_tables.c
prottabs.h: gen_prottabs_h Makefile
./gen_prottabs_h --i2s-transtab prot > $@
-gen_recvtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h recvtab.h
-gen_recvtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="recvtab.h"'
+gen_recvtabs_h: ../lib/gen_tables.c ../lib/gen_tables.h recvtab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"recvtab.h\" \
+ -o $@ ../lib/gen_tables.c
recvtabs.h: gen_recvtabs_h Makefile
./gen_recvtabs_h --i2s-transtab recv > $@
-gen_rlimit_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h rlimittab.h
-gen_rlimit_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="rlimittab.h"'
+gen_rlimit_h: ../lib/gen_tables.c ../lib/gen_tables.h rlimittab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"rlimittab.h\" \
+ -o $@ ../lib/gen_tables.c
rlimittabs.h: gen_rlimit_h Makefile
./gen_rlimit_h --i2s rlimit > $@
-gen_signals_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h signaltab.h
-gen_signals_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="signaltab.h"'
+gen_signals_h: ../lib/gen_tables.c ../lib/gen_tables.h signaltab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"signaltab.h\" \
+ -o $@ ../lib/gen_tables.c
signaltabs.h: gen_signals_h Makefile
./gen_signals_h --i2s signal > $@
-gen_socktabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h socktab.h
-gen_socktabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="socktab.h"'
+gen_socktabs_h: ../lib/gen_tables.c ../lib/gen_tables.h socktab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"socktab.h\" \
+ -o $@ ../lib/gen_tables.c
socktabs.h: gen_socktabs_h Makefile
./gen_socktabs_h --i2s sock > $@
-gen_socktypetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h socktypetab.h
-gen_socktypetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="socktypetab.h"'
+gen_socktypetabs_h: ../lib/gen_tables.c ../lib/gen_tables.h socktypetab.h \
+ Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"socktypetab.h\" \
+ -o $@ ../lib/gen_tables.c
socktypetabs.h: gen_socktypetabs_h Makefile
./gen_socktypetabs_h --i2s sock_type > $@
-gen_typetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h typetab.h
-gen_typetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="typetab.h"'
+gen_typetabs_h: ../lib/gen_tables.c ../lib/gen_tables.h typetab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"typetab.h\" \
+ -o $@ ../lib/gen_tables.c
typetabs.h: gen_typetabs_h Makefile
./gen_typetabs_h --s2i type > $@
diff --git a/autogen.sh b/autogen.sh
index 205fd26..04653fe 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,5 +1,5 @@
#! /bin/sh
set -x -e
# --no-recursive is available only in recent autoconf versions
-autoreconf -fv --install
+autoreconf -fv --install -I m4
mv INSTALL.tmp INSTALL
diff --git a/configure.ac b/configure.ac
index e14df60..4245618 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,7 @@ echo Checking for programs
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_AWK
+AX_CC_FOR_BUILD
echo .
echo Checking for header files
diff --git a/lib/Makefile.am b/lib/Makefile.am
index c5952f9..fbd6bb1 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -47,99 +47,104 @@ endif
if USE_ARMEB
BUILT_SOURCES += armeb_tables.h
endif
-noinst_PROGRAMS = gen_actiontabs_h gen_errtabs_h gen_fieldtabs_h \
- gen_flagtabs_h gen_ftypetabs_h gen_i386_tables_h \
- gen_ia64_tables_h gen_machinetabs_h gen_msg_typetabs_h \
- gen_optabs_h gen_ppc_tables_h gen_s390_tables_h \
- gen_s390x_tables_h gen_x86_64_tables_h
-if USE_ALPHA
-noinst_PROGRAMS += gen_alpha_tables_h
-endif
-if USE_ARMEB
-noinst_PROGRAMS += gen_armeb_tables_h
-endif
-gen_actiontabs_h_SOURCES = gen_tables.c gen_tables.h actiontab.h
-gen_actiontabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="actiontab.h"'
+gen_actiontabs_h: gen_tables.c gen_tables.h actiontab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"actiontab.h\" \
+ -o $@ gen_tables.c
actiontabs.h: gen_actiontabs_h Makefile
./gen_actiontabs_h --lowercase --i2s --s2i action > $@
if USE_ALPHA
-gen_alpha_tables_h_SOURCES = gen_tables.c gen_tables.h alpha_table.h
-gen_alpha_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="alpha_table.h"'
+gen_alpha_tables_h: gen_tables.c gen_tables.h alpha_table.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"alpha_table.h\" \
+ -o $@ gen_tables.c
alpha_tables.h: gen_alpha_tables_h Makefile
./gen_alpha_tables_h --lowercase --i2s --s2i alpha_syscall > $@
endif
if USE_ARMEB
-gen_armeb_tables_h_SOURCES = gen_tables.c gen_tables.h armeb_table.h
-gen_armeb_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="armeb_table.h"'
+gen_armeb_tables_h: gen_tables.c gen_tables.h armeb_table.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"armeb_table.h\" \
+ -o $@ gen_tables.c
armeb_tables.h: gen_armeb_tables_h Makefile
./gen_armeb_tables_h --lowercase --i2s --s2i armeb_syscall > $@
endif
-gen_errtabs_h_SOURCES = gen_tables.c gen_tables.h errtab.h
-gen_errtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="errtab.h"'
+gen_errtabs_h: gen_tables.c gen_tables.h errtab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"errtab.h\" \
+ -o $@ gen_tables.c
errtabs.h: gen_errtabs_h Makefile
./gen_errtabs_h --duplicate-ints --uppercase --i2s --s2i err > $@
-gen_fieldtabs_h_SOURCES = gen_tables.c gen_tables.h fieldtab.h
-gen_fieldtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="fieldtab.h"'
+gen_fieldtabs_h: gen_tables.c gen_tables.h fieldtab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"fieldtab.h\" \
+ -o $@ gen_tables.c
fieldtabs.h: gen_fieldtabs_h Makefile
./gen_fieldtabs_h --duplicate-ints --lowercase --i2s --s2i field > $@
-gen_flagtabs_h_SOURCES = gen_tables.c gen_tables.h flagtab.h
-gen_flagtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="flagtab.h"'
+gen_flagtabs_h: gen_tables.c gen_tables.h flagtab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"flagtab.h\" \
+ -o $@ gen_tables.c
flagtabs.h: gen_flagtabs_h Makefile
./gen_flagtabs_h --lowercase --i2s --s2i flag > $@
-gen_ftypetabs_h_SOURCES = gen_tables.c gen_tables.h ftypetab.h
-gen_ftypetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ftypetab.h"'
+gen_ftypetabs_h: gen_tables.c gen_tables.h ftypetab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"ftypetab.h\" \
+ -o $@ gen_tables.c
ftypetabs.h: gen_ftypetabs_h Makefile
./gen_ftypetabs_h --lowercase --i2s --s2i ftype > $@
-gen_i386_tables_h_SOURCES = gen_tables.c gen_tables.h i386_table.h
-gen_i386_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="i386_table.h"'
+gen_i386_tables_h: gen_tables.c gen_tables.h i386_table.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"i386_table.h\" \
+ -o $@ gen_tables.c
i386_tables.h: gen_i386_tables_h Makefile
./gen_i386_tables_h --duplicate-ints --lowercase --i2s --s2i \
i386_syscall > $@
-gen_ia64_tables_h_SOURCES = gen_tables.c gen_tables.h ia64_table.h
-gen_ia64_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ia64_table.h"'
+gen_ia64_tables_h: gen_tables.c gen_tables.h ia64_table.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"ia64_table.h\" \
+ -o $@ gen_tables.c
ia64_tables.h: gen_ia64_tables_h Makefile
./gen_ia64_tables_h --lowercase --i2s --s2i ia64_syscall > $@
-gen_machinetabs_h_SOURCES = gen_tables.c gen_tables.h machinetab.h
-gen_machinetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="machinetab.h"'
+gen_machinetabs_h: gen_tables.c gen_tables.h machinetab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"machinetab.h\" \
+ -o $@ gen_tables.c
machinetabs.h: gen_machinetabs_h Makefile
./gen_machinetabs_h --duplicate-ints --lowercase --i2s --s2i machine \
> $@
-gen_msg_typetabs_h_SOURCES = gen_tables.c gen_tables.h msg_typetab.h
-gen_msg_typetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="msg_typetab.h"'
+gen_msg_typetabs_h: gen_tables.c gen_tables.h msg_typetab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"msg_typetab.h\" \
+ -o $@ gen_tables.c
msg_typetabs.h: gen_msg_typetabs_h Makefile
./gen_msg_typetabs_h --uppercase --i2s --s2i msg_type > $@
-gen_optabs_h_SOURCES = gen_tables.c gen_tables.h optab.h
-gen_optabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="optab.h"'
+gen_optabs_h: gen_tables.c gen_tables.h optab.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"optab.h\" \
+ -o $@ gen_tables.c
optabs.h: gen_optabs_h Makefile
./gen_optabs_h --i2s op > $@
-gen_ppc_tables_h_SOURCES = gen_tables.c gen_tables.h ppc_table.h
-gen_ppc_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ppc_table.h"'
+gen_ppc_tables_h: gen_tables.c gen_tables.h ppc_table.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"ppc_table.h\" \
+ -o $@ gen_tables.c
ppc_tables.h: gen_ppc_tables_h Makefile
./gen_ppc_tables_h --lowercase --i2s --s2i ppc_syscall > $@
-gen_s390_tables_h_SOURCES = gen_tables.c gen_tables.h s390_table.h
-gen_s390_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="s390_table.h"'
+gen_s390_tables_h: gen_tables.c gen_tables.h s390_table.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"s390_table.h\" \
+ -o $@ gen_tables.c
s390_tables.h: gen_s390_tables_h Makefile
./gen_s390_tables_h --lowercase --i2s --s2i s390_syscall > $@
-gen_s390x_tables_h_SOURCES = gen_tables.c gen_tables.h s390x_table.h
-gen_s390x_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="s390x_table.h"'
+gen_s390x_tables_h: gen_tables.c gen_tables.h s390x_table.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"s390x_table.h\" \
+ -o $@ gen_tables.c
s390x_tables.h: gen_s390x_tables_h Makefile
./gen_s390x_tables_h --lowercase --i2s --s2i s390x_syscall > $@
-gen_x86_64_tables_h_SOURCES = gen_tables.c gen_tables.h x86_64_table.h
-gen_x86_64_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="x86_64_table.h"'
+gen_x86_64_tables_h: gen_tables.c gen_tables.h x86_64_table.h Makefile
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) -DTABLE_H=\"x86_64_table.h\" \
+ -o $@ gen_tables.c
x86_64_tables.h: gen_x86_64_tables_h Makefile
./gen_x86_64_tables_h --lowercase --i2s --s2i x86_64_syscall > $@
diff --git a/m4/ax_cc_for_build.m4 b/m4/ax_cc_for_build.m4
new file mode 100644
index 0000000..c880fd0
--- /dev/null
+++ b/m4/ax_cc_for_build.m4
@@ -0,0 +1,77 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_cc_for_build.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CC_FOR_BUILD
+#
+# DESCRIPTION
+#
+# Find a build-time compiler. Sets CC_FOR_BUILD and EXEEXT_FOR_BUILD.
+#
+# LICENSE
+#
+# Copyright (c) 2010 Reuben Thomas <rrt@sc3d.org>
+# Copyright (c) 1999 Richard Henderson <rth@redhat.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 2
+
+dnl Get a default for CC_FOR_BUILD to put into Makefile.
+AC_DEFUN([AX_CC_FOR_BUILD],
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ CC_FOR_BUILD=gcc
+ fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+else
+ AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
+ [rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+AC_SUBST(EXEEXT_FOR_BUILD)])dnl
--
1.7.1
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: Patch to fix cross-compiling
2012-11-02 16:11 Patch to fix cross-compiling George McCollister
@ 2012-11-05 14:28 ` Steve Grubb
2012-11-05 14:38 ` George McCollister
0 siblings, 1 reply; 5+ messages in thread
From: Steve Grubb @ 2012-11-05 14:28 UTC (permalink / raw)
To: linux-audit
On Friday, November 02, 2012 11:11:58 AM George McCollister wrote:
> I've created a patch against your SVN trunk which uses
> ax_cc_for_build.m4 to provide CC_FOR_BUILD which is then used in
> auparse/Makefile.am and lib/Makefile.am to build the utilities that run
> on the build machine.
>
> I was able to use this patch to cross-compile audit for my ARM platform.
> I'm still in the process of testing audit on the ARM platform.
>
> Comments, questions and critiques welcome.
Well...it breaks the normal build on x86_64:
config.status: creating tools/aulastlog/Makefile
config.status: creating tools/ausyscall/Makefile
config.status: creating tools/auvirt/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
.
Auditd Version: 2.2.2
Target: x86_64-unknown-linux-gnu
Installation prefix: /usr
Compiler: gcc
Compiler flags:
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic
+ make -j4
make all-recursive
make[1]: Entering directory `/home/sgrubb/working/BUILD/audit-2.2.2'
Making all in lib
make[2]: Entering directory `/home/sgrubb/working/BUILD/audit-2.2.2/lib'
make[2]: *** No rule to make target `gen_tables.c', needed by
`gen_actiontabs_h'. Stop.
make[2]: Leaving directory `/home/sgrubb/working/BUILD/audit-2.2.2/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/sgrubb/working/BUILD/audit-2.2.2'
make: *** [all] Error 2
error: Bad exit status from /home/sgrubb/working/tmp/rpm-tmp.XYWHYB (%build)
RPM build errors:
Bad exit status from /home/sgrubb/working/tmp/rpm-tmp.XYWHYB (%build)
Done
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Patch to fix cross-compiling
2012-11-05 14:28 ` Steve Grubb
@ 2012-11-05 14:38 ` George McCollister
2012-11-05 17:25 ` Steve Grubb
0 siblings, 1 reply; 5+ messages in thread
From: George McCollister @ 2012-11-05 14:38 UTC (permalink / raw)
To: Steve Grubb; +Cc: linux-audit
On 11/05/2012 08:28 AM, Steve Grubb wrote:
> Well...it breaks the normal build on x86_64:
Works for me on x86_64. Did you remember to run autogen.sh so configure
gets regenerated before running configure? If that doesn't help it would
be helpful to get your lib/Makefile so I could analyze it.
Thanks,
George
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch to fix cross-compiling
2012-11-05 14:38 ` George McCollister
@ 2012-11-05 17:25 ` Steve Grubb
2012-11-05 18:52 ` George McCollister
0 siblings, 1 reply; 5+ messages in thread
From: Steve Grubb @ 2012-11-05 17:25 UTC (permalink / raw)
To: George McCollister; +Cc: linux-audit
On Monday, November 05, 2012 08:38:15 AM George McCollister wrote:
> On 11/05/2012 08:28 AM, Steve Grubb wrote:
> > Well...it breaks the normal build on x86_64:
> Works for me on x86_64. Did you remember to run autogen.sh so configure
> gets regenerated before running configure? If that doesn't help it would
> be helpful to get your lib/Makefile so I could analyze it.
I have a script that I use for testing all patches wrt the build. It have 2
modes, one that pulls a fresh copy from svn to check for missing files and one
that just uses the local svn cache so I can test prior to pushing. It does
something like this:
cwd=`pwd`
mkdir audt
cd audit
cp -r $trunk/* .
./autogen.sh
./configure --with-prelude -with-libwrap
make -j 8 dist
mv audit-$release.tar.gz ~/working/audit/
cd $cwd
rpmbuild -ba ../audit/audit.spec
Its failing under the rpmbuild which does not use the autogen script.
But there is another problem I didn't notice right away...it adds a new file,
m4/ax_cc_for_build.m4. In it is this:
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
The audit package is strictly GPL/LGPL v2.
-Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-05 18:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-02 16:11 Patch to fix cross-compiling George McCollister
2012-11-05 14:28 ` Steve Grubb
2012-11-05 14:38 ` George McCollister
2012-11-05 17:25 ` Steve Grubb
2012-11-05 18:52 ` George McCollister
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox