From b990022c95ac73a8f1cdf78bd4fc58b157cdeda3 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Thu, 30 Dec 2004 01:13:03 +0000 Subject: [PATCH] fix libFLAC to build PPC asm properly, conditionalized for gas or as --- configure.in | 20 +++++++++++++++++++- src/libFLAC/Makefile.am | 7 ++++++- src/libFLAC/ppc/Makefile.am | 2 -- src/libFLAC/ppc/as/Makefile.am | 9 +++++++++ src/libFLAC/ppc/gas/Makefile.am | 9 +++++++++ 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index ad35ae80..b6b8e67f 100644 --- a/configure.in +++ b/configure.in @@ -169,12 +169,26 @@ if test -n "$DOCBOOK_TO_MAN" ; then AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN) fi +# only matters for x86 AC_CHECK_PROGS(NASM, nasm) AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM") if test -n "$NASM" ; then AC_DEFINE(FLAC__HAS_NASM) fi +# only matters for PowerPC +AC_CHECK_PROGS(AS, as) +AC_CHECK_PROGS(GAS, gas) +AM_CONDITIONAL(FLaC__HAS_AS, test -n "$AS") +AM_CONDITIONAL(FLaC__HAS_GAS, test -n "$GAS") +if test -n "$AS" ; then +AC_DEFINE(FLAC__HAS_AS) +fi +if test -n "$GAS" ; then +# funniest. macro. ever. +AC_DEFINE(FLAC__HAS_GAS) +fi + OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include' if test x$debug = xtrue; then OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -g -O0 -DDEBUG" @@ -196,7 +210,9 @@ AH_TEMPLATE(FLAC__EXHAUSTIVE_TESTS, [define to run even more tests]) AH_TEMPLATE(FLAC__VALGRIND_TESTING, [define to enable use of Valgrind in testers]) AH_TEMPLATE(FLAC__HAS_DOXYGEN, [define if you have Doxygen]) AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man]) -AH_TEMPLATE(FLAC__HAS_NASM, [define if you have the NASM assembler]) +AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler]) +AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler]) +AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler]) AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library]) AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code]) AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions]) @@ -209,6 +225,8 @@ AC_OUTPUT( \ src/libFLAC/Makefile \ src/libFLAC/ia32/Makefile \ src/libFLAC/ppc/Makefile \ + src/libFLAC/ppc/as/Makefile \ + src/libFLAC/ppc/gas/Makefile \ src/libFLAC/include/Makefile \ src/libFLAC/include/private/Makefile \ src/libFLAC/include/protected/Makefile \ diff --git a/src/libFLAC/Makefile.am b/src/libFLAC/Makefile.am index 30e2f672..724e881f 100644 --- a/src/libFLAC/Makefile.am +++ b/src/libFLAC/Makefile.am @@ -44,8 +44,13 @@ endif endif if FLaC__CPU_PPC ARCH_SUBDIRS = ppc -#@@@@@@ need to conditionalize this to gas or as depending on configure +if FLaC__HAS_AS libFLAC_la_LIBADD = ppc/as/libFLAC-asm.la +else +if FLaC__HAS_GAS +libFLAC_la_LIBADD = ppc/gas/libFLAC-asm.la +endif +endif LOCAL_EXTRA_LDFLAGS = "-Wl,-read_only_relocs,warning" endif endif diff --git a/src/libFLAC/ppc/Makefile.am b/src/libFLAC/ppc/Makefile.am index c88ac7e4..d40dc77e 100644 --- a/src/libFLAC/ppc/Makefile.am +++ b/src/libFLAC/ppc/Makefile.am @@ -28,6 +28,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#@@@@@@ We actually want to only compile one based on some configuration, -#@@@@@@ so we'll eventually have to conditionalize the sub-Makefile.am's SUBDIRS = as gas diff --git a/src/libFLAC/ppc/as/Makefile.am b/src/libFLAC/ppc/as/Makefile.am index 181dbaeb..a0359c47 100644 --- a/src/libFLAC/ppc/as/Makefile.am +++ b/src/libFLAC/ppc/as/Makefile.am @@ -28,6 +28,8 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +if FLaC__HAS_AS + SUFFIXES = .s .lo STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh @@ -40,3 +42,10 @@ STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh noinst_LTLIBRARIES = libFLAC-asm.la libFLAC_asm_la_SOURCES = \ lpc_asm.s + +else + +EXTRA_DIST = \ + lpc_asm.s + +endif diff --git a/src/libFLAC/ppc/gas/Makefile.am b/src/libFLAC/ppc/gas/Makefile.am index bc6fc2c7..e4891595 100644 --- a/src/libFLAC/ppc/gas/Makefile.am +++ b/src/libFLAC/ppc/gas/Makefile.am @@ -28,6 +28,8 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +if FLaC__HAS_GAS + SUFFIXES = .s .lo STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh @@ -40,3 +42,10 @@ STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh noinst_LTLIBRARIES = libFLAC-asm.la libFLAC_asm_la_SOURCES = \ lpc_asm.s + +else + +EXTRA_DIST = \ + lpc_asm.s + +endif