2 # --------------------------
3 # Check that NASM exists and determine flags
4 AC_DEFUN([AC_PROG_NASM],[
6 AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7 test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found])
9 AC_MSG_CHECKING([for object file format of host system])
11 cygwin* | mingw* | pw32* | interix*)
24 os2-emx*) # not tested
27 linux*coff* | linux*oldld*)
43 kfreebsd* | freebsd* | netbsd* | openbsd*)
44 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
57 solaris* | sunos* | sysv* | sco*)
67 darwin* | rhapsody* | nextstep* | openstep* | macos*)
82 AC_MSG_RESULT([$objfmt])
83 if test "$objfmt" = 'ELF ?'; then
85 AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
88 AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
90 MSOMF) NAFLAGS='-fobj -DOBJ32';;
91 Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
92 Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
93 COFF) NAFLAGS='-fcoff -DCOFF';;
94 a.out) NAFLAGS='-faout -DAOUT';;
95 BSD-a.out) NAFLAGS='-faoutb -DAOUT';;
96 ELF) NAFLAGS='-felf -DELF';;
97 ELF64) NAFLAGS='-felf64 -DELF -D__x86_64__';;
98 RDF) NAFLAGS='-frdf -DRDF';;
99 Mach-O) NAFLAGS='-fmacho -DMACHO';;
100 Mach-O64) NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
102 AC_MSG_RESULT([$NAFLAGS])
105 AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
106 cat > conftest.asm <<EOF
107 [%line __oline__ "configure"
114 try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
115 if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
118 echo "configure: failed program was:" >&AC_FD_CC
119 cat conftest.asm >&AC_FD_CC
122 AC_MSG_ERROR([installation or configuration problem: assembler cannot create object files.])
125 AC_MSG_CHECKING([whether the linker accepts assembler output])
126 try_nasm='${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.o $LIBS 1>&AC_FD_CC'
127 if AC_TRY_EVAL(try_nasm) && test -s conftest${ac_exeext}; then
133 AC_MSG_ERROR([configuration problem: maybe object file format mismatch.])
138 # AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE
139 # --------------------------
140 # Test whether the assembler is suitable and supports NEON instructions
141 AC_DEFUN([AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE],[
142 ac_good_gnu_arm_assembler=no
144 ac_save_CFLAGS="$CFLAGS"
145 CFLAGS="$CCASFLAGS -x assembler-with-cpp"
147 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
154 vmovn.u16 d0, q0]])], ac_good_gnu_arm_assembler=yes)
156 ac_use_gas_preprocessor=no
157 if test "x$ac_good_gnu_arm_assembler" = "xno" ; then
158 CC="gas-preprocessor.pl $CCAS"
159 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
166 vmovn.u16 d0, q0]])], ac_use_gas_preprocessor=yes)
168 CFLAGS="$ac_save_CFLAGS"
171 if test "x$ac_use_gas_preprocessor" = "xyes" ; then
172 CCAS="gas-preprocessor.pl $CCAS"
174 ac_good_gnu_arm_assembler=yes
177 if test "x$ac_good_gnu_arm_assembler" = "xyes" ; then
184 # AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE
185 # --------------------------
186 # Test whether the assembler is suitable and supports MIPS instructions
187 AC_DEFUN([AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE],[
189 ac_save_CFLAGS="$CFLAGS"
190 CFLAGS="$CCASFLAGS -mdspr2"
192 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
196 int c = 0, a = 0, b = 0;
197 __asm__ __volatile__ (
198 "precr.qb.ph %[c], %[a], %[b] \n\t"
200 : [a] "r" (a), [b] "r" (b)
204 ]])], have_mips_dspr2=yes)
205 CFLAGS=$ac_save_CFLAGS
207 if test "x$have_mips_dspr2" = "xyes" ; then