📄 configure.in
字号:
dnl ==========================================================================AS=""AFLAGS=""ASSEMBLY_EXTENSION=""GENERIC_SOURCES="SRC_GENERIC"ASSEMBLY_SOURCES=""dnldnl IA32dnlif test "$ARCHITECTURE" = "IA32" -o "$ARCHITECTURE" = "X86_64" ; then dnl dnl Checking for nasm compatible programs dnl yasm is preferred over nasm, because... i can use it dnl to profile assembly code ;-) dnl found_nasm_comp_prog="no" chosen_asm_prog="" dnl Check for yasm first AC_CHECK_PROG([ac_yasm], [$yasm_prog], [yes], [no], , [yes]) if test "$ac_yasm" = "yes" ; then found_nasm_comp_prog="yes" chosen_asm_prog="$yasm_prog" fi dnl if yasm hasn't been found, then check for nasm (not buggy version) if test "$found_nasm_comp_prog" = "no" -a "$ARCHITECTURE" != "X86_64" ; then AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes]) if test "$ac_nasm" = "yes" ; then dnl dnl Checking nasm patch version dnl AC_MSG_CHECKING([for nasm patch version]) nasm_patch=`$nasm_prog -r | cut -d '.' -f 3 | cut -d ' ' -f 1` if test -z $nasm_patch ; then nasm_patch=-1 fi AC_MSG_RESULT([$nasm_patch]) if test "$nasm_patch" -lt "$minimum_nasm_patch_version" ; then AC_MSG_WARN([nasm patch version is too old]) else found_nasm_comp_prog="yes" chosen_asm_prog="$nasm_prog" fi fi fi dnl dnl Ok now sort what object format we must use dnl if test "$found_nasm_comp_prog" = "yes" ; then AC_MSG_CHECKING([for asm object format]) case "$target_os" in *bsd*|linux*|beos|irix*|solaris*) AC_MSG_RESULT([elf]) NASM_FORMAT="elf" MARK_FUNCS="-DMARK_FUNCS" PREFIX="" ;; [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) AC_MSG_RESULT([win32]) NASM_FORMAT="win32" PREFIX="-DPREFIX" MARK_FUNCS="" ;; esac AS="$chosen_asm_prog" ASSEMBLY_EXTENSION="asm" AFLAGS="-I\$(<D)/ -f $NASM_FORMAT $PREFIX $MARK_FUNCS" ASSEMBLY_SOURCES="SRC_${ARCHITECTURE}" if test "$ARCHITECTURE" = "X86_64" ; then AFLAGS=${AFLAGS}" -m amd64" fi else AC_MSG_WARN([no correct assembler was found - Compiling generic sources only]) ARCHITECTURE="GENERIC" fifidnldnl PPCdnldnl With the PPC platform we do not use assembly language, we better keep withdnl intrinsic altivec functions and types as they are supported by both Applednl and GNU gcc with very slight changes to code which can be sumed up by:dnldnl Apple:dnl - compile with the option -faltivecdnl - define vectors with parentheses vec = (0,0,0,0)dnl GNUdnl - compile with -maltivec -mabi=altivecdnl - include <altivec.h> before using intrincicdnl - define vectors with vec = {0,0,0,0}dnldnl * The compile time option will be "injected" into SPECIFIC_CFLAGS variablednl * The need for altivec.h will also be injected into SPECIFIC_CFLAGS throughdnl a -DHAVE_ALTIVEC_Hdnl * The vector definition is handled in portab.h thx todnl HAVE_PARENTHESES/BRACES_ALTIVEC_DECLdnlPPC_ALTIVEC_SOURCES=""if test "$ARCHITECTURE" = "PPC" ; then AS="\$(CC)" AFLAGS="" ASSEMBLY_EXTENSION=".s" ASSEMBLY_SOURCES="" AC_MSG_CHECKING([for altivec.h])cat > conftest.c << EOF#include <altivec.h>int main() { return(0); }EOF if $CC -faltivec -c conftest.c 2>/dev/null 1>/dev/null || \ $CC -maltivec -mabi=altivec -c conftest.c 2>/dev/null 1>/dev/null ; then AC_MSG_RESULT(yes) SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DHAVE_ALTIVEC_H" TEMP_ALTIVEC="-DHAVE_ALTIVEC_H" else AC_MSG_RESULT(no) TEMP_ALTIVEC="" fi AC_MSG_CHECKING([for Altivec compiler support])cat > conftest.c << EOF#ifdef HAVE_ALTIVEC_H#include <altivec.h>#endifint main(){ vector unsigned int vartest2 = (vector unsigned int)(0); vector unsigned int vartest3 = (vector unsigned int)(1); vartest2 = vec_add(vartest2, vartest3); return(0);}EOF if $CC $TEMP_ALTIVEC -faltivec -c conftest.c 2>/dev/null 1>/dev/null ; then AC_MSG_RESULT([yes (Apple)]) SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -faltivec -DHAVE_ALTIVEC_PARENTHESES_DECL $TEMP_ALTIVEC" PPC_ALTIVEC_SOURCES="SRC_PPC_ALTIVEC" elsecat > conftest.c << EOF#ifdef HAVE_ALTIVEC_H#include <altivec.h>#endifint main(){ vector unsigned int vartest2 = (vector unsigned int){0}; vector unsigned int vartest3 = (vector unsigned int){1}; vartest2 = vec_add(vartest2, vartest3); return(0);}EOF if $CC $TEMP_ALTIVEC -maltivec -mabi=altivec -c conftest.c 2>/dev/null 1>/dev/null ; then AC_MSG_RESULT([yes (GNU)]) SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -maltivec -mabi=altivec -DHAVE_ALTIVEC_BRACES_DECL $TEMP_ALTIVEC" PPC_ALTIVEC_SOURCES="SRC_PPC_ALTIVEC" else AC_MSG_RESULT([no (ppc support won't be compiled in)]) dnl Only C code can be compiled :-( ARCHITECTURE="GENERIC" fi fi rm -f conftest.*fidnldnl IA64dnlif test "$ARCHITECTURE" = "IA64" ; then AS="\$(CC)" AFLAGS="-c" ASSEMBLY_EXTENSION="s" ASSEMBLY_SOURCES="SRC_IA64" case `basename $CC` in *ecc*) DCT_IA64_SOURCES="SRC_IA64_IDCT_ECC" dnl If the compiler is ecc, then i don't know its options dnl fallback to "no options" if test "$force_default_cc_options" = "yes" ; then our_cflags_defaults="" fi ;; *) DCT_IA64_SOURCES="SRC_IA64_IDCT_GCC" ;; esacfidnl ==========================================================================dnldnl Check for header filesdnldnl ==========================================================================AC_CHECK_HEADERS( stdio.h \ signal.h \ stdlib.h \ string.h \ assert.h \ math.h \ , , AC_MSG_ERROR(Missing header file))dnl ==========================================================================dnldnl Now we can set CFLAGS if neededdnldnl ==========================================================================if test "$force_default_cc_options" = "yes" ; then CFLAGS="$our_cflags_defaults"fidnl ==========================================================================dnldnl Profiling stuff goes herednl - adds options to SPECIFIC_CFLAGS, SPECIFIC_LDLAGSdnl - removes incompatible options from CFLAGSdnldnl ==========================================================================SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS $GNU_PROF_LDFLAGS"SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS $GNU_PROF_CFLAGS"if test "$enable_gnuprofile" = "yes" ; then CFLAGS=`echo $CFLAGS | sed s/'-fomit-frame-pointer'/''/`fidnl ==========================================================================dnl Some gcc flags can't be used for gcc >= 3.4.0 dnl ==========================================================================if test "$GCC" = "yes" ; thencat << EOF > test.c#include <stdio.h>int main(int argc, char **argv){ if (*argv[[1]] == 'M') { printf("%d", __GNUC__); } if (*argv[[1]] == 'm') { printf("%d", __GNUC_MINOR__); } return 0;}EOF $CC -o gcc-ver test.c GCC_MAJOR=`./gcc-ver M` GCC_MINOR=`./gcc-ver m` rm -f test.c rm -f gcc-ver # GCC 4.x if test "${GCC_MAJOR}" -gt 3 ; then CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g` CFLAGS=`echo $CFLAGS | sed s,'-freduce-all-givs','',g` CFLAGS=`echo $CFLAGS | sed s,'-fmove-all-movables','',g` CFLAGS=`echo $CFLAGS | sed s,'-fnew-ra','',g` CFLAGS=`echo $CFLAGS | sed s,'-fwritable-strings','',g` fi # GCC 3.4.x if test "${GCC_MAJOR}" -eq 3 && test "${GCC_MINOR}" -gt 3 ; then CFLAGS=`echo $CFLAGS | sed s,"-mcpu","-mtune",g` fifidnl ==========================================================================dnldnl Substitionsdnldnl ==========================================================================AC_SUBST(FEATURES)AC_SUBST(ARCHITECTURE)AC_SUBST(BUS)AC_SUBST(ENDIANNESS)AC_SUBST(SHARED_EXTENSION)AC_SUBST(STATIC_EXTENSION)AC_SUBST(OBJECT_EXTENSION)AC_SUBST(NASM_FORMAT)AC_SUBST(AS)AC_SUBST(AFLAGS)AC_SUBST(ASSEMBLY_EXTENSION)AC_SUBST(GENERIC_SOURCES)AC_SUBST(ASSEMBLY_SOURCES)AC_SUBST(CC)AC_SUBST(CFLAGS)AC_SUBST(SPECIFIC_LDFLAGS)AC_SUBST(SPECIFIC_CFLAGS)AC_SUBST(DCT_IA64_SOURCES)AC_SUBST(PPC_ALTIVEC_SOURCES)AC_SUBST(RANLIB)AC_SUBST(API_MAJOR)AC_SUBST(API_MINOR)AC_SUBST(STATIC_LIB)AC_SUBST(PRE_SHARED_LIB)AC_SUBST(SHARED_LIB)dnl ==========================================================================dnldnl Output filesdnldnl ==========================================================================AC_CONFIG_FILES(platform.inc)AC_OUTPUT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -