dnl Process this file with autoconf to produce a configure script. AC_INIT(viterbi27.c) AC_CONFIG_HEADER(config.h) SO_NAME=2 VERSION=2.0.1 AC_SUBST(SO_NAME) AC_SUBST(VERSION) dnl Checks for programs. AC_PROG_CC if test $GCC != "yes" then AC_MSG_ERROR([Need GNU C compiler]) fi dnl Checks for libraries. AC_CHECK_LIB(c, malloc) dnl Checks for header files. AC_CHECK_HEADERS(getopt.h stdio.h stdlib.h memory.h) if test -z "$HAVE_stdio.h" then AC_MSG_ERROR([Need stdio.h!]) fi if test -z "$HAVE_stdlib.h" then AC_MSG_ERROR([Need stdlib.h!]) fi if test -z "$HAVE_stdlib.h" then AC_MSG_ERROR([Need memory.h!]) fi AC_CANONICAL_SYSTEM case $target_cpu in i386|i486|i586|i686) ARCH_OPTION=-march=$target_cpu ;; esac AC_SUBST(ARCH_OPTION) SIMD=no AC_ARG_ENABLE(port,[ --enable-port force use of portable C code],SIMD="port") AC_ARG_ENABLE(mmx,[ --enable-mmx force use of MMX instructions],SIMD="MMX") AC_ARG_ENABLE(sse,[ --enable-sse force use of SSE instructions],SIMD="SSE") AC_ARG_ENABLE(sse2,[ --enable sse2 force use of SSE2 instructions],SIMD="SSE2") # If not specified, find out which versions of the library (port/mmx/sse/sse2) to install as the default # by looking at the CPUID flags if test $SIMD = no; then if test $cross_compiling = yes; then AC_MSG_ERROR([Must specify --with-port, --with-mmx, --with-sse or --with-sse2 when cross-compiling]) fi AC_MSG_CHECKING([for SSE2 support...]) AC_TRY_RUN([ int main(){ int f; asm("movl \$1,%%eax;cpuid;movl %%edx,%0" : "=r"(f) : : "%eax","%ebx","%ecx"); if(f & (1 << 26)) exit(0); else exit(1); }],SIMD="SSE2"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])) fi if test $SIMD = no; then AC_MSG_CHECKING([for SSE support...]) AC_TRY_RUN([ int main(){ int f; asm("movl \$1,%%eax;cpuid;movl %%edx,%0" : "=r"(f) : : "%eax","%ebx","%ecx"); if(f & (1 << 25)) exit(0); else exit(1); }],SIMD="SSE"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])) fi if test $SIMD = no; then AC_MSG_CHECKING([for MMX support...]) AC_TRY_RUN([ int main(){ int f; asm("movl \$1,%%eax;cpuid;movl %%edx,%0" : "=r"(f) : : "%eax","%ebx","%ecx"); if(f & (1 << 23)) exit(0); else exit(1); }],SIMD="MMX"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])) fi case $SIMD in SSE2) AC_MSG_RESULT([Building SSE2 version]) AC_TRY_COMPILE(,[asm("movdqa %xmm0,%xmm0"); ],, AC_MSG_ERROR([You have a SSE2 CPU but your assembler does not support SSE2 mnemonics. Install the latest version of bintools or restart configure with the --enable-sse option])) STATIC_LIB=libviterbi_sse2.a ;; SSE) AC_MSG_RESULT([Building SSE version]) STATIC_LIB=libviterbi_sse.a ;; MMX) AC_MSG_RESULT([Building MMX version]) STATIC_LIB=libviterbi_mmx.a ;; port|no) AC_MSG_RESULT([Building portable C version]) STATIC_LIB=libviterbi_port.a ;; esac AC_SUBST(STATIC_LIB) dnl Checks for library functions. AC_CHECK_FUNCS(getopt_long) AC_OUTPUT(makefile)