File: acinclude.m4

package info (click to toggle)
libjpeg-turbo 1:1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,068 kB
  • ctags: 6,369
  • sloc: ansic: 43,407; asm: 25,683; sh: 5,436; java: 3,123; makefile: 797; xml: 24
file content (254 lines) | stat: -rw-r--r-- 6,049 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# AC_PROG_NASM
# --------------------------
# Check that NASM exists and determine flags
AC_DEFUN([AC_PROG_NASM],[

AC_ARG_VAR(NASM, [NASM command (used to build the x86/x86-64 SIMD code)])
if test "x$NASM" = "x"; then
  AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
  test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found])
fi

AC_MSG_CHECKING([for object file format of host system])
case "$host_os" in
  cygwin* | mingw* | pw32* | interix*)
    case "$host_cpu" in
      x86_64)
        objfmt='Win64-COFF'
        ;;
      *)
        objfmt='Win32-COFF'
        ;;
    esac
  ;;
  msdosdjgpp* | go32*)
    objfmt='COFF'
  ;;
  os2-emx*)			# not tested
    objfmt='MSOMF'		# obj
  ;;
  linux*coff* | linux*oldld*)
    objfmt='COFF'		# ???
  ;;
  linux*aout*)
    objfmt='a.out'
  ;;
  linux*)
    case "$host_cpu" in
      x86_64)
        objfmt='ELF64'
        ;;
      *)
        objfmt='ELF'
        ;;
    esac
  ;;
  kfreebsd* | freebsd* | netbsd* | openbsd*)
    if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
      objfmt='BSD-a.out'
    else
      case "$host_cpu" in
        x86_64 | amd64)
          objfmt='ELF64'
          ;;
        *)
          objfmt='ELF'
          ;;
      esac
    fi
  ;;
  solaris* | sunos* | sysv* | sco*)
    case "$host_cpu" in
      x86_64)
        objfmt='ELF64'
        ;;
      *)
        objfmt='ELF'
        ;;
    esac
  ;;
  darwin* | rhapsody* | nextstep* | openstep* | macos*)
    case "$host_cpu" in
      x86_64)
        objfmt='Mach-O64'
        ;;
      *)
        objfmt='Mach-O'
        ;;
    esac
  ;;
  *)
    objfmt='ELF ?'
  ;;
esac

AC_MSG_RESULT([$objfmt])
if test "$objfmt" = 'ELF ?'; then
  objfmt='ELF'
  AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
fi

AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
case "$objfmt" in
  MSOMF)      NAFLAGS='-fobj -DOBJ32';;
  Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
  Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
  COFF)       NAFLAGS='-fcoff -DCOFF';;
  a.out)      NAFLAGS='-faout -DAOUT';;
  BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
  ELF)        NAFLAGS='-felf -DELF';;
  ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
  RDF)        NAFLAGS='-frdf -DRDF';;
  Mach-O)     NAFLAGS='-fmacho -DMACHO';;
  Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
esac
AC_MSG_RESULT([$NAFLAGS])
AC_SUBST([NAFLAGS])

AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
cat > conftest.asm <<EOF
[%line __oline__ "configure"
        section .text
        global  _main,main
_main:
main:   xor     eax,eax
        ret
]EOF
try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
  AC_MSG_RESULT(yes)
else
  echo "configure: failed program was:" >&AC_FD_CC
  cat conftest.asm >&AC_FD_CC
  rm -rf conftest*
  AC_MSG_RESULT(no)
  AC_MSG_ERROR([installation or configuration problem: assembler cannot create object files.])
fi

AC_MSG_CHECKING([whether the linker accepts assembler output])
try_nasm='${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.o $LIBS 1>&AC_FD_CC'
if AC_TRY_EVAL(try_nasm) && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  AC_MSG_RESULT(yes)
else
  rm -rf conftest*
  AC_MSG_RESULT(no)
  AC_MSG_ERROR([configuration problem: maybe object file format mismatch.])
fi

])

# AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE
# --------------------------
# Test whether the assembler is suitable and supports NEON instructions
AC_DEFUN([AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE],[
  ac_good_gnu_arm_assembler=no
  ac_save_CC="$CC"
  ac_save_CFLAGS="$CFLAGS"
  CFLAGS="$CCASFLAGS -x assembler-with-cpp"
  CC="$CCAS"
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    .text
    .fpu neon
    .arch armv7a
    .object_arch armv4
    .arm
    pld [r0]
    vmovn.u16 d0, q0]])], ac_good_gnu_arm_assembler=yes)

  ac_use_gas_preprocessor=no
  if test "x$ac_good_gnu_arm_assembler" = "xno" ; then
    CC="gas-preprocessor.pl $CCAS"
    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
      .text
      .fpu neon
      .arch armv7a
      .object_arch armv4
      .arm
      pld [r0]
      vmovn.u16 d0, q0]])], ac_use_gas_preprocessor=yes)
  fi
  CFLAGS="$ac_save_CFLAGS"
  CC="$ac_save_CC"

  if test "x$ac_use_gas_preprocessor" = "xyes" ; then
    CCAS="gas-preprocessor.pl $CCAS"
    AC_SUBST([CCAS])
    ac_good_gnu_arm_assembler=yes
  fi

  if test "x$ac_good_gnu_arm_assembler" = "xyes" ; then
    $1
  else
    $2
  fi
])

# AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE
# --------------------------
# Test whether the assembler is suitable and supports MIPS instructions
AC_DEFUN([AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE],[
  have_mips_dspr2=no
  ac_save_CFLAGS="$CFLAGS"
  CFLAGS="$CCASFLAGS -mdspr2"

  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[

  int main ()
  {
    int c = 0, a = 0, b = 0;
    __asm__ __volatile__ (
        "precr.qb.ph %[c], %[a], %[b]          \n\t"
        : [c] "=r" (c)
        : [a] "r" (a), [b] "r" (b)
    );
    return c;
  }
  ]])], have_mips_dspr2=yes)
  CFLAGS=$ac_save_CFLAGS

  if test "x$have_mips_dspr2" = "xyes" ; then
    $1
  else
    $2
  fi
])

AC_DEFUN([AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE],[
  ac_good_gnu_arm_assembler=no
  ac_save_CC="$CC"
  ac_save_CFLAGS="$CFLAGS"
  CFLAGS="$CCASFLAGS -x assembler-with-cpp"
  CC="$CCAS"
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    .text
    MYVAR .req x0
    movi v0.16b, #100
    mov MYVAR, #100
    .unreq MYVAR]])], ac_good_gnu_arm_assembler=yes)

  ac_use_gas_preprocessor=no
  if test "x$ac_good_gnu_arm_assembler" = "xno" ; then
    CC="gas-preprocessor.pl $CCAS"
    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
      .text
      MYVAR .req x0
      movi v0.16b, #100
      mov MYVAR, #100
      .unreq MYVAR]])], ac_use_gas_preprocessor=yes)
  fi
  CFLAGS="$ac_save_CFLAGS"
  CC="$ac_save_CC"

  if test "x$ac_use_gas_preprocessor" = "xyes" ; then
    CCAS="gas-preprocessor.pl $CCAS"
    AC_SUBST([CCAS])
    ac_good_gnu_arm_assembler=yes
  fi

  if test "x$ac_good_gnu_arm_assembler" = "xyes" ; then
    $1
  else
    $2
  fi
])