Build Fix -- compatibility issue with newer autoconf
[sxemacs] / m4 / sxe-arch.m4
1 dnl sxe-arch.m4 -- Architecture specific stuff
2
3 AC_DEFUN([SXE_CHECK_MACHARCH], [dnl
4 dnl ------------------------------
5 dnl Determine the s&m files to use
6 dnl ------------------------------
7 dnl Given the configuration name, set machfile and opsysfile to the
8 dnl names of the m/*.h and s/*.h files we should use.
9
10 dnl If you add support for a new configuration, add code to this
11 dnl switch statement to recognize your configuration name and select
12 dnl the appropriate operating system and machine description files.
13
14 dnl You would hope that you could choose an m/*.h file pretty much
15 dnl based on the machine portion of the configuration name, and an s-
16 dnl file based on the operating system portion.  However, it turns out
17 dnl that each m/*.h file is pretty manufacturer-specific - for
18 dnl example, apollo.h, hp9000s300.h, mega68k, news.h, and tad68k are
19 dnl all 68000 machines; mips.h, pmax.h, and news-risc are all MIPS
20 dnl machines.  So we basically have to have a special case for each
21 dnl configuration name.
22
23 dnl As far as handling version numbers on operating systems is
24 dnl concerned, make sure things will fail in a fixable way.  If
25 dnl /etc/MACHINES says nothing about version numbers, be
26 dnl prepared to handle anything reasonably.  If version numbers
27 dnl matter, be sure /etc/MACHINES says something about it.
28
29 dnl Eric Raymond says we should accept strings like "sysvr4" to mean
30 dnl "System V Release 4"; he writes, "The old convention encouraged"
31 dnl "confusion between `system' and `release' levels'."
32
33 machine='' opsys=''
34 LDD="ldd"
35
36 dnl Straightforward machine determination
37 case "$ac_cv_build" in
38         sparc-*-*        ) machine=sparc ;;
39         alpha*-*-*       ) machine=alpha ;;
40         vax-*-*          ) machine=vax ;;
41         mips-dec-*       ) machine=pmax ;;
42         mips-sgi-irix6*  ) machine=iris6d ;;
43         mips-sgi-*       ) machine=iris4d ;;
44         mips*-linux      ) machine=mips ;;
45         romp-ibm-*       ) machine=ibmrt ;;
46         rs6000-ibm-aix*  ) machine=ibmrs6000 ;;
47         powerpc-ibm-aix* ) machine=ibmrs6000 ;;
48         powerpc*-*       ) machine=powerpc ;;
49         macppc*-*        ) machine=powerpc ;;
50         hppa-*-*         ) machine=hp800 ;;
51         m88k-dg-*        ) machine=aviion ;;
52         m68*-sony-*      ) machine=news ;;
53         mips-sony-*      ) machine=news-risc ;;
54         clipper-*        ) machine=clipper ;;
55         arm*             ) machine=arm ;;
56         ns32k-*          ) machine=ns32000 ;;
57 esac
58
59 dnl Straightforward OS determination
60 case "$ac_cv_build" in
61         *-*-linux*    ) opsys=linux ;;
62         *-*-netbsd*   ) opsys=netbsd ;;
63         *-*-openbsd*    ) opsys=openbsd ;;
64         *-*-freebsd*    ) opsys=freebsd ;;
65         *-*-nextstep* ) opsys=nextstep ;;
66         *-*-vms       ) opsys=vms ;;
67
68         dnl DEC OSF
69         *-dec-osf1.3 | *-dec-osf2* ) opsys=decosf1-3 ;;
70         *-dec-osf1.2 | *-dec-osf1* ) opsys=decosf1-2 ;;
71         *-dec-osf3.[[2-9]]         ) opsys=decosf3-2 ;;
72         *-dec-osf3*                ) opsys=decosf3-1 ;;
73         *-dec-osf[[4-9]]*          ) opsys=decosf4-0 ;;
74
75         dnl DEC Ultrix
76         *-*-ultrix[[0-3]].* | *-*-ultrix4.0* ) opsys=bsd4-2 ;;
77         *-*-ultrix4.[[12]]* ) opsys=bsd4-3 ;;
78
79         dnl AIX
80         *-*-aix3.1*     ) opsys=aix3-1   ;;
81         *-*-aix3.2.5    ) opsys=aix3-2-5 ;;
82         *-*-aix3*       ) opsys=aix3-2   ;;
83         *-*-aix4.0*     ) opsys=aix4       ;;
84         *-*-aix4.1*     ) opsys=aix4-1   ;;
85         *-*-aix[[4-9]]* ) opsys=aix4-2   ;;
86
87         dnl Other generic OSes
88         *-gnu* )                        opsys=gnu    ;;
89         *-*-bsd4.[[01]] )               opsys=bsd4-1 ;;
90         *-*-bsd4.2 )                    opsys=bsd4-2 ;;
91         *-*-bsd4.3 )                    opsys=bsd4-3 ;;
92         *-*-aos4.2 )                    opsys=bsd4-2 ;;
93         *-*-aos*   )                    opsys=bsd4-3 ;;
94         *-*-sysv0    | *-*-sysvr0 )     opsys=usg5-0 ;;
95         *-*-sysv2    | *-*-sysvr2 )     opsys=usg5-2 ;;
96         *-*-sysv2.2  | *-*-sysvr2.2 )   opsys=usg5-2-2 ;;
97         *-*-sysv3*   | *-*-sysvr3* )    opsys=usg5-3 ;;
98         *-*-sysv4.1* | *-*-sysvr4.1* )opsys=usg5-4 NON_GNU_CPP=/usr/lib/cpp ;;
99         *-*-sysv4.[[2-9]]* | *-sysvr4.[[2-9]]* )
100                 if test -z "$NON_GNU_CPP" ; then
101                         for prog in "/usr/ccs/lib/cpp" "/lib/cpp"; do
102                                 if test -f "$prog"; then
103                                         NON_GNU_CPP="$prog"
104                                         break
105                                 fi
106                         done
107                 fi
108                 opsys=usg5-4-2 ;;
109         *-sysv4* | *-sysvr4* )  opsys=usg5-4 ;;
110         *-*-mach_bsd4.3* )          opsys=mach-bsd4-3 ;;
111 esac
112
113 case "$ac_cv_build" in
114
115   dnl NetBSD ports
116   *-*-netbsd* )
117     case "ac_cv_build" in
118       i[[3-9]]86-*-netbsd* ) machine=intel386 ;;
119       hp300-*-netbsd* | amiga-*-netbsd* | sun3-*-netbsd* | mac68k-*-netbsd* | da30-*-netbsd* | m68k-*-netbsd* )
120                       dnl Yes, this is somewhat bogus.
121                       machine=hp9000s300 ;;
122       pc532-*-netbsd* | ns32k-*-netbsd* )  machine=ns32000 ;;
123       pmax-*-netbsd*  | mips-*-netbsd*  )  machine=pmax ;;
124       macppc-*-netbsd* | powerpc-*-netbsd* ) machine=powerpc ;;
125     esac
126   ;;
127
128   dnl OpenBSD ports
129   *-*-openbsd* )
130     case "${ac_cv_build}" in
131       i386-*-openbsd*)          machine=intel386 ;;
132       m68k-*-openbsd*)          machine=hp9000s300 ;;
133       mipsel-*-openbsd*)        machine=pmax ;;
134       macppc-*-openbsd* | powerpc-*-openbsd* )  machine=powerpc ;;
135      esac
136    ;;
137
138   dnl FreeBSD ports
139   *-*-freebsd* )
140     case "${ac_cv_build}" in
141       i386-*-freebsd* )  machine=intel386 ;;
142       powerpc-*-freebsd* ) machine=powerpc ;;
143     esac
144   ;;
145
146
147   dnl Darwin, a.k.a. MacOS X (based on Mach and Freebsd)
148   *-*-darwin*)
149     opsys=darwin
150     LDD="otool -XL"
151     ;;
152
153   dnl HP 9000 series 200 or 300
154   m68*-hp-bsd* ) machine=hp9000s300 opsys=bsd4-3 ;;
155
156   dnl HP-UX
157   *-hp-hpux* )
158     dnl Figure out machine and opsys orthogonally
159     case "$ac_cv_build" in
160       m68*  ) machine=hp9000s300 ;;
161       hppa* ) machine=hp800      ;;
162     esac
163
164     case "$ac_cv_build" in
165       *-hp-hpux7*  )  opsys=hpux   ;;
166       *-hp-hpux8*  )  opsys=hpux8  ;;
167       *-hp-hpux9*  )  opsys=hpux9  ;;
168       *-hp-hpux10* )  opsys=hpux10 ;;
169       *-hp-hpux11* )  opsys=hpux11 ;;
170       *            )  opsys=hpux   ;;
171     esac
172
173         dnl HP has a broken "strcat"
174         case "$opsys" in
175         hpux9 | hpux10 )
176                 SXE_ADD_CRUFT_OBJS([strcat.o])
177                 ;;
178         esac
179
180     if test "$opsys" = "hpux10" -o "$opsys" = "hpux11"; then \
181         ansi_flag="-Ae"; else ansi_flag="-Aa"; fi
182     NON_GNU_CC="cc $ansi_flag" NON_GNU_CPP="cc $ansi_flag -E"
183
184     case "$ac_cv_build" in *-hp-hpux*shr* ) opsys="${opsys}-shr" ;; esac
185   ;;
186
187   dnl Prime EXL
188   i[[3-9]]86-prime-sysv* ) machine=i386 opsys=usg5-3 ;;
189
190   dnl Intel 860
191   i860-*-sysv4* ) machine=i860 opsys=usg5-4 NON_GNU_CC="/bin/cc" NON_GNU_CPP="/usr/ccs/lib/cpp" ;;
192
193   dnl NeXT
194   m68*-next-* | m68k-*-nextstep* ) machine=m68k opsys=nextstep ;;
195
196   dnl Silicon Graphics machines
197   dnl Iris 2500 and Iris 2500 Turbo (aka the Iris 3030)
198   m68*-sgi-iris3.5* ) machine=irist opsys=iris3-5 ;;
199   m68*-sgi-iris3.6* | m68*-sgi-iris*) machine=irist opsys=iris3-6 ;;
200   dnl Iris 4D
201   mips-sgi-irix3.*    ) opsys=irix3-3 ;;
202   mips-sgi-irix4.*    ) opsys=irix4-0 ;;
203   mips-sgi-irix6*     ) opsys=irix6-0 ;;
204   mips-sgi-irix5.1*   ) opsys=irix5-1 ;;
205   mips-sgi-irix5.2*   ) opsys=irix5-2 ;;
206   mips-sgi-irix5.*    ) opsys=irix5-3 ;;
207   mips-sgi-irix*      ) opsys=irix5-0 ;;
208
209   dnl SONY machines
210   *-sony-newsos[[34]]* | *-sony-news[[34]]* ) opsys=bsd4-3 ;;
211   *-sony-news* ) opsys=newsos5 ;;
212
213   dnl Suns
214   *-*-solaris* | *-*-sunos* | *-sun-mach* | *-sun-bsd* )
215     dnl Hardware type
216     case "$ac_cv_build" in
217       m68*-sunos1* )             machine=sun1     ;;
218       m68*-sunos2* )             machine=sun2     ;;
219       m68* )                     machine=sun3     ;;
220       i*86*-sun-sunos[[34]]* )   machine=sun386   ;;
221       i*86-*-* )                 machine=intel386 ;;
222       rs6000* )                  machine=rs6000   ;;
223     esac
224
225     dnl Make $canonical even more so.
226     case "$ac_cv_build" in *-sunos5*)
227       ac_cv_build=`echo $ac_cv_build | sed -e s/sunos5/solaris2/`;;
228     esac
229
230     case "$ac_cv_build" in
231       *-solaris* )
232         opsys=sol2
233         os_release_major=`uname -r | sed -e 's/^\([[0-9]]\{1,\}\)\.\([[0-9]]\{1,\}\).*/\1/'`
234         os_release_minor=`uname -r | sed -e 's/^\([[0-9]]\{1,\}\)\.\([[0-9]]\{1,\}\).*/\2/'`
235         case "$os_release_minor" in [[0-9]])
236           os_release_minor="0${os_release_minor}";;
237         esac
238         os_release="${os_release_major}${os_release_minor}"
239         AC_DEFINE_UNQUOTED([OS_RELEASE], [$os_release], [Description here!]) ;;
240
241       dnl The last Sun386 ran 4.0.
242       i*86-*-sunos4*      ) opsys=sunos4-0      ;;
243       *-sunos4.0*         ) opsys=sunos4-0      ;;
244       *-sunos4.1.2*       ) opsys=sunos4-1-2    ;;
245       *-sunos4.1.3*       ) opsys=sunos4-1-3    ;;
246       *-sunos4.1.[[4-9]]* ) opsys=sunos4-1-4    ;;
247       *-sunos4* | *-sunos ) opsys=sunos4-1      ;;
248       *-mach*             ) opsys=mach-bsd4-3   ;;
249       *                   ) opsys=bsd4-2        ;;
250     esac
251
252     case "$ac_cv_build" in *-sunos4*shr* ) opsys="${opsys}-shr" ;; esac
253   ;;
254
255   dnl Vaxen.
256   vax-dec-* )
257     case "$ac_cv_build" in
258       *-sysv[[01]]* | *-sysvr[[01]]* )  opsys=usg5-0 ;;
259       *-sysv2* | *-sysvr2* )            opsys=usg5-2 ;;
260       *-mach* )                         opsys=mach-bsd4-3 ;;
261     esac
262   ;;
263
264   dnl Intel 386 machines where we do not care about the manufacturer
265   i[[3-9]]86-*-* )
266     machine=intel386
267     case "$ac_cv_build" in
268       *-isc1.* | *-isc2.[[01]]* ) opsys=386-ix ;;
269       *-isc2.2* )               opsys=isc2-2 ;;
270       *-isc4.0* )               opsys=isc4-0 ;;
271       *-isc4.* )                opsys=isc4-1
272                                 GCC_TEST_OPTIONS=-posix
273                                 NON_GCC_TEST_OPTIONS=-Xp
274                                 ;;
275       *-isc* )                  opsys=isc3-0 ;;
276       *-esix5* )                opsys=esix5r4 NON_GNU_CPP=/usr/lib/cpp ;;
277       *-esix* )                 opsys=esix ;;
278       *-mach* )                 opsys=mach-bsd4-3 ;;
279       *-sco3.2v4* )             opsys=sco4 NON_GNU_CPP=/lib/cpp  ;;
280       *-bsd386* | *-bsdi1* )    opsys=bsd386 ;;
281       *-bsdi4* )                opsys=bsdos4 ;;
282       *-bsdi3* )                opsys=bsdos3 ;;
283       *-bsdi2.1* )              opsys=bsdos2-1 ;;
284       *-bsdi2* )                opsys=bsdos2 ;;
285       *-sco3.2v5* )             opsys=sco5 ;;
286       *-sysv5* )                opsys=sco7 ;;
287       *-386bsd* )               opsys=386bsd ;;
288       *-freebsd* )              opsys=freebsd ;;
289       *-nextstep* )             opsys=nextstep ;;
290     esac
291   ;;
292
293   dnl Linux/68k
294   m68k-*-linux* ) machine=m68k opsys=linux ;;
295
296 esac
297
298 dnl Initialize machine from $canonical if not in our database above.
299 test -z "$machine" && machine=`echo $ac_cv_build | sed 's/-.*$//'`
300
301 dnl Initialize opsys from `uname -s` if not in our database above.
302 test -z "$opsys"   && opsys=`uname -s | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
303
304 dnl Use configure-time autodetection if s&m not available
305 if test -r "${sxe_srcdir}/src/m/${machine}.h"; then
306         machfile="m/${machine}.h"
307         AC_DEFINE_UNQUOTED([config_machfile], ["$machfile"], [Description here!])
308 else
309         echo "SXEmacs has no builtin knowledge of \`$machine' machines."
310         echo "Using configure-time autodetection only."
311 fi
312
313 if test -r "${sxe_srcdir}/src/s/${opsys}.h"; then
314         opsysfile="s/${opsys}.h"
315         AC_DEFINE_UNQUOTED([config_opsysfile], ["$opsysfile"], [Description here!])
316 else
317         echo "SXEmacs has no builtin knowledge of \`$opsys' operating systems."
318         echo "Using configure-time autodetection only."
319 fi
320 ])dnl SXE_CHECK_MACHARCH
321
322
323 dnl CPP_to_sh(CPP_SYMBOL, SH_VAR, DEFAULT_VALUE)
324 define([CPP_to_sh],
325 [[#]ifndef [$1]
326 [#]define [$1]ifelse([$3],,, [ "$3"])
327 [#]endif
328 configure___ [$2]=[$1]
329 ])dnl CPP_to_sh
330
331 dnl CPP_boolean_to_sh(CPP_SYMBOL, SH_VAR)
332 define([CPP_boolean_to_sh],
333 [[#]ifdef [$1]
334 configure___ [$2]=yes
335 [#]else
336 configure___ [$2]=no
337 [#]endif
338 ])dnl CPP_boolean_to_sh
339
340 AC_DEFUN([SXE_EXTRACT_MACHARCH_INFO], [dnl
341 dnl It is not important that this name contain the PID; you cannot run
342 dnl two configures in the same directory and have anything work
343 dnl anyway.
344 tempcname="conftest.c"
345
346 cat > $tempcname < confdefs.h
347 cat >> $tempcname <<EOF
348 #define NOT_C_CODE
349 #define C_SWITCH_SITE
350 #define C_SWITCH_X_SITE
351 #define LD_SWITCH_SITE
352 #define LD_SWITCH_X_SITE
353 #define LD_SWITCH_X_SITE_AUX
354 #define OS_RELEASE $os_release
355
356 #ifdef config_opsysfile
357 #include "$sxe_srcdir/src/$opsysfile"
358 #endif
359
360 #ifdef config_machfile
361 #include "$sxe_srcdir/src/$machfile"
362 #endif
363
364 CPP_to_sh([LIBS_MACHINE], libs_machine)
365 CPP_to_sh([LIBS_SYSTEM],  libs_system)
366 CPP_to_sh([LIBS_TERMCAP], libs_termcap)
367 CPP_to_sh([LIB_STANDARD], libs_standard)
368
369 CPP_to_sh(OBJECTS_MACHINE, objects_machine)
370 CPP_to_sh(OBJECTS_SYSTEM,  objects_system)
371
372 CPP_to_sh(C_SWITCH_MACHINE,   c_switch_machine)
373 CPP_to_sh(C_SWITCH_SYSTEM,    c_switch_system)
374
375 CPP_to_sh(LD_SWITCH_MACHINE,  ld_switch_machine)
376 CPP_to_sh(LD_SWITCH_SYSTEM,   ld_switch_system)
377
378 CPP_to_sh(UNEXEC, unexec)
379
380 CPP_to_sh(SYSTEM_TYPE, system_type)
381
382 CPP_to_sh(LD_SWITCH_SHARED, ld_switch_shared, -c)
383
384 #define ORDINARY_LD "\$(CC) \$(CFLAGS)"
385 configure___ ordinary_ld=ORDINARY_LD
386
387 #ifdef ORDINARY_LINK
388 #define LD ORDINARY_LD
389 #else /* no ORDINARY LINK */
390 #ifdef COFF_ENCAPSULATE
391 #define LD "\$(CC) -nostdlib"
392 #else /* not COFF_ENCAPSULATE */
393 #ifdef LINKER
394 #define LD LINKER
395 #else /* ! defined (LINKER) */
396 #define LD "ld"
397 #endif /* ! defined (LINKER) */
398 #endif /* ! defined (COFF_ENCAPSULATE) */
399 #endif /* not ORDINARY_LINK */
400 configure___ ld=LD
401
402 CPP_to_sh(LIB_GCC, lib_gcc)
403 CPP_to_sh(LD_TEXT_START_ADDR, ld_text_start_addr)
404
405 #if ! defined (ORDINARY_LINK) && !defined (START_FILES)
406 #ifdef NO_REMAP
407 #ifdef COFF_ENCAPSULATE
408 #define START_FILES "pre-crt0.o /usr/local/lib/gcc-crt0.o"
409 #else /* ! defined (COFF_ENCAPSULATE) */
410 #define START_FILES "pre-crt0.o /lib/crt0.o"
411 #endif /* ! defined (COFF_ENCAPSULATE) */
412 #else /* ! defined (NO_REMAP) */
413 #define START_FILES "ecrt0.o"
414 #endif /* ! defined (NO_REMAP) */
415 #endif /* no ORDINARY_LINK */
416 #ifndef START_FILES
417 #define START_FILES
418 #endif
419 configure___ start_files=START_FILES
420
421 CPP_boolean_to_sh(ORDINARY_LINK, ordinary_link)
422 CPP_boolean_to_sh(SYSTEM_MALLOC, system_malloc)
423 CPP_boolean_to_sh(TERMINFO, have_terminfo)
424 dnl The MAIL_USE_xxx variables come from the s&m headers
425 CPP_boolean_to_sh(MAIL_USE_FLOCK, mail_use_flock)
426 CPP_boolean_to_sh(MAIL_USE_LOCKF, mail_use_lockf)
427 CPP_boolean_to_sh(MAIL_USE_LOCKING, mail_use_locking)
428 EOF
429
430 dnl The value of CPP is a quoted variable reference, so we need to do this
431 dnl to get its actual value...
432 CPP=$(eval "echo $CPP $CPPFLAGS")
433 define(TAB, [   ])dnl
434 eval $($CPP -Isrc $tempcname \
435         | sed -n -e "s/[[ TAB]]*=[[ TAB\"]]*/='/" -e "s/[[ TAB\"]]*\$/'/" -e "s/^configure___//p")
436
437 rm $tempcname
438
439 ])dnl SXE_EXTRACT_MACHARCH_INFO
440
441
442 AC_DEFUN([SXE_CHECK_ASM_HELPERS], [dnl
443         AC_REQUIRE([SXE_CHECK_ASM_EAX])
444         AC_REQUIRE([SXE_CHECK_ASM_CL])
445         AC_REQUIRE([SXE_CHECK_ASM_CH])
446         AC_REQUIRE([SXE_CHECK_ASM_MASSIVE_REGS])
447         AC_REQUIRE([SXE_CHECK_ASM_RETVAL_IN_EBX])
448         AC_REQUIRE([SXE_CHECK_ASM_ADCB])
449         AC_REQUIRE([SXE_CHECK_ASM_SALL])
450         AC_REQUIRE([SXE_CHECK_ASM_SARL])
451 ])dnl SXE_CHECK_ASM_HELPERS
452
453 AC_DEFUN([SXE_CHECK_ASM_EAX], [dnl
454         ## defines HAVE_ASM_EAX
455
456         AC_CACHE_CHECK([for %%eax register in inline assembly],
457                 [sxe_cv_asm_eax], [_SXE_CHECK_ASM_EAX])
458
459         if test "$sxe_cv_asm_eax" = "yes"; then
460                 AC_DEFINE([HAVE_ASM_EAX], [1],
461                         [Whether the EAX register can be used directly.])
462         fi
463 ])dnl SXE_CHECK_ASM_EAX
464
465 AC_DEFUN([SXE_CHECK_ASM_CL], [dnl
466         ## defines HAVE_ASM_CL
467
468         AC_CACHE_CHECK([for %%cl register in inline assembly],
469                 [sxe_cv_asm_cl], [_SXE_CHECK_ASM_CL])
470
471         if test "$sxe_cv_asm_cl" = "yes"; then
472                 AC_DEFINE([HAVE_ASM_CL], [1],
473                         [Whether the CL register can be used directly.])
474         fi
475 ])dnl SXE_CHECK_ASM_CL
476
477 AC_DEFUN([SXE_CHECK_ASM_CH], [dnl
478         ## defines HAVE_ASM_CH
479
480         AC_CACHE_CHECK([for %%ch register in inline assembly],
481                 [sxe_cv_asm_ch], [_SXE_CHECK_ASM_CH])
482
483         if test "$sxe_cv_asm_ch" = "yes"; then
484                 AC_DEFINE([HAVE_ASM_CH], [1],
485                         [Whether the CH register can be used directly.])
486         fi
487 ])dnl SXE_CHECK_ASM_CH
488
489 AC_DEFUN([SXE_CHECK_ASM_MASSIVE_REGS], [dnl
490         ## defines HAVE_ASM_CH
491
492         AC_CACHE_CHECK([for register loading],
493                 [sxe_cv_asm_massive_regs], [_SXE_CHECK_ASM_MASSIVE_REGS])
494
495         if test "$sxe_cv_asm_massive_regs" = "yes"; then
496                 AC_DEFINE([HAVE_ASM_MASSIVE_REGS], [1],
497                         [Whether all registers can be loaded.])
498         fi
499 ])dnl SXE_CHECK_ASM_MASSIVE_REGS
500
501 AC_DEFUN([SXE_CHECK_ASM_RETVAL_IN_EBX], [dnl
502         ## defines HAVE_ASM_CH
503
504         AC_CACHE_CHECK([whether return values can be in EBX],
505                 [sxe_cv_asm_retval_in_ebx], [_SXE_CHECK_ASM_RETVAL_IN_EBX])
506
507         if test "$sxe_cv_asm_retval_in_ebx" = "yes"; then
508                 AC_DEFINE([HAVE_ASM_RETVAL_IN_EBX], [1],
509                         [Whether return values can be in EBX.])
510         fi
511 ])dnl SXE_CHECK_ASM_RETVAL_IN_EBX
512
513 AC_DEFUN([SXE_CHECK_ASM_ADCB], [dnl
514         ## defines HAVE_ASM_ADCB
515
516         AC_CACHE_CHECK([for ADCB assembly mnemonic],
517                 [sxe_cv_asm_adcb], [_SXE_CHECK_ASM_ADCB])
518
519         if test "$sxe_cv_asm_adcb" = "yes"; then
520                 AC_DEFINE([HAVE_ASM_ADCB], [1],
521                         [Whether the ADCB mnemonic is available.])
522         fi
523 ])dnl SXE_CHECK_ASM_ADCB
524
525 AC_DEFUN([SXE_CHECK_ASM_SALL], [dnl
526         ## defines HAVE_ASM_SALL
527
528         AC_CACHE_CHECK([for SALL assembly mnemonic],
529                 [sxe_cv_asm_sall], [_SXE_CHECK_ASM_SALL])
530
531         if test "$sxe_cv_asm_sall" = "yes"; then
532                 AC_DEFINE([HAVE_ASM_SALL], [1],
533                         [Whether the SALL mnemonic is available.])
534         fi
535 ])dnl SXE_CHECK_ASM_SALL
536
537 AC_DEFUN([SXE_CHECK_ASM_SARL], [dnl
538         ## defines HAVE_ASM_SARL
539
540         AC_CACHE_CHECK([for SARL assembly mnemonic],
541                 [sxe_cv_asm_sarl], [_SXE_CHECK_ASM_SARL])
542
543         if test "$sxe_cv_asm_sarl" = "yes"; then
544                 AC_DEFINE([HAVE_ASM_SARL], [1],
545                         [Whether the SARL mnemonic is available.])
546         fi
547 ])dnl SXE_CHECK_ASM_SARL
548
549 AC_DEFUN([_SXE_CHECK_ASM_EAX], [dnl
550         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
551
552         __asm__ (
553                 "       movl $[1], %%eax\n"
554                 : : : "%eax"
555                 );
556         return 0;
557                 ]])], [sxe_cv_asm_eax="yes"], [sxe_cv_asm_eax="no"])
558 ])dnl _SXE_CHECK_ASM_EAX
559
560 AC_DEFUN([_SXE_CHECK_ASM_CL], [dnl
561         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
562
563         __asm__ (
564                 "       movb $[1], %%cl\n"
565                 : : : "%cl"
566                 );
567         return 0;
568                 ]])], [sxe_cv_asm_cl="yes"], [sxe_cv_asm_cl="no"])
569 ])dnl _SXE_CHECK_ASM_CL
570
571 AC_DEFUN([_SXE_CHECK_ASM_CH], [dnl
572         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
573
574         __asm__ (
575                 "       movb $[1], %%ch\n"
576                 : : : "%ch"
577                 );
578         return 0;
579                 ]])], [sxe_cv_asm_ch="yes"], [sxe_cv_asm_ch="no"])
580 ])dnl _SXE_CHECK_ASM_CH
581
582 AC_DEFUN([_SXE_CHECK_ASM_MASSIVE_REGS], [dnl
583         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
584         register long int ax = 12, bx = 13, dx = 15;
585         register int cl = 14;
586         __asm__ (
587                 "       subl %[ax], %[bx]\n"
588                 "       subl %[bx], %[cl]\n"
589                 "       subl %[dx], %[cl]\n"
590                 : [ax] "=a" (ax)
591                 : [bx] "b" (bx), [cl] "c" (cl), [dx] "d" (dx)
592                 : "cc"
593                 );
594         return 0;
595                 ]])], [sxe_cv_asm_massive_regs="yes"],
596                 [sxe_cv_asm_massive_regs="no"])
597 ])dnl
598
599 AC_DEFUN([_SXE_CHECK_ASM_RETVAL_IN_EBX], [dnl
600         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
601         register char cnt;
602
603         __asm__ volatile (
604                 "       movl $[1], %%ebx\n"
605                 : "=b" (cnt)
606                 :
607                 : "cc");
608         return 0;
609                 ]])], [sxe_cv_asm_retval_in_ebx="yes"],
610                 [sxe_cv_asm_retval_in_ebx="no"])
611 ])dnl
612
613 AC_DEFUN([_SXE_CHECK_ASM_ADCB], [dnl
614         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
615         register char cnt;
616
617         __asm__ (
618                 "       adcb $[1], %[cnt]       /* add 1 if carry was set*/\n"
619                 : [cnt] "=r" (cnt)
620                 :
621                 : "cc");
622         return 0;
623                 ]])], [sxe_cv_asm_adcb="yes"], [sxe_cv_asm_adcb="no"])
624 ])dnl _SXE_CHECK_ASM_ADCB
625
626 AC_DEFUN([_SXE_CHECK_ASM_SALL], [dnl
627         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
628         register long int r = 1;
629
630         __asm__ (
631                 "       sall $[1], %[reg]\n"
632                 : [reg] "=r" (r)
633                 :
634                 : "cc");
635         return 0;
636                 ]])], [sxe_cv_asm_sall="yes"], [sxe_cv_asm_sall="no"])
637 ])dnl _SXE_CHECK_ASM_SALL
638
639 AC_DEFUN([_SXE_CHECK_ASM_SARL], [dnl
640         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
641         register long int r = 1;
642
643         __asm__ (
644                 "       sarl $[1], %[reg]\n"
645                 : [reg] "=r" (r)
646                 :
647                 : "cc");
648         return 0;
649                 ]])], [sxe_cv_asm_sarl="yes"], [sxe_cv_asm_sarl="no"])
650 ])dnl _SXE_CHECK_ASM_SARL
651
652 dnl sxe-arch.m4 ends here