Makefile中: cpu_bit=$(shell getconf LONG_BIT) ifeq ($(cpu_bit),64) MY_CXXFLAGS= else MY_CXXFLAGS=-march=pentium4 endif x:: @echo $(cpu_bit) @echo $(MY_CXXFLAGS) automake中要稍複雜些: 首先要在configure.ac文件中添加一行: AM_CONDITIONAL(bit_32,test "x`getconf LONG_BIT`"="x32") 而後再在Makefile.am文件中添加: if bit_32 MY_CXXFLAGS=-march=pentium4 else MY_CXXFLAGS= endif 這樣就能夠了. |