Annotation of OpenXM_contrib/gmp/configure.in, Revision 1.1.1.3
1.1.1.2 maekawa 1: dnl Process this file with autoconf to produce a configure script.
1.1 maekawa 2:
3:
1.1.1.2 maekawa 4: dnl Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
5: dnl
6: dnl This file is part of the GNU MP Library.
7: dnl
8: dnl The GNU MP Library is free software; you can redistribute it and/or modify
9: dnl it under the terms of the GNU Lesser General Public License as published
10: dnl by the Free Software Foundation; either version 2.1 of the License, or (at
11: dnl your option) any later version.
12: dnl
13: dnl The GNU MP Library is distributed in the hope that it will be useful, but
14: dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15: dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16: dnl License for more details.
17: dnl
18: dnl You should have received a copy of the GNU Lesser General Public License
19: dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20: dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21: dnl MA 02111-1307, USA.
1.1 maekawa 22:
23:
1.1.1.3 ! maekawa 24: AC_REVISION($Revision: 1.129.2.2 $)dnl
1.1.1.2 maekawa 25: AC_PREREQ(2.14)dnl
26: AC_INIT(gmp-impl.h)
27:
28: dnl Check system.
29: AC_CANONICAL_SYSTEM
30:
31: dnl Automake
32: AM_INIT_AUTOMAKE(gmp, GMP_VERSION)
33: AM_CONFIG_HEADER(config.h:config.in)
34: AM_MAINTAINER_MODE
35:
36: dnl GMP specific
37: GMP_INIT(config.m4)
38:
39:
40: AC_ARG_ENABLE(assert,
41: AC_HELP_STRING([--enable-assert],[enable ASSERT checking [default=no]]),
42: [case "${enableval}" in
43: yes|no) ;;
44: *) AC_MSG_ERROR([bad value ${enableval} for --enable-assert, need yes or no]) ;;
45: esac],
46: [enable_assert=no])
47:
48: if test "$enable_assert" = "yes"; then
49: AC_DEFINE(WANT_ASSERT,1,
50: [./configure --enable-assert option, to enable some ASSERT()s])
51: fi
52:
53:
54: AC_ARG_ENABLE(alloca,
55: AC_HELP_STRING([--enable-alloca],[use alloca for temp space [default=yes]]),
56: [case "${enableval}" in
57: yes|no) ;;
58: *) AC_MSG_ERROR([bad value ${enableval} for --enable-alloca, need yes or no]) ;;
59: esac],
60: [enable_alloca=yes])
61:
62: if test "$enable_alloca" = "no"; then
63: AC_DEFINE(USE_STACK_ALLOC,1,
64: [./configure --disable-alloca option, to use stack-alloc.c, not alloca])
65: fi
66:
67:
68: AC_ARG_ENABLE(fft,
69: AC_HELP_STRING([--enable-fft],[enable FFTs for multiplication [default=no]]),
70: [case "${enableval}" in
71: yes|no) ;;
72: *) AC_MSG_ERROR([bad value ${enableval} for --enable-fft, need yes or no]) ;;
73: esac],
74: [enable_fft=no])
75:
76: if test "$enable_fft" = "yes"; then
77: AC_DEFINE(WANT_FFT,1,
78: [./configure --enable-fft option, to enable FFTs for multiplication])
79: fi
80:
81:
82: AC_ARG_ENABLE(mpbsd,
83: AC_HELP_STRING([--enable-mpbsd],[build Berkley MP compatibility library [default=no]]),
84: [case "${enableval}" in
85: yes|no) ;;
86: *) AC_MSG_ERROR([bad value ${enableval} for --enable-mpbsd, need yes or no]) ;;
87: esac],
88: [enable_mpbsd=no])
89: AM_CONDITIONAL(WANT_MPBSD, test "$enable_mpbsd" = "yes")
90:
91:
92: AC_ARG_ENABLE(mpfr,
93: AC_HELP_STRING([--enable-mpfr],[build MPFR [default=no]]),
94: [case "${enableval}" in
95: yes|no) ;;
96: *) AC_MSG_ERROR([bad value ${enableval} for --enable-mpfr, need yes or no]) ;;
97: esac],
98: [enable_mpfr=no])
99: AM_CONDITIONAL(WANT_MPFR, test "$enable_mpfr" = "yes")
100:
101:
102: dnl Switch on OS and determine what compiler to use.
103: dnl
104: dnl os_64bit Set to "yes" if OS is 64-bit capable.
105: dnl FIXME: Rename to `check_64bit_compiler'!
106: dnl cclist List of compilers, best first.
107: dnl gmp_cflags_{cc} Flags for compiler named {cc}.
108: dnl gmp_cflags64_{cc} Flags for compiler named {cc} for 64-bit code.
109: dnl gmp_optcflags_{cc} Optional compiler flags.
110: dnl gmp_xoptcflags_{cc} Exclusive optional compiler flags.
111: dnl
112: os_64bit="no"
113: cclist="gcc cc" # FIXME: Prefer c89 to cc.
114: gmp_cflags_gcc="-g -O2"
115: gmp_cflags64_gcc="-g -O2"
116: gmp_cflags_cc="-g"
117: gmp_cflags64_cc="-g"
118:
119: case "$target" in
120: # Alpha
121: alpha*-cray-unicos*)
122: # Don't perform any assembly syntax tests on this beast.
123: gmp_no_asm_syntax_testing=yes
124: cclist=cc
125: gmp_cflags_cc="$gmp_cflags_cc -O"
126: ;;
127: alpha*-*-osf*)
128: flavour=`echo $target_cpu | sed 's/^alpha//g'`
129: if test -n "$flavour"; then
130: case $flavour in # compilers don't seem to understand `ev67' and such.
131: ev6? | ev7*) flavour=ev6;;
132: esac
133: gmp_optcflags_gcc="-mcpu=$flavour"
134: # FIXME: We shouldn't fail fatally if none of these work, but that's
135: # how xoptcflags work and we don't have any other mechanism right now.
136: # Why do we need this here and not for alpha*-*-* below?
137: gmp_xoptcflags_gcc="-Wa,-arch,${flavour} -Wa,-m${flavour}"
138: gmp_optcflags_cc="-arch $flavour -tune $flavour"
1.1 maekawa 139: fi
140: ;;
1.1.1.2 maekawa 141: alpha*-*-*)
142: cclist="gcc"
143: flavour=`echo $target_cpu | sed 's/^alpha//g'`
144: if test -n "$flavour"; then
145: case $flavour in
146: ev6? | ev7*) flavour=ev6;;
147: esac
148: gmp_optcflags_gcc="-mcpu=$flavour"
1.1 maekawa 149: fi
150: ;;
1.1.1.2 maekawa 151: # Cray vector machines. This must come after alpha* so that we can
152: # recognize present and future vector processors with a wildcard.
153: *-cray-unicos*)
154: # Don't perform any assembly syntax tests on this beast.
155: gmp_no_asm_syntax_testing=yes
156: cclist=cc
157: # Don't inherit default gmp_cflags_cc value; it comes with -g which
158: # disables all optimization on Cray vector systems
159: gmp_cflags_cc="-O"
160: ;;
161:
162: # AMD and Intel x86 configurations
163: [i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*])
164: # Rumour has it -O2 used to give worse register allocation than just -O.
165: gmp_cflags_gcc="-g -O -fomit-frame-pointer"
166:
167: case "${target}" in
168: i386*-*-*) gmp_optcflags_gcc="-mcpu=i386 -march=i386";;
169: i486*-*-*) gmp_optcflags_gcc="-mcpu=i486 -march=i486";;
170: i586*-*-* | pentium-*-* | pentiummmx-*-*)
171: gmp_optcflags_gcc="-mcpu=pentium -march=pentium";;
172:
173: # -march=pentiumpro not used because mpz/powm.c (swox cvs rev 1.4)
174: # tickles a bug in gcc 2.95.2 (believed fixed in 2.96).
175: [i686*-*-* | pentiumpro-*-* | pentium[23]-*-*])
176: gmp_optcflags_gcc="-mcpu=pentiumpro";;
177:
178: k6*-*-*) gmp_optcflags_gcc="-mcpu=k6 -march=k6";;
179:
180: # Athlon instruction costs are close to p6: 3 cycle load latency, 4-6
181: # cycle mul, 40 cycle div, pairable adc, ...
182: # FIXME: Change this when gcc gets something specific for Athlon.
183: # -march=pentiumpro not used, per i686 above.
184: athlon-*-*) gmp_optcflags_gcc="-mcpu=pentiumpro";;
185: esac
186: ;;
187:
188: # Sparc
189: [ultrasparc*-*-solaris2.[7-9] | sparcv9-*-solaris2.[7-9]])
190: os_64bit=yes
191: gmp_cflags_gcc="$gmp_cflags_gcc -Wa,-xarch=v8plus"
192: gmp_xoptcflags_gcc="-mcpu=v9 -mcpu=v8 -mv8"
193: gmp_cflags64_gcc="$gmp_cflags64_gcc -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9"
194: gmp_cflags_cc="-xtarget=native -xarch=v8 -xO4"
195: gmp_cflags64_cc="-xtarget=native -xarch=v9 -xO4"
196: ;;
197: sparc64-*-linux*)
1.1.1.3 ! maekawa 198: # Need to think more about the options passed here. This isn't good for
! 199: # some sparc64 linux distros, since we end up not optimizing when all the
! 200: # options below fail.
1.1.1.2 maekawa 201: os_64bit=yes
202: gmp_cflags64_gcc="$gmp_cflags64_gcc -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9"
203: gmp_cflags_gcc="$gmp_cflags_gcc -m32"
204: gmp_xoptflags_gcc="-mcpu=ultrasparc -mvis"
205: ;;
206: ultrasparc*-*-* | sparcv9-*-*)
207: gmp_cflags_gcc="$gmp_cflags_gcc -Wa,-xarch=v8plus"
208: gmp_xoptcflags_gcc="-mcpu=v9 -mcpu=v8 -mv8"
209: gmp_cflags_cc="-xtarget=native -xarch=v8 -xO4"
210: ;;
211: sparcv8*-*-solaris2.* | microsparc*-*-solaris2.*)
212: gmp_cflags_gcc="$gmp_cflags_gcc"
213: gmp_xoptcflags_gcc="-mcpu=v8 -mv8"
214: gmp_cflags_cc="-xtarget=native -xarch=v8 -xO4"
215: ;;
216: sparcv8*-*-* | microsparc*-*-*) # SunOS, Linux, *BSD
217: cclist="gcc acc cc"
218: gmp_cflags_gcc="$gmp_cflags_gcc"
219: gmp_xoptcflags_gcc="-mcpu=v8 -mv8"
220: gmp_cflags_acc="-g -O2 -cg92"
221: gmp_cflags_cc="-O2" # FIXME: Flag for v8?
222: ;;
223: supersparc*-*-solaris2.*)
224: gmp_cflags_gcc="$gmp_cflags_gcc -DSUPERSPARC"
225: gmp_xoptcflags_gcc="-mcpu=v8 -mv8"
226: gmp_cflags_cc="-xtarget=native -xarch=v8 -xO4 -DSUPERSPARC"
227: ;;
228: supersparc*-*-*) # SunOS, Linux, *BSD
229: cclist="gcc acc cc"
230: gmp_cflags_gcc="$gmp_cflags_gcc -DSUPERSPARC"
231: gmp_xoptcflags_gcc="-mcpu=v8 -mv8"
232: gmp_cflags_acc="-g -O2 -cg92 -DSUPERSPARC"
233: gmp_cflags_cc="-O2 -DSUPERSPARC" # FIXME: Flag for v8?
234: ;;
235: *sparc*-*-*)
236: cclist="gcc acc cc"
237: gmp_cflags_acc="-g -O2"
238: gmp_cflags_cc="-g -O2"
239: ;;
240:
241: # POWER/PowerPC
242: powerpc64-*-aix*)
243: cclist="gcc xlc"
244: gmp_cflags_gcc="$gmp_cflags_gcc -maix64 -mpowerpc64"
245: gmp_cflags_xlc="-g -O2 -q64 -qtune=pwr3"
246: ;;
247: powerpc*-*-aix*)
248: cclist="gcc xlc"
249: gmp_cflags_gcc="$gmp_cflags_gcc -mpowerpc"
250: gmp_cflags_xlc="$gmp_cflags_cc -qarch=ppc -O2"
251: ;;
252: power-*-aix*)
253: cclist="gcc xlc"
254: gmp_cflags_gcc="$gmp_cflags_gcc -mpower"
255: gmp_cflags_xlc="$gmp_cflags_cc -qarch=pwr -O2"
256: ;;
257: powerpc64*-*-*)
258: gmp_cflags_gcc="$gmp_cflags_gcc -mpowerpc64"
259: AC_DEFINE(_LONG_LONG_LIMB) dnl FIXME: Remove.
260: ;;
261: powerpc*-*-*)
262: gmp_cflags_gcc="$gmp_cflags_gcc -mpowerpc"
263: ;;
264:
265: # MIPS
266: mips-sgi-irix6.*)
267: os_64bit=yes
268: gmp_cflags64_gcc="-g -O2 -mabi=n32"
269: gmp_cflags64_cc="$gmp_cflags64_cc -O2 -n32"
270: ;;
271:
272: # Motorola 68k family
273: m88110*-*-*)
274: gmp_cflags_gcc="-g -O -m88110" dnl FIXME: Use `-O2'?
275: ;;
276: m68*-*-*)
277: gmp_cflags_gcc="$gmp_cflags_gcc -fomit-frame-pointer"
278: ;;
279:
280: # HP
281: hppa1.0*-*-*)
282: cclist="gcc c89 cc"
283: gmp_cflags_c89="$gmp_cflags_cc +O2"
284: gmp_cflags_cc="$gmp_cflags_cc +O2"
285: ;;
286: hppa2.0w*-*-*)
287: cclist="c89 cc"
288: gmp_cflags_c89="+DD64 +O3"
289: gmp_cflags_cc="+DD64 +O3"
290: ;;
291: hppa2.0*-*-*)
292: os_64bit=yes
293: cclist="gcc c89 cc"
294: gmp_cflags64_gcc="$gmp_cflags64_gcc -mWHAT -D_LONG_LONG_LIMB"
295: # +O2 to cc triggers bug in mpz/powm.c (1.4)
296: gmp_cflags64_c89="+DA2.0 +e +O3 -D_LONG_LONG_LIMB"
297: gmp_cflags64_cc="+DA2.0 +e +O3 -D_LONG_LONG_LIMB"
298: gmp_cflags_c89="$gmp_cflags_cc +O2"
299: gmp_cflags_cc="$gmp_cflags_cc +O2"
300: ;;
301:
302: # VAX
303: vax*-*-*)
304: gmp_cflags_gcc="$gmp_cflags_gcc -fomit-frame-pointer"
305: ;;
306:
307: # Fujitsu
308: [f30[01]-fujitsu-sysv*])
309: cclist="gcc vcc"
310: gmp_cflags_vcc="-g" # FIXME: flags for vcc?
311: ;;
312: esac
313:
314: dnl Check for programs needed by macros for finding compiler.
315: dnl More programs are checked for below, when a compiler is found.
316: AC_PROG_NM dnl Macro from Libtool.
317: # nm on 64-bit AIX needs to know the object file format
318: case "$target" in
319: powerpc64*-*-aix*)
320: NM="$NM -X 64"
321: ;;
322: esac
323:
324: # Save CFLAGS given on command line.
325: gmp_user_CFLAGS="$CFLAGS"
326:
327: if test -z "$CC"; then
328: # Find compiler.
329: GMP_PROG_CC_FIND($cclist, $os_64bit)
330:
331: # If 64-bit OS and we have a 64-bit compiler, use it.
332: if test -n "$os_64bit" && test -n "$CC64"; then
333: CC=$CC64
334: CFLAGS=$CFLAGS64
335: else
336: eval CFLAGS=\$gmp_cflags_$CC
337: fi
338:
339: # Try compiler flags that may work with only some compiler versions.
340: # gmp_optcflags: All or nothing.
341: eval optcflags=\$gmp_optcflags_$CC
342: if test -n "$optcflags"; then
343: CFLAGS_save="$CFLAGS"
344: CFLAGS="$CFLAGS $optcflags"
345: AC_MSG_CHECKING([whether $CC accepts $optcflags])
346: AC_LANG_C
347: AC_TRY_COMPILER([int main(){return(0);}], optok, cross)
348: if test "$optok" = "yes"; then
349: AC_MSG_RESULT([yes])
350: else
351: AC_MSG_RESULT([no])
352: CFLAGS="$CFLAGS_save"
353: fi
354: fi
355: # gmp_xoptcflags: First is best, one has to work.
356: eval xoptcflags=\$gmp_xoptcflags_$CC
357: if test -n "$xoptcflags"; then
358: gmp_found="no"
359: for xopt in $xoptcflags; do
360: CFLAGS_save="$CFLAGS"
361: CFLAGS="$CFLAGS $xopt"
362: AC_MSG_CHECKING([whether $CC accepts $xopt])
363: AC_LANG_C
364: AC_TRY_COMPILER([int main(){return(0);}], optok, cross)
365: if test "$optok" = "yes"; then
366: AC_MSG_RESULT([yes])
367: gmp_found="yes"
368: break
369: else
370: AC_MSG_RESULT([no])
371: CFLAGS="$CFLAGS_save"
372: fi
373: done
374: if test "$gmp_found" = "no"; then
375: echo ["$0: fatal: need a compiler that understands one of $xoptcflags"]
376: exit 1
1.1 maekawa 377: fi
1.1.1.2 maekawa 378: fi
379: fi
380:
381: # Restore CFLAGS given on command line.
382: # FIXME: We've run through quite some unnecessary code looking for a
383: # nice compiler and working flags for it, just to spoil that with user
384: # supplied flags.
385: test -n "$gmp_user_CFLAGS" && CFLAGS="$gmp_user_CFLAGS"
386:
387: # Select chosen compiler.
388: GMP_PROG_CC_SELECT
389:
390: # How to assemble.
391: CCAS="$CC -c"
392: AC_SUBST(CCAS)
393:
394: dnl Checks for programs.
395: dnl --------------------
396: AC_PROG_CPP
397: AC_PROG_INSTALL
398: AC_PROG_LN_S
399: GMP_PROG_M4
400: AC_CHECK_PROG(AR, ar, ar)
401: # ar on AIX needs to know the object file format
402: case "$target" in
403: powerpc64*-*-aix*)
404: AR="$AR -X 64"
405: ;;
406: esac
407: dnl FIXME: Find good ld? /usr/ucb/ld on Solaris won't work.
408:
409: dnl Checks for assembly syntax.
410: if test "$gmp_no_asm_syntax_testing" != "yes"; then
411: GMP_CHECK_ASM_TEXT
412: GMP_CHECK_ASM_DATA
413: GMP_CHECK_ASM_GLOBL
414: GMP_CHECK_ASM_LABEL_SUFFIX
415: GMP_CHECK_ASM_TYPE
416: GMP_CHECK_ASM_SIZE
417: GMP_CHECK_ASM_LSYM_PREFIX
418: GMP_CHECK_ASM_W32
419: GMP_CHECK_ASM_UNDERSCORE(underscore=yes, underscore=no)
420: GMP_CHECK_ASM_ALIGN_LOG(asm_align=log, asm_align=nolog)
421: fi
422:
423: dnl FIXME: Check for FPU and set `floating_point' appropriately.
424:
425: dnl ========================================
426: dnl Configuring mpn.
427: dnl ----------------------------------------
428: dnl Set the following target specific variables:
429: dnl path where to search for source files
430: dnl family processor family (Needed for building
431: dnl asm-syntax.h for now. FIXME: Remove.)
432: dnl extra_functions extra functions
433:
434: family=generic
435:
436: case ${target} in
437: arm*-*-*)
438: path="arm"
439: ;;
440: [sparcv9*-*-solaris2.[789]* | sparc64*-*-solaris2.[789]* | ultrasparc*-*-solaris2.[789]*])
1.1.1.3 ! maekawa 441: if test -n "$CC64"
! 442: then path="sparc64"
! 443: else path="sparc32/v9 sparc32/v8 sparc32"
1.1.1.2 maekawa 444: fi
445: ;;
446: sparc64-*-linux*)
1.1.1.3 ! maekawa 447: if test -n "$CC64"
! 448: then path="sparc64"
! 449: else path="sparc32/v9 sparc32/v8 sparc32"
! 450: fi
1.1.1.2 maekawa 451: ;;
452: sparcv8*-*-* | microsparc*-*-*)
453: path="sparc32/v8 sparc32"
454: if test x${floating_point} = xno
455: then extra_functions="udiv_nfp"
456: else extra_functions="udiv_fp"
457: fi
458: ;;
459: sparcv9*-*-* | ultrasparc*-*-*)
460: path="sparc32/v9 sparc32/v8 sparc32"
461: extra_functions="udiv_fp"
462: ;;
463: supersparc*-*-*)
464: path="sparc32/v8/supersparc sparc32/v8 sparc32"
465: extra_functions="udiv"
466: ;;
467: sparc*-*-*) path="sparc32"
468: if test x${floating_point} = xno
469: then extra_functions="udiv_nfp"
470: else extra_functions="udiv_fp"
471: fi
472: ;;
473: hppa7000*-*-*)
474: path="hppa/hppa1_1 hppa"
475: extra_functions="udiv_qrnnd"
476: ;;
477: hppa1.0*-*-*)
478: path="hppa"
479: extra_functions="udiv_qrnnd"
480: ;;
481: hppa2.0w-*-*)
482: path="pa64w"
483: extra_functions="umul_ppmm udiv_qrnnd"
484: ;;
485: hppa2.0*-*-*)
486: if test -n "$CC64"; then
487: path="pa64"
488: extra_functions="umul_ppmm udiv_qrnnd"
489: # We need to use the system compiler, or actually the system assembler,
490: # since GAS has not been ported to understand the 2.0 instructions.
491: CCAS="$CC64 -c"
492: else
493: # FIXME: path should be "hppa/hppa2_0 hppa/hppa1_1 hppa"
494: path="hppa/hppa1_1 hppa"
495: extra_functions="udiv_qrnnd"
496: fi
497: ;;
498: hppa*-*-*) #assume pa7100
499: path="hppa/hppa1_1/pa7100 hppa/hppa1_1 hppa"
500: extra_functions="udiv_qrnnd";;
501: [f30[01]-fujitsu-sysv*])
502: path=fujitsu;;
503: alphaev6*-*-*) path="alpha/ev6 alpha"; extra_functions="invert_limb cntlz";;
504: alphaev5*-*-*) path="alpha/ev5 alpha"; extra_functions="invert_limb cntlz";;
505: alpha*-*-*) path="alpha"; extra_functions="invert_limb cntlz";;
506: # Cray vector machines. This must come after alpha* so that we can
507: # recognize present and future vector processors with a wildcard.
508: *-cray-unicos*)
509: path="cray"
510: extra_functions="mulww";;
511: am29000*-*-*) path="a29k";;
512: a29k*-*-*) path="a29k";;
513:
514: # AMD and Intel x86 configurations
515:
516: [i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*])
517: gmp_m4postinc="x86/x86-defs.m4"
518: extra_functions="udiv umul"
519: CALLING_CONVENTIONS_OBJS="x86call.o x86check.o"
520:
521: GMP_CHECK_ASM_SHLDL_CL(
522: [GMP_DEFINE(WANT_SHLDL_CL,1)],
523: [GMP_DEFINE(WANT_SHLDL_CL,0)])
524: GMP_CHECK_ASM_ALIGN_FILL_0x90
525:
526: # the CPUs below wanting to know about mmx
527: case ${target} in
528: [pentiummmx-*-* | pentium[23]-*-* | k6*-*-* | athlon-*-*])
529: GMP_CHECK_ASM_MMX(tmp_mmx=yes, tmp_mmx=no)
530: ;;
531: esac
532:
533: # default for anything not otherwise mentioned
534: path="x86"
535:
536: case ${target} in
537: [i[34]86*-*-*])
538: path="x86"
539: ;;
540: k5*-*-*)
541: # don't know what best suits k5
542: path="x86"
543: ;;
544: i586*-*-* | pentium-*-*)
545: path="x86/pentium x86"
546: ;;
547: pentiummmx-*-*)
548: path="x86/pentium x86"
549: if test "$tmp_mmx" = yes; then
550: path="x86/pentium/mmx $path"
551: fi
552: ;;
553: i686*-*-* | pentiumpro-*-*)
554: path="x86/p6 x86"
555: ;;
556: pentium2-*-*)
557: path="x86/p6 x86"
558: # The pentium/mmx lshift and rshift are good on p6 and can be used
559: # until there's something specific for p6.
560: if test "$tmp_mmx" = yes; then
561: path="x86/p6/mmx x86/pentium/mmx $path"
562: fi
563: ;;
564: pentium3-*-*)
565: path="x86/p6 x86"
566: # The pentium/mmx lshift and rshift are good on p6 and can be used
567: # until there's something specific for p6.
568: if test "$tmp_mmx" = yes; then
569: path="x86/p6/p3mmx x86/p6/mmx x86/pentium/mmx $path"
570: fi
571: ;;
572: [k6[23]*-*-*])
573: path="x86/k6 x86"
574: if test "$tmp_mmx" = yes; then
575: path="x86/k6/k62mmx x86/k6/mmx $path"
576: fi
577: ;;
578: k6*-*-*)
579: path="x86/k6 x86"
580: if test "$tmp_mmx" = yes; then
581: path="x86/k6/mmx $path"
582: fi
583: ;;
584: athlon-*-*)
585: path="x86/k7 x86"
586: if test "$tmp_mmx" = yes; then
587: path="x86/k7/mmx $path"
588: fi
589: ;;
590: esac
591: ;;
592:
593:
594: i960*-*-*) path="i960";;
595:
596: ia64*-*-*) path="ia64";;
597:
598: # Motorola 68k configurations. Let m68k mean 68020-68040.
599: [m680[234]0*-*-* | m68k*-*-* | \
600: m68*-next-nextstep*]) # Nexts are at least '020
601: path="m68k/mc68020 m68k"
602: family=m68k
603: ;;
604: m68000*-*-*)
605: path="m68k"
606: family=m68k
607: ;;
608:
609: m88k*-*-* | m88k*-*-*) path="m88k";;
610: m88110*-*-*) path="m88k/mc88110 m88k";;
611: ns32k*-*-*) path="ns32k";;
612:
613: pyramid-*-*) path="pyr";;
614:
615: ppc601-*-*) path="power powerpc32";;
616: powerpc64*-*-*) path="powerpc64";;
617: powerpc*-*-*) path="powerpc32";;
618: rs6000-*-* | power-*-* | power2-*-*)
619: path="power"
620: extra_functions="udiv_w_sdiv"
621: ;;
622:
623: sh-*-*) path="sh";;
624: sh2-*-*) path="sh/sh2 sh";;
625:
626: [mips[34]*-*-*]) path="mips3";;
627: mips*-*-irix6*) path="mips3";;
628: mips*-*-*) path="mips2";;
629:
630: vax*-*-*) path="vax"; extra_functions="udiv_w_sdiv";;
631:
632: z8000x*-*-*) path="z8000x"; extra_functions="udiv_w_sdiv";;
633: z8000*-*-*) path="z8000"; extra_functions="udiv_w_sdiv";;
634:
635: clipper*-*-*) path="clipper";;
636: esac
637:
638: AC_SUBST(CALLING_CONVENTIONS_OBJS)
639: if test -n "$CALLING_CONVENTIONS_OBJS"; then
640: AC_DEFINE(HAVE_CALLING_CONVENTIONS,1,
641: [Define if mpn/tests has calling conventions checking for the CPU])
642: fi
643:
644:
645: case ${target} in
646: [i[5-8]86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*])
647: # rdtsc is in pentium and up, not in i386 and i486
648: SPEED_CYCLECOUNTER_OBJS=pentium.lo
649: ;;
650: alpha*-*-*)
651: SPEED_CYCLECOUNTER_OBJS=alpha.lo
652: ;;
653: sparcv9*-*-* | ultrasparc*-*-* | sparc64*-*-*)
654: SPEED_CYCLECOUNTER_OBJS=sparcv9.lo
655: ;;
656: hppa2*-*-*)
657: SPEED_CYCLECOUNTER_OBJS=hppa2.lo
658: ;;
659: hppa*-*-*)
660: SPEED_CYCLECOUNTER_OBJS=hppa.lo
661: ;;
662: esac
663:
664: AC_SUBST(SPEED_CYCLECOUNTER_OBJS)
665:
666: if test -n "$SPEED_CYCLECOUNTER_OBJS"
667: then
668: AC_DEFINE(HAVE_SPEED_CYCLECOUNTER, 1,
669: [Define if a speed_cyclecounter exists (for the tune programs)])
670: fi
671:
672:
673: dnl Extensions for executable and object files.
674: dnl -------------------------------------------
675: AC_EXEEXT
676: AC_OBJEXT
677:
678: dnl Use Libtool.
679: dnl ------------
680: dnl FIXME: Shared libs seem to fail on aix4.3.
681: dnl FIXME: Should invoke [AC_DISABLE_SHARED], but m4 recurses to death.
682: case "$target" in
683: [*-*-aix4.[3-9]*]) enable_shared=no ;;
684: esac
685: AC_PROG_LIBTOOL
686:
687: dnl Checks for libraries.
688: dnl ---------------------
689: AC_CHECK_DECLS((optarg))
690:
691: dnl Checks for header files.
692: dnl ------------------------
693: AC_HEADER_STDC
694: AC_CHECK_HEADERS(getopt.h unistd.h sys/sysctl.h sys/time.h)
695:
696: dnl Checks for typedefs, structures, and compiler characteristics.
697: dnl --------------------------------------------------------------
698: AC_CHECK_TYPES((void))
699: AC_C_STRINGIZE
700:
701: dnl Checks for library functions.
702: dnl -----------------------------
703: dnl Most of these are only for the benefit of supplementary programs. The
704: dnl library itself doesn't use anything weird.
705: dnl AC_FUNC_MEMCMP
706: dnl AC_TYPE_SIGNAL
707: dnl AC_CHECK_FUNCS(strtol)
708: AC_CHECK_FUNCS(getopt_long getpagesize popen processor_info strtoul sysconf sysctlbyname)
709:
710: dnl Trick automake into thinking we've run AM_C_PROTOTYPES which it wants
711: dnl for ansi2knr, and instead use our own test. (It's only a warning
712: dnl automake prints, but it's good to suppress it.)
713: ifelse(0,1,[
714: AM_C_PROTOTYPES
715: ])
716: GMP_C_ANSI2KNR
717:
718:
719: dnl Set `syntax' to one of <blank>, "mit", "elf", "aix", "macho".
720: syntax=
721: # For now, we use the old switch for setting syntax.
722: # FIXME: Remove when conversion to .asm is completed.
723: changequote(,)dnl
724: case "${target}" in
725: m680[234]0*-*-linuxaout* | m68k*-*-linuxaout* | \
726: m68k-next-nextstep* | \
727: m68000*-*-*)
728: syntax=mit
729: ;;
730: m680[234]0*-*-linux* | m68k*-*-linux*)
731: syntax=elf
732: ;;
733: m680[234]0*-*-* | m68k*-*-*)
734: syntax=mit
1.1 maekawa 735: ;;
736: esac
1.1.1.2 maekawa 737: changequote([,])dnl
738:
739: dnl ----------------------------------------
740: # Now build an asm-syntax.h file for targets that include that from the
741: # assembly files.
742: # FIXME: Remove when conversion to .asm is completed.
743: case "${family}-${underscore}-${asm_align}-${syntax}" in
744: m68k-yes-log-mit)
745: echo '#define MIT_SYNTAX' >asm-syntax.h
746: cat $srcdir/mpn/underscore.h >>asm-syntax.h
747: echo '#include "'$srcdir'/mpn/m68k/syntax.h"' >>asm-syntax.h;;
748: m68k-no-nolog-elf)
749: echo '#define ELF_SYNTAX' >asm-syntax.h
750: echo '#define C_SYMBOL_NAME(name) name' >>asm-syntax.h
751: echo '#include "'$srcdir'/mpn/m68k/syntax.h"' >>asm-syntax.h;;
752: esac
753:
754:
755: # The pattern here tests for an absolute path the same way as
756: # _AC_OUTPUT_FILES in autoconf acgeneral.m4.
757: GMP_DEFINE_RAW(["dnl CONFIG_TOP_SRCDIR is a path from the mpn builddir to the top srcdir"])
758: case "$srcdir" in
759: [[\\/]]* | ?:[[\\/]]* )
760: GMP_DEFINE_RAW(["define(<CONFIG_TOP_SRCDIR>,<\`$srcdir'>)"]) ;;
761: *) GMP_DEFINE_RAW(["define(<CONFIG_TOP_SRCDIR>,<\`../$srcdir'>)"]) ;;
762: esac
763:
764: GMP_DEFINE_RAW(["include(CONFIG_TOP_SRCDIR\`/mpn/asm-defs.m4')"], POST)
765:
766: # Must be after asm-defs.m4
767: GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_TARGET_CPU_$target_cpu')", POST)
768:
769:
770: dnl config.m4 post-includes
771: dnl -----------------------
772: dnl (Note x86 post include set with $path above.)
773: changequote(,)dnl
774: case "$target" in
775: alpha*-cray-unicos*)
776: gmp_m4postinc="alpha/unicos.m4"
777: ;;
778: alpha*-*-*)
779: gmp_m4postinc="alpha/default.m4"
780: ;;
781: power*-*-*)
782: case "$target" in
783: *-*-mach* | *-*-rhapsody* | *-*-nextstep*)
784: ;; # these use non-conventional assembly syntax.
785: powerpc64-*-aix*)
786: gmp_m4postinc="powerpc32/regmap.m4 powerpc64/aix.m4"
787: ;;
788: *-*-aix*)
789: gmp_m4postinc="powerpc32/regmap.m4 powerpc32/aix.m4"
790: ;;
791: *)
792: gmp_m4postinc="powerpc32/regmap.m4"
793: ;;
794: esac
795: ;;
796: esac
797: changequote([, ])dnl
798:
799: for tmp_f in $gmp_m4postinc; do
800: GMP_DEFINE_RAW(["include_mpn(\`$tmp_f')"], POST)
801: done
802:
803:
804: # Set up `gmp_links'. It's a list of link:file pairs that configure will
805: # process to create link -> file.
806: gmp_links=
807:
808: # If the user specified `MPN_PATH', use that instead of the path we've
809: # come up with.
810: if test -z "$MPN_PATH"; then
811: path="$path generic"
812: else
813: path="$MPN_PATH"
814: fi
815:
816: # Pick the correct source files in $path and link them to mpn/.
817: # $gmp_mpn_functions lists all functions we need.
818: #
819: # The rule is to find a file with the function name and a .asm, .S,
820: # .s, or .c extension. Certain multi-function files with special names
821: # can provide some functions too. (mpn/Makefile.am passes
822: # -DOPERATION_<func> to get them to generate the right code.)
823:
824: # FIXME: udiv and umul aren't in $gmp_mpn_functions_optional yet since
825: # there's some versions of those files which should be checked for bit
826: # rot first. Put them in $extra_functions for each target for now,
827: # change to standard optionals when all are ready.
828:
829: # Note: The following lines defining $gmp_mpn_functions_optional
830: # and $gmp_mpn_functions are parsed by the "macos/configure"
831: # Perl script. So if you change the lines in a major way
832: # make sure to run and examine the output from
833: #
834: # % (cd macos; perl configure)
835:
836: gmp_mpn_functions_optional="copyi copyd com_n \
837: and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n"
838:
839: gmp_mpn_functions="${extra_functions} inlines add_n sub_n mul_1 addmul_1 \
840: submul_1 lshift rshift diveby3 divrem divrem_1 divrem_2 \
841: mod_1 mod_1_rs pre_mod_1 dump \
842: mul mul_fft mul_n mul_basecase sqr_basecase random \
843: random2 sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfsqr \
844: bdivmod gcd_1 gcd gcdext tdiv_qr bz_divrem_n sb_divrem_mn jacbase \
845: $gmp_mpn_functions_optional"
846:
847: # the list of all object files used by mpn/Makefile.in and the
848: # top-level Makefile.in, respectively
849: mpn_objects=
850: mpn_objs_in_libgmp="mpn/mp_bases.lo"
851:
852: for tmp_fn in ${gmp_mpn_functions} ; do
853: [rm -f mpn/${tmp_fn}.[Ssc] mpn/${tmp_fn}.asm]
854:
855: # functions that can be provided by multi-function files
856: tmp_mulfunc=
857: case $tmp_fn in
858: add_n|sub_n) tmp_mulfunc="aors_n" ;;
859: addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;;
860: popcount|hamdist) tmp_mulfunc="popham" ;;
861: and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n)
862: tmp_mulfunc="logops_n" ;;
863: esac
864:
865: found=no
866: for tmp_dir in $path; do
867: for tmp_base in $tmp_fn $tmp_mulfunc; do
868: for tmp_ext in asm S s c; do
869: tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext
870: if test -f $tmp_file; then
871: found=yes
872:
873: mpn_objects="$mpn_objects ${tmp_fn}.lo"
874: mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/${tmp_fn}.lo"
875: gmp_links="$gmp_links mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext"
876:
877: # duplicate AC_DEFINEs are harmless, so it doesn't matter
878: # that multi-function files get grepped here repeatedly
879: gmp_ep=["`
880: sed -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ;
1.1.1.3 ! maekawa 881: sed -n 's/^[ ]*PROLOGUE.*(\(.*\))/\1/p' $tmp_file
1.1.1.2 maekawa 882: `"]
883: for gmp_tmp in $gmp_ep; do
884: AC_DEFINE_UNQUOTED(HAVE_NATIVE_${gmp_tmp})
885: done
886:
887: break
888: fi
889: done
890: if test $found = yes; then break ; fi
891: done
892: if test $found = yes; then break ; fi
893: done
894:
895: if test $found = no; then
896: for tmp_optional in $gmp_mpn_functions_optional; do
897: if test $tmp_optional = $tmp_fn; then
898: found=yes
899: fi
900: done
901: if test $found = no; then
902: AC_MSG_ERROR([no version of $tmp_fn found in path: $path])
903: fi
904: fi
905: done
906:
907: # Create link for gmp-mparam.h.
908: for tmp_dir in $path ; do
909: rm -f gmp-mparam.h
910: if test -f $srcdir/mpn/${tmp_dir}/gmp-mparam.h ; then
911: gmp_links="$gmp_links gmp-mparam.h:mpn/${tmp_dir}/gmp-mparam.h"
912:
913: # Copy any KARATSUBA_SQR_THRESHOLD in gmp-mparam.h to config.m4.
914: # Some versions of sqr_basecase.asm use this.
915: tmp_gmp_karatsuba_sqr_threshold="`sed -n 's/^#define KARATSUBA_SQR_THRESHOLD[ ]*\([0-9][0-9]*\).*$/\1/p' $srcdir/mpn/${tmp_dir}/gmp-mparam.h`"
916: if test -n "$tmp_gmp_karatsuba_sqr_threshold"; then
917: GMP_DEFINE_RAW(["define(<KARATSUBA_SQR_THRESHOLD>,<$tmp_gmp_karatsuba_sqr_threshold>)"])
918: fi
919:
920: break
921: fi
922: done
923:
924: # Dig out the links from `gmp_links' for inclusion in DISTCLEANFILES.
925: gmp_srclinks=
926: for f in $gmp_links; do
927: gmp_srclinks="$gmp_srclinks `echo $f | sed 's/\(.*\):.*/\1/'`"
928: done
929:
930: AC_SUBST(mpn_objects)
931: AC_SUBST(mpn_objs_in_libgmp)
932: AC_SUBST(gmp_srclinks)
933:
934: dnl ----------------------------------------
935: dnl Make links.
936: AC_CONFIG_LINKS($gmp_links)
937:
938: dnl Create config.m4.
939: GMP_FINISH
940:
941: dnl Create Makefiles
942: dnl FIXME: Upcoming version of autoconf/automake may not like broken lines.
943: AC_OUTPUT(Makefile mpf/Makefile mpz/Makefile mpn/Makefile mpq/Makefile \
944: mpf/tests/Makefile mpz/tests/Makefile mpq/tests/Makefile mpn/tests/Makefile \
945: tests/Makefile tests/rand/Makefile demos/Makefile tune/Makefile \
946: mpbsd/Makefile mpbsd/tests/Makefile mpfr/Makefile mpfr/tests/Makefile)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>