Autotools 使用Automake确定Makefile.am中的体系结构

Autotools 使用Automake确定Makefile.am中的体系结构,autotools,automake,computer-architecture,Autotools,Automake,Computer Architecture,要了解我正在尝试做什么,请参见以下内容: 我的问题是,如何有条件地设置AM_或CPP标志 my_lib_la_CPPFLAGS在我的Makefile.am中。这样,当配置 是否设置了正确的运行标志 目前我正在做一些影响到: lib_xml_wrapper_la_CPPFLAGS = -I../../ UNAME_S = $(shell uname -s) UNAME_P = $(shell uname -p) ifeq ($(UNAME_S),Linux) l

要了解我正在尝试做什么,请参见以下内容:

我的问题是,如何有条件地设置AM_或CPP标志 my_lib_la_CPPFLAGS在我的Makefile.am中。这样,当配置 是否设置了正确的运行标志

目前我正在做一些影响到:

lib_xml_wrapper_la_CPPFLAGS = -I../../

UNAME_S = $(shell uname -s)   
UNAME_P = $(shell uname -p)   
ifeq ($(UNAME_S),Linux)       
    lib_xml_wrapper_la_CPPFLAGS += -DLINUX
    ifeq ($(UNAME_P),x86_64)  
        lib_xml_wrapper_la_CPPFLAGS += -D AMD64
    endif
    ifeq ($(UNAME_P),x86_64)  
        lib_xml_wrapper_la_CPPFLAGS += -I../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/
    endif
    ifneq ($(filter %86,$(UNAME_P)),)
        lib_xml_wrapper_la_CPPFLAGS += -I../../../external/xerces-c-3.1.1-x86-linux-gcc-3.4/include/
    endif
    ifneq ($(filter arm%,$(UNAME_P)),)
        lib_xml_wrapper_la_CPPFLAGS += 
    endif
endif
ifeq ($(UNAME_S),Darwin)
    lib_xml_wrapper_la_CPPFLAGS += -DOSX
    ifneq ($(filter %86,$(UNAME_P)),)
        lib_xml_wrapper_la_CPPFLAGS += -I../../../external/xerces-c-3.1.1-x86-macosx-gcc-3.4/include/
    endif
    ifneq ($(filter arm%,$(UNAME_P)),)
        lib_xml_wrapper_la_CPPFLAGS += 
    endif
endif
这在Makefile.am中似乎不起作用。我收到以下错误:

xml_wrapper/Makefile.am:26: error: endif without if
xml_wrapper/Makefile.am:35: error: endif without if
automake: warnings are treated as errors
xml_wrapper/Makefile.am:10: warning: shell uname -s: non-POSIX variable name
xml_wrapper/Makefile.am:10: (probably a GNU make extension)
xml_wrapper/Makefile.am:11: warning: shell uname -p: non-POSIX variable name
xml_wrapper/Makefile.am:11: (probably a GNU make extension)
xml_wrapper/Makefile.am:20: warning: filter %86,$(UNAME_P: non-POSIX variable name
xml_wrapper/Makefile.am:20: (probably a GNU make extension)
xml_wrapper/Makefile.am:23: warning: filter arm%,$(UNAME_P: non-POSIX variable name
xml_wrapper/Makefile.am:23: (probably a GNU make extension)
xml_wrapper/Makefile.am:29: warning: filter %86,$(UNAME_P: non-POSIX variable name
xml_wrapper/Makefile.am:29: (probably a GNU make extension)
xml_wrapper/Makefile.am:32: warning: filter arm%,$(UNAME_P: non-POSIX variable name
xml_wrapper/Makefile.am:32: (probably a GNU make extension)

选择CPU和操作系统在
configure.ac
中处理得更好,它具有
ac\u CANONICAL\u HOST
,解析
uname
的输出并将其置于标准格式:

配置.ac

...
AC_CANONICAL_HOST
WRAPPER_CPPFLAGS=""
AS_CASE([$host_os],
        [linux*],
        [
           WRAPPER_CPPFLAGS="$WRAPPER_CPPFLAGS -DLINUX"
           AS_CASE([$host_cpu],
                   [x86_64],
                   [
                       WRAPPER_CPPFLAGS="$WRAPPER_CPPFLAGS -DAMD64 -I../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include"
                   ],
                   [i?86],
                   [
                       WRAPPER_CPPFLAGS="$WRAPPER_CPPFLAGS -I../../../external/xerces-c-3.1.1-x86-linux-gcc-3.4/include"
                   ])
        ],
        [darwin*],
        [
           WRAPPER_CPPFLAGS="$WRAPPER_CPPFLAGS -DOSX"
           AS_CASE([$host_cpu],
                   [i?86],
                   [
                       WRAPPER_CPPFLAGS="$WRAPPER_CPPFLAGS -I../../../external/xerces-c-3.1.1-x86-macosx-gcc-3.4/include"
                   ])
        ])
AC_SUBST([WRAPPER_CPPFLAGS])
Makefile.am

...
lib_xml_wrapper_la_CPPFLAGS = -I../.. $(WRAPPER_CPPFLAGS)

我所尝试的@MikeKinghan可能与那篇文章相似,但我的要求不同。