Annotation of OpenXM_contrib/pari-2.2/Configure, Revision 1.4
1.1 noro 1: #! /bin/sh
2: #
3: # This file is part of the PARI/GP package.
4: #
5: # PARI/GP is free software; you can redistribute it and/or modify it under the
6: # terms of the GNU General Public License as published by the Free Software
7: # Foundation. It is distributed in the hope that it will be useful, but WITHOUT
8: # ANY WARRANTY WHATSOEVER.
9: #
10: # Check the License for details. You should have received a copy of it, along
11: # with the package; see the file 'COPYING'. If not, write to the Free Software
12: # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
13:
14: # Configuration file for GP/PARI. (K.B & Ptitboul).
15: #
16: # Run Configure -help for Usage.
17: #
18: # The Configure included in Perl distribution (written by Larry Wall), as
19: # well as GNU autoconfig package were of much help in writing these config
20: # files.
1.3 noro 21: # $Id: Configure,v 1.87 2002/09/10 08:40:39 bill Exp $
1.1 noro 22:
23: TOP=`pwd`
24: dflt_conf_file=dft.Config.in
25:
26: # Directories
27: config_dir=config
28: data_dir=data
29: doc_dir=doc
30: emacs_dir=emacs
31: examples_dir=examples
32: misc_dir=misc
33: src_dir=src
34:
35: extract_dir_list="$doc_dir $emacs_dir $misc_dir"
36:
37: # Version number and patch level.
38: . $config_dir/version
39: version=$VersionMajor.$VersionMinor
1.3 noro 40: pari_release="$VersionMajor.$VersionMinor.$patch"
1.1 noro 41: if test `expr $VersionMinor % 2` = 1; then
42: echo "Configuring pari-$version.$patch (STABLE)"
43: libpari_base=pari
44: else
45: echo "Configuring pari-$version.$patch (DEVELOPMENT VERSION)"
46: libpari_base=pari-$version
47: fi
48:
49: cd $config_dir
50:
51: ####################### CONFIGURE - OPTIONS #################################
52: #
53: # Processing Options
54: #
55: fastread=yes
56: config_file=
57: optimization=full
58: prefix=/usr/local
59: share_prefix=
60: target_host=
61: which_graphic_lib=none
62: test -n "$GP_INSTALL_PREFIX" && prefix=$GP_INSTALL_PREFIX
63: while test $# -gt 0; do
64: case "$1" in
65: -l|-load) shift; initfile=$1;
66: cd $TOP
67: PATH=.:$PATH; export PATH
68: if test -z "$1";then
69: tmp_host=`$config_dir/arch-osname`
70: arch=`echo "$tmp_host" | sed -e 's/\(.*\)-.*/\1/'`
71: osname=`echo "$tmp_host" | sed -e 's/.*-\(.*\)/\1/'`
72: objdir=O$osname-$arch;
73: initfile=$objdir/$dflt_conf_file;
74: fi
75: if test -r "$initfile"; then
76: . $initfile
77: if test ! -d $objdir; then mkdir $objdir; fi
78: . $config_dir/extract_files
79: exit 0
80: else
81: echo "Cannot read config file \"$initfile\"." >&2
82: exit 1
83: fi;;
84: -p|-prefix) shift; prefix=$1;;
85: --prefix=*|--prefi=*|--pref=*|--pre=*|--pr=*|--p=*)
86: prefix=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
87: --share-prefix=*)
88: share_prefix=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
89: --bindir=*) dfltbindir=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
90: --libdir=*) dfltlibdir=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
91: --mandir=*) dfltmandir=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
92: --miscdir=*) dfltmiscdir=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
93: --datadir=*) dfltdatadir=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
94: --includedir=*) dfltincludedir=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
95: --host=*)
96: target_host=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
97: --disable-kernel) kernel=no;;
98: -a|-ask|--ask) fastread=no;;
99: -g) optimization=debugging;;
100: -pg) optimization=profiling;;
101: -rdll) DYNRELOC=yes;;
102: -h|-help|--help|-\?)error=true;;
103: -v|-verbhelp|--verbhelp)error=verb;;
104: -s|--static) static=y;;
105: -graphic|--graphic) shift; which_graphic_lib=$1; graph_cmd=yes ;;
106: --graphic=*|--graphi=*|--graph=*|--grap=*|--gra=*|--gr=*|--g=*)
107: graph_cmd=yes
108: which_graphic_lib=`echo "$1" | sed -e 's/[-a-z]*=//'`;;
109: *) echo "*** Unrecognized option $1." >&2; error=true;;
110: esac
111: shift
112: done
113:
114: case "$error" in
115: true) cat >&2 <<EOT
116: Usage: Configure [-ask|-help|-g|-pg] [ -load <filename> ] [ --prefix=<dir> ]
117:
118: Options: some names can be abbreviated to one character (e.g -h = -help)
119: -a, --ask interactive configuration
120: -h, --help this message
121: -l, --load skip Configure and specify a default config file
122: -s, --static build static GP binary only
123: -v, --verbhelp a longer help message
124: Build Options:
125: --host=<arch-osname> target achitecture
1.3 noro 126: --graphic=<gr> graphic library used (default X11) (none X11 gnuplot
127: gnuplot-dynamic builtin.X11-gnuplot builtin.X11-gnuplot-dynamic)
1.1 noro 128: Additional developer options:
129: -g creates debugging version (in Oxxx.dbg)
130: -pg creates profiling version (in Oxxx.prf)
131: -rdll creates relocatable DLL (Cygwin32 only)
132:
133: Installation directories:
134: --prefix=<dir> install files in <dir> (default $prefix)
135: --share-prefix=<dir> as 'prefix', for architecture independant files
136: --bindir=<dir> for binaries
137: --libdir=<dir> for libraries
138: --mandir=<dir> for manual pages
139: --miscdir=<dir> for documentation, examples and emacs macros
140: --datadir=<dir> for precomputed data (Galois resolvents for polgalois)
141: --includedir=<dir> for C header files
142: EOT
143: exit 1
144: ;;
145: verb) cat >&2 <<EOT
146: Architecture, operating system and asm kernel.
147: Configure tries to detect what is the architecture of the machine (CPU type)
148: and what operating system it is running. Then, it decides whether an asm
149: kernel exists and should be used. You can override this with Configure -ask.
150: Which compiler will be used ?
151: Depending on the machine (architecture and operating system) and on what is
152: found in the path, a compiler is automatically chosen. If you set the
153: environment variable CC before typing Configure, it will be used instead.
154: Typeset the installation help ('tex INSTALL.tex') for more details.
155: EOT
156: exit 1
157: ;;
158: esac
159:
160: test "$fastread" = yes || cat <<EOT
161: ==========================================================================
162: Beginning configuration questions for GP/PARI.
163:
164: You will be asked some questions about your system. Most of the time, a list
165: of acceptable answers will be supplied as well as a default between brackets.
166: Type a carriage return ('Enter') to accept these defaults.
167:
168: Though the present script strives to prevent any fatal mistake on your part,
169: there is currently no easy way out if you make one. Your best bet is to press
170: Ctrl-C, then start again. Another possibility is to wait till the questions
171: end, edit the file "Oxxx/$dflt_conf_file", then run
172:
173: Configure -load Oxxx/$dflt_conf_file
174:
175: (which can be abbreviated to simply "Configure -l", provided your architecture
176: is correctly detected)
177: ==========================================================================
178: EOT
179:
180: ####################### CONFIGURE - SHELL ###################################
181: if test -z "$OS2_SHELL"; then dir_sep=':' ; else dir_sep=';' ; fi
182:
183: #
184: # Proper PATH setting
185: #
186: pth="\
187: /bin\
188: /usr/bin\
189: /usr/locateal/bin\
190: /usr/ucb\
191: /usr/locateal\
192: /usr/lbin\
193: /usr/5bin\
194: /etc\
195: /usr/etc\
196: /usr/gnu/bin\
197: /usr/new\
198: /usr/new/bin\
199: /usr/nbin\
200: /sys5.3/bin\
201: /sys5.3/usr/bin\
202: /bsd4.3/bin\
203: /bsd4.3/usr/ucb\
204: /bsd4.3/usr/bin\
205: /usr/bsd\
206: /bsd43/bin\
207: /opt/ansic/bin\
208: /usr/ccs/bin\
209: /usr/lib\
210: /usr/ucblib\
211: /lib\
212: /usr/ccs/lib\
213: /sbin\
214: /usr/sbin\
215: /usr/libexec\
216: /usr/openwin/bin\
217: /usr/local/bin\
218: "
219: # /usr/openwin/bin added for xmkmf
220:
221: for p in $pth
222: do
223: case "$dir_sep$PATH$dir_sep" in
224: *$dir_sep$p$dir_sep*) ;;
225: *) test -d $p && PATH=$PATH$dir_sep$p ;;
226: esac
227: done
228: PATH=.$dir_sep$PATH; export PATH
229:
230: echo "Checking echo to see how to suppress newlines..."
231:
232: if (echo "hi\c"; echo " ") | grep c >/dev/null 2>&1 ; then
233: echo "...using -n."; n=-n; c=
234: else
235: cat <<EOM
236: ...using \c
237: EOM
238: n=; c='\c'
239: fi
240: if test "$fastread" != yes; then
241: echo $n ..."The star should be here-->$c"; echo '*'
242: fi
243:
244: #
245: # We might need the following :
246: #
247: echo Looking for some tools first ...
248: list='ld zcat gzip ranlib perl emacs'
249: pathspace=`echo $PATH | sed -e "s/$dir_sep/ /g" | sed -e 's,\\\\,/,g'`
250:
251: for file in $list; do
252: x=`./locate $file '' $pathspace`
253: eval $file=$x
254: case $x in
255: # support also DOS filesystems (hard drive prepended)
256: ?:/*|/*) echo ..."$file is $x";;
257: *) echo ..."I could not find $file." >&2;;
258: esac
259: done
260: if test -z "$zcat" -a -n "$gzip"; then zcat="$gzip -dc"; fi
261:
262: ####################### CONFIGURE - ARCHITECTURE ############################
263: #
264: # Testing Architectures. Try uname to provide a default, then ask user.
265: #
266: if test -z "$target_host"; then
267: target_host=`./arch-osname`
268: fi
269: arch=`echo "$target_host" | sed -e 's/\(.*\)-.*/\1/'`
270: osname=`echo "$target_host" | sed -e 's/.*-\(.*\)/\1/'`
271:
272: if test "$fastread" != yes; then
273: cat << EOM
274: ==========================================================================
275: Currently supported architectures:
276: EOM
277: rep='none sparcv7 sparcv8_super sparcv8_micro sparcv9
278: m68k ix86 i386 i486 i586 i686 hppa alpha mips fx2800'
279: . ./display
280: echo $n ..."Which of these apply, if any ? $c"
281: dflt=$arch; . ./myread; arch=$ans
282: fi
283:
284: #
285: # Test OS, using the info uname provided.
286: #
287: if test "$fastread" != yes; then
288: cat << EOM
289: ==========================================================================
290: I know of the following Operating Systems
291: EOM
292: rep='os2 freebsd cygwin linux hpux aix osf1 solaris sunos nextstep concentrix irix';
293: . ./display
294: echo $n ..."Any of these apply ? $c"
295: dflt=$osname; . ./myread
296: osname=$ans
297: fi
298:
299: #
300: # A pretty name for the architecture
301: # The asm file used (if any)
302: #
303: case "$arch" in
304: sparc) asmarch=sparcv8_micro; pretty=Sparc ;;
305: sparcv7) asmarch=$arch; pretty=SparcV7 ;;
306: sparcv8_micro) asmarch=$arch; pretty=MicroSparc ;;
307: sparcv8_super) asmarch=$arch; pretty=SuperSparc ;;
308: sparcv9) asmarch=sparcv8_micro; pretty=UltraSparc ;;
309: m68k) asmarch=$arch; pretty="MC680x0, x>=2" ;;
310: i?86) asmarch=ix86 ; pretty=$arch ;;
311: hppa) asmarch=none ; pretty=HP
312: case "$osname-`uname -r`" in
313: hpux-?.10.*) asmarch=$arch ;;
314: esac ;;
315: alpha) asmarch=$arch; pretty=Alpha ;;
316: mips) asmarch=none; pretty=Mips ;;
317: fx2800) asmarch=none; pretty="Alliant FX/2800" ;;
318: none) asmarch=none; pretty="unknown" ;;
319: *) asmarch=none; pretty=$arch
320: echo " Warning ! architecture $arch not tested";;
321: esac
322:
323: #
324: # Modifications for pretty name and asm file
325: #
326: case "$osname" in
1.3 noro 327: nextstep|cygwin*|linux|freebsd|os2)
328: pretty="$pretty running $osname";
329: if test "$arch" = m68k; then asmarch=none; fi ;;
1.1 noro 330: esac
331:
332: if test "$kernel" = no; then
333: asmarch=none;
334: echo "assembler micro kernel disabled"
335: else
336: if test "$fastread" != yes; then
337: cat << EOM
338: ==========================================================================
339: An optimized Pari kernel is available for these architectures
340: ("none" means that we will use the portable C version of GP/PARI)
341: EOM
342: rep='none sparcv7 sparcv8_super sparcv8_micro m68k ix86 alpha hppa'
343: . ./display
344: echo $n ..."Which of these apply, if any ? $c"
345: dflt=$asmarch; . ./myread; asmarch=$ans
346: cat << EOM
347: ==========================================================================
348: EOM
349: fi
350: fi
351: case "$asmarch" in
352: none) prettyk="C portable";;
353: sparcv7) prettyk=SparcV7;;
354: sparcv8_super) prettyk=SuperSparc;;
355: sparcv8_micro) prettyk=MicroSparc;;
356: m68k) prettyk="MC680x0, x>=2";;
357: ix86) prettyk=ix86;;
358: hppa) prettyk=HPPA;;
359: alpha) prettyk=Alpha;;
360: ppc) prettyk=PPC;;
361: *) prettyk="$asmarch";;
362: esac
363: # 'i386 (running ix86 kernel)' looks ugly
364: if test "$arch" != "$asmarch" -a \( "$arch" != "i386" -o "$asmarch" != "ix86" \)
365: then
366: pretty="$pretty ($prettyk kernel)"
367: fi
368: echo "Building for architecture: $pretty"
369:
370: #
371: # Which copy, SHELL ?
372: #
373: case "$osname-$arch" in
374: os2-*) ln_s=cp; make_sh=sh; exe_suff=.exe; extraflag="-Zexe" ;;
375: cygwin*) ln_s="ln -s"; make_sh="/bin/sh"; exe_suff=.exe; extraflag="" ;;
376: *) ln_s="ln -s"; make_sh="/bin/sh"; exe_suff=; extraflag="" ;;
377: esac
378:
379: ####################### CONFIGURE - COMPILATION #############################
380: #
381: # Which optimization ?
382: #
383: if test "$fastread" != yes; then
384: cat << EOT
385: ==========================================================================
386: The default is to fully optimize the compilation. You may choose to build
387: an executable for debugging or profiling instead. Choose among :
388: full debugging profiling
389: EOT
390: echo $n ..."Which optimization do you prefer ? $c"
391: dflt=$optimization; rep='full debugging profiling'; . ./myread
392: optimization=$ans
393: fi
394:
395: #
396: # Which Compiler ?
397: #
398: if test -z "$CC"; then
399: echo Looking for the compilers ...
400: # Native Compilers
401: cc=`./locate cc '' $pathspace`
402: case "$osname" in
403: hpux) if test "$cc" = /usr/ccs/bin/cc -a -f /opt/ansic/bin/cc; then
404: cc=/opt/ansic/bin/cc; fi ;; # This is a better compiler
405: esac
406: case "$cc" in ?:/*|/*) echo ..."cc is $cc";;
407: *) echo ..."I could not find cc.";; esac
408: # GNU Compilers
409: gcc=`./locate gcc '' $pathspace`
410: if test -z "$gcc"; then
411: exe=$osname-$arch-gnu$$
412: $cc $extraflag -o $exe gnu.c
413: if $exe; then gcc=$cc; fi; rm -f $exe
414: fi
415: case "$gcc" in
416: ?:/*|/*) echo ..."gcc is $gcc";;
417: *) echo ..."I could not find gcc."; gcc=;;
418: esac
419: if test -n "$gcc"; then
420: __gnuc__=`$gcc -v 2>&1 | sed -n 's/.*version //p'`
421: if test -z "$__gnuc__"; then __gnuc__=unknown; fi
422: echo GNU compiler version $__gnuc__
423: fi
424: case "$osname" in
425: aix) __gnuc__=;; # Native compilers are faster
426: hpux) __gnuc__=;; # versions older than 2.7 cannot build PIC code
427: # gp built with recent versions has bugs
428: concentrix) case "$__gnuc__" in 2.[78].*);; *)
429: __gnuc__=;; esac;;
430: esac
431: # Choosing the compiler
432: if test -n "$__gnuc__"; then CC=$gcc; else CC=$cc; fi
433: fi
434:
1.3 noro 435: if test -z "$gcc"; then
436: case "$which_graphic_lib" in
437: *gnuplot)
1.1 noro 438: lib=$gnuplot_fullpath; sym=_eprintf; . ./locatesymbol
439: if test -n "$try"; then
440: echo "...Looks like gcc-compiled gnuplot. I add -lgcc to graphic libraries"
441: _ogcc="$gcc"
1.3 noro 442: pth="$libpth /opt/local/gnu/lib /usr/local/gnu/lib"
1.1 noro 443: gcclibspec="`gcc -v 2>&1 | grep specs | sed 's/.*specs from //'`"
444: if test -n "$gcclibspec"; then
445: pth="`dirname $gcclibspec` $pth"
446: fi
447: lib=gcc; . ./locatelib
448: if test -n "$gcc"; then
449: gnuplot_libs="$gnuplot_libs -L$gcc"
450: else
451: echo "...### I did not find -lgcc library in $pth."
452: echo "...### You may need to manually add something like -L/opt/gnu/lib to the "
453: echo "...### PLOTLIBS = ..."
454: echo "...### line in your architecture-Makefile."
455: fi
456: gcc="$_ogcc"
457: gnuplot_libs="$gnuplot_libs -lgcc"
458: fi
1.3 noro 459: ;;
460: esac
1.1 noro 461: fi
462:
463:
464: if test "$fastread" != yes; then
465: cat << EOT
466: ==========================================================================
1.3 noro 467: Only ANSI C and C++ compilers are supported. Choosing the GNU compiler
1.1 noro 468: gcc/g++ enables the inlining of kernel routines (about 20% speedup; if you
1.3 noro 469: use g++, it is a good idea to include the -fpermissive flag). If you choose
470: not to use gcc, the C++ version of Pari will be a little faster because of
471: general inlining, but can be used in library mode only with C++ programs (we
472: _really_ recommand using gcc all the way through).
1.1 noro 473: EOT
474: echo $n ..."Which C compiler shall I use ? $c"
475: dflt=$CC; rep=; . ./myread
476: CC=$ans
477: fi
478:
479: #
480: # Which Flags for Compiler ?
481: #
482: if test "$CC" != "$gcc"; then __gnuc__=; fi
483: if test -z "$__gnuc__"; then
484: exe=$osname-$arch-gnu$$
485: $CC $extraflag -o $exe gnu.c
1.3 noro 486: if $exe; then
487: __gnuc__=`$CC -v 2>&1 | sed -n 's/.*version //p'`
488: echo GNU compiler version $__gnuc__
489: fi
1.1 noro 490: rm -f $exe
491: fi
492:
1.3 noro 493: ASMINLINE=
1.1 noro 494: if test -n "$__gnuc__"; then
495: __GNUC__="-D__GNUC__"
496: warn="-Wall -Wno-implicit"
1.3 noro 497: OPTFLAGS=-O3
498: ASMINLINE=yes
499: case "$asmarch" in
500: alpha)
501: case "$__gnuc__" in
502: 2.95.3*|3.*) OPTFLAGS=-O;; # avoid optimizer bugs
503: *) ASMINLINE=;; # doesn't work with 2.95.2.
504: esac
505: ;;
506: esac
507: OPTFLAGS="$OPTFLAGS -DGCC_INLINE $warn"
508: DBGFLAGS=${DBGFLAGS:-"-g $warn"}
1.1 noro 509: # Some architectures need -fPIC for building dynamic lib
510: case "$osname-$arch" in hpux-*) DLCFLAGS=-fPIC;; esac
511: # Specific optimisations for some architectures
512: case "$osname-$arch" in
513: linux-i?86|cygwin*) OPTFLAGS="$OPTFLAGS \
514: -malign-loops=2 -malign-jumps=2 -malign-functions=2";;
515: os2-*) cflags=-Zmt;;
516: *-sparcv8*) cflags=-mv8;;
517: esac
518: # omit-frame-pointer incompatible with -pg
519: PRFFLAGS="-pg $OPTFLAGS"
520: case "$optimization" in
521: full) OPTFLAGS="$OPTFLAGS -fomit-frame-pointer";;
522: esac
523: else
524: cflags=
1.3 noro 525: DBGFLAGS=${DBGFLAGS:-'-g'}
526: PRFFLAGS='-pg'
1.1 noro 527: case "$osname-$arch" in
528: hpux-*) # -Aa is for ANSI C, +z for PIC code (for commercial HPUX compilers)
529: OPTFLAGS=-O; cflags=-Aa; DLCFLAGS=+z;;
530: # best tuning option, even for PPC604:
531: aix-*) OPTFLAGS=-O2; cflags='-qlanglvl=ansi -qtune=601';;
532: cygwin*|linux-i?86|freebsd-i?86)
533: OPTFLAGS=-O2; cflags=-m486;;
534: osf1-*) OPTFLAGS='-O4 -migrate -ifo -Olimit 9999';;
535: sunos-*) OPTFLAGS=-fast; PRFFLAGS='-pg -Bstatic';;
536: solaris-*) OPTFLAGS=-fast; PRFFLAGS=-xpg;;
537: concentrix-*) OPTFLAGS=-Ogi;;
538: *) OPTFLAGS=-O;;
539: esac
540: PRFFLAGS="$PRFFLAGS $OPTFLAGS"
541: fi
542: cflags="$cflags $DLCFLAGS"
543:
544: case "$osname" in
545: nextstep) cflags="-traditional-cpp $cflags";;
546: esac
547:
548: case "$optimization" in
549: full) suffix=; cflags="$OPTFLAGS $cflags";;
550: profiling) suffix=.prf; cflags="$PRFFLAGS $cflags";;
551: debugging) suffix=.dbg; cflags="-DMEMSTEP=1048576 $DBGFLAGS $cflags";;
552: esac
553:
1.3 noro 554: if test "$fastread" != yes; then
555: echo $n ..."With which flags ? $c"
556: dflt=${CFLAGS:-$cflags}; rep=; . ./myread
557: cflags=$ans
558: fi
559:
560: # Here we should check it is an ANSI compiler...
561: echo "C compiler is $CC $cflags"
562:
563: #
564: # Which Assembler ?
565: #
566: if test -z "$AS"; then
567: echo Looking for an assembler ...
568: if test "$osname" = hpux
569: then AS=`./locate as '' /usr/ccs/bin /bin` # We don't want GNU as
570: else AS=`./locate as '' $pathspace`
571: fi
572: case "$AS" in ?:/*|/*) echo ..."as is $AS";;
573: *) echo ..."I could not find as." ;; esac
574: fi
575: gnuas=no
576: if (echo | $AS --version 2>&1 | grep GNU > /dev/null); then
577: gnuas=yes
578: else
579: if (echo | $AS -v 2>&1 | grep GNU > /dev/null); then
580: gnuas=yes
581: fi
582: fi
583: if test "$gnuas" = yes; then
584: echo "...Hum, this looks like GNU as"
585: case "$osname-$asmarch" in
586: solaris-sparc*) KERNELCPPFLAGS="-DNO_UNDERSCORE $__GNUC__";;
587: esac
588: else
589: case "$osname-$asmarch" in
590: osf1-alpha) ASFLAGS="-O1";;
591: sunos-sparc*) ASFLAGS="-P -I. $__GNUC__";;
592: solaris-sparc*) ASFLAGS="-P -I. $__GNUC__ -T";;
593: hpux-hppa) ASFLAGS="+DA1.1";;
594: *) ASFLAGS=;;
595: esac
596: fi
597: echo "Assembler is $AS $ASFLAGS"
598:
599: #
600: # Which C PreProcessor ?
601: #
602: case "$osname" in
603: nextstep) cppfl="-traditional-cpp" ;;
604: freebsd)
605: if test "$PORTOBJFORMAT" = "elf"; then
606: cppfl="-DUSE_ELF"
607: FREEBSD_ELF=1
608: else
609: FREEBSD_ELF=0
610: fi ;;
611: esac
612: CPP="$CC $cppfl -E -I."
613:
614: echo "C PreProcessor is $CPP"
615:
616: #
617: # Which Executable Linker ?
618: #
619: LIBS=-lm
620: case "$osname" in
621: darwin) LIBS= ;;
622: esac
623: case "$osname-$arch" in
624: linux-*|cygwin*|freebsd-*)
625: LD=$CC; LDFLAGS="$cflags -Xlinker -export-dynamic"
626: runpathprefix='-Xlinker -rpath -Xlinker ';;
627: osf1-alpha)
628: LD=$ld; LIBS="$LIBS -lots -lc"; runpathprefix='-rpath '
629: LDFLAGS='-std0 -call_shared /usr/lib/cmplrs/cc/crt0.o'
630: case "$optimization" in
631: full|profiling) LDFLAGS="-g0 -O4 $LDFLAGS";;
632: esac;;
633: solaris-*) LD=$CC; LDFLAGS=$cflags; runpathprefix=-R ;;
634: os2-*) LD=$CC; LDFLAGS="$cflags -Zexe"
635: case "$optimization" in
636: full) LDFLAGS="$LDFLAGS -s";;
637: esac;;
638: *) LD=$CC; LDFLAGS=$cflags ;;
639: esac
640:
641: if test "$fastread" != yes; then
642: echo $n ..."Which linker for building executables ? $c"
643: dflt=$LD; rep=; . ./myread
644: LD=$ans
645: fi
646:
647: #
648: # Which Flags for Executable Linker?
649: #
650: if test "$fastread" != yes; then
651: echo $n ..."With which flags ? $c"
652: dflt=$LDFLAGS; rep=; . ./myread
653: LDFLAGS=$ans
654: fi
655:
656: echo "Executable linker is $LD $LDFLAGS"
657:
658: if test "$optimization" = profiling; then DLLD=; else
659: DLLD=${DLLD-ld}
660: DLSUFFIX=so
661: # Which suffix for Dynamic Lib?
662: # Some linkers (SunOS 4) need minor and major lib version numbers.
663: # Some others (SunOS 5) need a link from a .so
664: # Some others (HPUX 09) do not want version numbers.
665: #
666: soname=.$soname_num
667: case "$osname-$arch" in
668: # aix-*) DLSUFFIX=a ;; dynamic linking does not work!
669: sunos-*) sodest=.$VersionMajor$VersionMinor.$patch
670: soname=$sodest;;
671: *-alpha|solaris-*|linux-*|freebsd-*)
672: case $libpari_base in
673: pari) sodest=.$version.$patch;; # released versions
674: *) sodest=.$patch.0.0;; # unstable versions
675: esac ;;
676: # FIXME: gp-dyn.exe crashes on startup
677: # cygwin*) soname= ; sodest= ; DLSUFFIX=dll;;
678: hpux-*) soname= ; sodest= ; DLSUFFIX=sl;;
679: irix-*) soname= ; sodest= ;;
680: *) DLLD=;;
681: esac
682: fi
683:
684: if test -n "$DLLD"; then
685: # Which Dynamic Lib Linker?
686: #
687: if test $DLLD = ld -a -n "$ld"; then
688: DLLD=$ld;
689: fi
690: if test "$fastread" != yes; then
691: echo $n ..."Which linker for building dynamic libs? $c"
692: dflt=$DLLD; rep=; . ./myread
693: DLLD=$ans
694: fi
695:
696: # Which Flags for Dynamic Lib Linker ?
697: #
698: if ($DLLD -v 2>&1 | grep GNU > /dev/null); then
699: echo "...Hum, this looks like GNU ld"
700: DLLDFLAGS="-shared -soname \$(LIBPARI_SONAME)"
701: else
702: # not GNU ld
703: case "$osname-$arch" in
704: aix-*) DLLDFLAGS="-r" ;;
705: hpux-*) DLLDFLAGS="-b -E" ;;
706: freebsd-*) DLLDFLAGS="-Bshareable -x" ;;
707: linux-*) DLLDFLAGS="-shared -soname \$(LIBPARI_SONAME)" ;;
708: irix-*) DLLDFLAGS="-shared -elf -no_unresolved -all" ;;
709: *-alpha) DLLDFLAGS="-shared"; EXTRADLLDFLAGS='${LIBS}'
710: case "$optimization" in
711: full) DLLDFLAGS="$DLLDFLAGS -O3" ;;
712: esac;;
713: sunos-*) DLLDFLAGS="-assert nodefinitions" ;;
714: solaris-*) DLLDFLAGS="-G -h \$(LIBPARI_SONAME)" ;;
715: *) DLLD=;;
716: esac
717: fi
718: case "$osname" in
719: freebsd|linux|sunos|solaris) DLLDFLAGS="$DLLDFLAGS -lc -lm";;
720: esac
721:
722: if test "$fastread" != yes; then
723: echo $n ..."Which flags for linker? $c"
724: dflt=$DLLDFLAGS; rep=; . ./myread
725: DLLDFLAGS=$ans
726: fi
727: fi
728:
729: if test -z "$DLLD"; then
730: echo "No Dynamic Lib"
731: static=y
732: else
733: echo "Dynamic Lib linker is $DLLD $DLLDFLAGS"
734: static=${static-n}
735: fi
736:
737: if test "$fastread" != yes; then
738: cat << EOT
739: ==========================================================================
740: Should you change your mind, you only need to modify the lines
741: CC="$CC"
742: CFLAGS="$cflags"
743: LD="$LD"
744: LDFLAGS="$LDFLAGS"
745: DLLD="$DLLD"
746: DLLDFLAGS="$DLLDFLAGS"
747: in the Makefile
748: ==========================================================================
749: EOT
750: fi
751:
752: ####################### CONFIGURE - LIBC ####################################
753: #
754: # sizeof(long), double format
755: #
756: doubleformat=4321;
757: exe=$osname-$arch-endian$$
758: if ($CC $cflags $extraflag endian.c -o $exe 2>/dev/null); then
759: doubleformat=`$exe`;
760: fi
761: rm -f $exe $exe$exe_suff
762: case "$doubleformat" in
763: *IEEE*)
764: echo "***************************************************************"
765: echo "Your 'double' type does not follow the IEEE754 format. Aborting"
766: echo "PLEASE REPORT! (dbltor/rtodbl need to be fixed)"; exit 1;;
767: -) sizeof_long=8; pretty="$pretty 64-bit version";;
768: *) sizeof_long=4; pretty="$pretty 32-bit version";;
769: esac
770: echo "Given the previous choices, sizeof(long) is $sizeof_long chars."
771:
772: if test "$fastread" != yes; then
773: cat << EOT
774: If your hardware supports different size of longs (e.g SGI/MIPS), and you
775: want to use a different word size than the above. You should probably have
776: specified some exotic compilation flag CFLAG (e.g -o32,-n32).
777:
778: EOT
779:
780: if test $doubleformat != "-"; then
781: cat << EOT
782: For 32-bit architecture, PARI needs to know the format of your 'double' type.
783: PARI assumes doubles are stored in IEEE754 format [ (sign, exponent, mantissa
784: high) on one word, (mantissa low) on another ]; assuming a
785: union { double d; ulong l[2]; } x;
786: are the double exponent and sign stored on x.i[0] (0) or on x.i[1] (1) ?
787:
788: Using \$CC \$CFLAGS with
789: CC =$CC
790: CFLAGS=$cflags
791: the answer is: $doubleformat.
792: EOT
793: fi
794: fi
795: case $doubleformat in
796: 0) _format='l[0], l[1]';;
797: 1) _format='l[1], l[0]';;
798: -) _format='not needed (64bit)';;
799: esac
800: cat <<EOT
801: The internal word representation of a double is $_format.
802: ==========================================================================
803: EOT
804: #
805: # Looking in libc for some functions.
806: #
807: exe=$osname-$arch-tmp$$
808: _has_list=
809: echo Checking some common types...
810: list=ulong; . ./look
811: echo Looking in C lib for some symbols...
812: extra_flags=
813: list=exp2; . ./look
814: list=strftime; . ./look
815: case "$arch" in
816: alpha) list='times ftime';; # gp-dyn has problems with getrusage
817: *) case "$osname" in
818: *cygwin*) list='times ftime';; # getrusage based timer always returns 0
819: *) list='getrusage times ftime';;
820: esac;;
821: esac; . ./look
822: list='sigrelse sigsetmask'; . ./look
823: list=TIOCGWINSZ; . ./look
824: list=getrlimit; . ./look
825: list=opendir; . ./look
826: list=vsnprintf; . ./look
827:
828: # For install(). Do we need libdl.so?
829: # on irix and osf1 -ldl not needed
830: extra_flags=
831: list=dlopen; . ./look
832: if test "$has_dlopen" = no; then
833: echo "Try again, with -ldl this time..."
834: extra_flags=-ldl; . ./look
835: if test "$has_dlopen" = yes; then
836: LIBS="-ldl $LIBS"
1.1 noro 837: fi
838: fi
1.3 noro 839: if test "$has_dlopen" = no -a X"$osname" = Xos2; then
840: echo "Will use the builtin dlopen() support for OS/2..."
841: has_dlopen=builtin
1.1 noro 842: fi
843:
1.3 noro 844: ####################### CONFIGURE - LIBRARIES ###############################
1.1 noro 845: #
1.3 noro 846: # Looking for libraries now
1.1 noro 847: #
1.3 noro 848: case "$osname" in
849: cygwin*) ver=`uname -r | cut -d. -f1`
850: cygtop=/cygdrive/c
851: if test ! -d $cygtop; then
852: cygtop=/Cygnus/cygwin/B$ver
853: if test ! -d $cygtop; then
854: cygtop=/Cygnus/cygwin-B$ver
855: if test ! -d $cygtop; then
856: cygtop=/usr/${arch}-pc-cygwin
857: if test ! -d $cygtop; then
858: echo ..."I could not find Cygwin top directory" >&2
859: fi
860: fi
861: fi
862: fi;;
1.1 noro 863: esac
1.3 noro 864: readline_enabledp="nil"
865: if test "$optimization" != profiling; then
866: # First, construct the PATHs
867: case "$osname" in
868: cygwin*) if test "$cygtop" = /cygdrive/c; then
869: # cygnus for version 1.*
870: libpth="
871: /usr/local/lib\
872: /lib\
873: "
1.4 ! noro 874: # fixed by noro
! 875: # cygtop=/
! 876: cygtop=
1.3 noro 877: else
878: # cygnus for version 0.*
879: libpth="
880: $cygtop/H-${arch}-cygwin32/lib\
881: $cygtop/H-${arch}-cygwin32/${arch}-cygwin32/lib\
882: "
883: fi;;
884: os2) libpth=`echo $LIBRARY_PATH | sed 's/;/ /g' | sed 's,\\\\,/,g'`;;
885: *) libpth="\
886: /usr/local/lib\
887: /lib\
888: /usr/lib\
889: /opt/lib\
890: /opt/local/lib\
891: /opt/gnu/lib\
892: /lib/pa1.1\
893: /usr/lib/large\
894: /lib/large\
895: /usr/lib/small\
896: /lib/small\
897: /usr/ccs/lib\
898: /usc/ucblib\
899: /usr/shlib\
900: .\
901: ";;
902: esac
1.1 noro 903:
1.3 noro 904: tdir=$osname-$arch-X11$$
905: mkdir $tdir; cp Imakefile $tdir; cd $tdir
906: if (xmkmf) >/dev/null 2>&1 && test -f Makefile; then
907: eval `make gp-X11 2> /dev/null | grep -v make`
908: rm -f Makefile Makefile.bak
909: x11pth="$usrlibdir $libdir";
910: fi
911: cd ..; rm -rf $tdir
1.1 noro 912:
1.3 noro 913: # We want these libraries:
1.1 noro 914: #
1.3 noro 915: echo Checking for optional libraries and headers...
916:
917: # ======== GRAPHICS environment search ==============
918:
919: # At this moment $which_graphic_lib is either none, or the argument to
920: # --graphic option; $graph_cmd is "" unless --graphic option was specified.
921:
922: # LIB: X11
923: pth=$x11pth
924: lib=X11; . ./locatelib
925: if test -f $Xincroot/X11/Xos.h -a -z "$graph_cmd"; then
926: which_graphic_lib=X11
927: test -n "$extralib" && echo ..."Extra Libraries are $extralib"
928: echo ..."Found X11 header files in $Xincroot/X11"
929: fi
930:
931: # LIB: gnuplot
932: # Look for it unconditionally, without read/write of
933: # $which_graphic_lib or $graph_cmd
934: pth="$TOP/gnuplot-$osname-$arch $TOP/gnuplot\
935: $TOP/../gnuplot-$osname-$arch $TOP/../gnuplot\
936: $TOP/../../gnuplot-$osname-$arch $TOP/../../gnuplot $libpth"
937: lib=gnuplot; . ./locatelib
938: gnuplot_fullpath="$try"
939: gnuplot_libs=
940: case $gnuplot in
941: /*|[c-z]:/*)
942: addgnuplot=gnuplot
943: for lib in vga vesa jmgraph linuxvga gd png z
944: do
945: . ./locatelib
946: eval "elib=\$$lib"
947: case $elib in
948: /*|[c-z]:/*) gnuplot_libs="$gnuplot_libs -l$lib";;
949: esac
950: done
951: if test "$which_graphic_lib" = gnuplot; then
952: if test -z "$gnuplot_libs"; then
953: echo "...I expect that no libraries are needed for gnuplot"
954: else
955: echo "...I expect that libraries $gnuplot_libs are needed for gnuplot"
956: fi
957: fi
958: ;;
959: *)
960: if test "$which_graphic_lib" = gnuplot; then
961: pth=`echo $pth | sed -e "s,$TOP,.,g"`
962: echo "###"
963: echo "### Could not find gnuplot library in $pth"
964: echo "###"
965: case "$osname" in
966: os2) tlib=gnuplot.a ;;
967: *) tlib=libgnuplot.a ;;
968: esac
969: echo "### You may need to execute"
970: echo "### ar cr $tlib version.o util.o term.o bitmap.o stdfn.o"
971: echo "### In the build directory of gnuplot-3.7, and move"
972: echo "### $tlib to ./gnuplot-$osname-$arch or ./gnuplot subdirs"
973: echo "### or to similarly-named directories up the directory tree."
974: echo "###"
975: fi
976: ;;
977: esac
978:
979: # ======== END of GRAPHICS environment search ==============
1.1 noro 980:
1.3 noro 981: # LIB: GNU ReadLine
982: readline_add="$GP_READLINE $TOP/readline-$osname-$arch $TOP/readline"
983: pth="$readline_add $libpth"
984: lib=readline; . ./locatelib
985: rl_fullname=$try
1.1 noro 986:
1.3 noro 987: if test -n "$readline"; then
988: # Readline -- Headers
989: case "$osname" in
990: os2) incpth=`echo $C_INCLUDE_PATH | sed -e 's/\([^;]\)$/\1;/g' -e 's%;%/readline %g' -e 's,\\\\,/,g'` ;;
991: cygwin*) incpth="\
992: $cygtop/usr/local/include/readline\
993: $cygtop/usr/local/include\
994: $cygtop/usr/include/readline\
995: $cygtop/usr/include\
996: $cygtop/H-${arch}-cygwin32/${arch}-cygwin32/include\
997: ";;
998: *) incpth="\
999: /usr/local/include/readline\
1000: /usr/include/readline\
1001: /opt/include/readline\
1002: /opt/local/include/readline\
1003: /opt/gnu/include/readline\
1004: /usr/unsupported/include/readline\
1005: /usr/local/include\
1006: /usr/include\
1007: /opt/include\
1008: /opt/local/include\
1009: /opt/gnu/include\
1010: ";;
1011: esac
1012: pth="$readline_add $incpth"
1013: x=`./locate 'readline.h' '' $pth`
1014: CPPF_defined=
1015: case $x in
1016: ?:/*|/*) rl_include=`echo $x | sed 's,/readline.h,,'`
1017: echo ..."Found readline header in $rl_include"
1018: if (grep CPPFunction $x > /dev/null 2>&1); then CPPF_defined=yes; fi
1019: if (grep rl_message $x > /dev/null 2>&1); then rl_message=yes; fi
1020: if (grep rl_completion_matches $x > /dev/null 2>&1); then
1021: rl_completion_matches=yes;
1022: fi
1023: if (grep rl_completion_func_t $x > /dev/null 2>&1); then
1024: rl_completion_func_t=yes;
1025: fi
1026: if (grep "rl_refresh_line *()" $x > /dev/null 2>&1); then
1027: rl_refresh_line_oldproto=yes
1028: fi
1029: if (grep rl_completion_append_character $x > /dev/null 2>&1); then
1030: rl_appendchar=yes
1031: fi
1032: if (grep rl_generic_bind $x > /dev/null 2>&1); then
1033: rl_genericbind=yes
1034: fi
1035: if (grep rl_save_prompt $x > /dev/null 2>&1); then
1036: rl_save_prompt=yes;
1037: else # might be defined but not declared (old readline)
1038: lib=$rl_fullname; sym=rl_save_prompt; . ./locatesymbol
1039: _rl_save_prompt=$try
1040: fi;;
1041: *) echo ..."But no header file has been found"
1042: readline=;;
1.1 noro 1043: esac
1044: fi
1045:
1.3 noro 1046: pth="$readline_add $libpth"
1047: if test -n "$readline"; then
1048: # Readline -- Allocation
1049: lib=$rl_fullname; sym=alloca; . ./locatesymbol
1050: if test -n "$try"; then # alloca needed
1051: lib=iberty; . ./locatelib
1052: rl_liberty="$try"
1053: fi
1054: # Readline -- TermCap
1055: lib=$rl_fullname; sym=tgetent; . ./locatesymbol
1056: need_tgetent="$try"
1057: if test -n "$need_tgetent"; then
1058: lib=ncurses; . ./locatelib
1059: if test -n "$try"; then # ncurses found. Does it contain tgetent ?
1060: lib=$try; . ./locatesymbol
1061: fi
1062: if test -n "$try"; then
1063: rl_ncurses=$ncurses
1064: need_tgetent=
1065: else # give termcap a try
1066: lib=termcap; . ./locatelib
1067: if test -n "$try"; then
1068: rl_termcap=$termcap
1069: need_tgetent=
1070: fi
1071: fi
1072: fi
1073: # Readline -- CFLAGS
1074: if (echo $rl_include | grep "readline$" > /dev/null); then
1075: rl_include=`echo $rl_include | sed 's,/readline$,,'`
1076: RLINCLUDE="-I$rl_include"
1077: else # in case headers are not installed correctly
1078: RLINCLUDE="-I$rl_include -DREADLINE_LIBRARY"
1079: fi
1080: RLLIBS="-L$readline -lreadline"
1081: if test -n "$rl_ncurses"; then
1082: echo ..."Library ncurses needed by readline"
1083: RLLIBS="$RLLIBS -L$rl_ncurses -lncurses"
1084: fi
1085: if test -n "$rl_termcap"; then
1086: echo ..."Library termcap needed by readline"
1087: RLLIBS="$RLLIBS -L$rl_termcap -ltermcap"
1088: fi
1089: if test -n "$rl_liberty"; then
1090: echo ..."Library liberty needed by readline"
1091: RLLIBS="$RLLIBS -L$rl_liberty -liberty"
1092: fi
1093: # Readline -- last chance for tgetent
1094: if test -n "$need_tgetent"; then # try to compile anyway (in libc?)
1095: list=readline; extra_flags="$RLLIBS $RLINCLUDE"; ./look
1096: if test "$has_readline" = no; then
1097: echo "cannot use readline: please install libncurses or libtermcap."
1098: readline=
1099: fi
1100: fi
1.1 noro 1101: fi
1102:
1.3 noro 1103: if test -z "$readline"; then
1104: echo "### Building without GNU readline support"
1105: else
1106: if test "$fastread" = yes; then
1107: exe=$osname-$arch-rlv$$
1108: $CC $extraflag $RLINCLUDE -o $exe rl_version.c $RLLIBS 2> /dev/null
1109: if test -r $exe; then readline=`$exe`; else readline=1.0; fi
1110: rm -f $exe $exe$exe_suff
1111: echo "Using GNU readline, version $readline"
1112: fi
1113: if test -z "$rl_appendchar"; then
1114: echo ..."Library readline does not have completion_append_char"
1115: fi
1116: if test -z "$rl_genericbind"; then
1117: echo ..."Library readline does not have rl_generic_bind"
1118: fi
1119: if test -z "$rl_save_prompt"; then
1120: echo ..."Library readline does not have rl_save_prompt"
1121: if test -n "$_rl_save_prompt"; then
1122: echo ......"but it has _rl_save_prompt"
1123: fi
1124: fi
1.1 noro 1125:
1.3 noro 1126: if test "$fastread" != yes; then
1127: cat << EOM
1.1 noro 1128: ==========================================================================
1.3 noro 1129: EOM
1130: echo $n "Do you want to use GNU readline library within GP ? $c"
1131: rep='y n'; dflt=y; . ./myread
1132: case $ans in
1133: n) readline=;;
1134: esac
1135: fi
1136: fi
1.1 noro 1137:
1.3 noro 1138: if test -n "$readline"; then readline_enabledp="t"; fi
1.1 noro 1139:
1.3 noro 1140: # Graphic libs now.
1.1 noro 1141: #
1.3 noro 1142: if test "$fastread" != yes; then
1143: if test -n "$X11"; then addX11="X11 builtin.X11-gnuplot-dynamic"; fi
1144: if test -n "$X11" -a -n "$addgnuplot"; then
1145: addX11="$addX11 builtin.X11-gnuplot"
1146: fi
1147: cat << EOT
1148: ==========================================================================
1149: GP contains high resolution plotting functions. Choose among
1150: none $addX11 $addgnuplot gnuplot-dynamic
1.1 noro 1151: EOT
1.3 noro 1152: echo $n ..."Use which graphic library (\"none\" means no hi-res plot) ? $c"
1153: rep="none $addX11 $addgnuplot gnuplot-dynamic";
1154: dflt=$which_graphic_lib; . ./myread
1155: which_graphic_lib=$ans
1.1 noro 1156:
1.3 noro 1157: case "$which_graphic_lib" in
1158: *X11*)
1159: # If xmkmf did not give the right answer
1160: # X11 -- Headers
1161: if test ! -f $Xincroot/X11/Xos.h; then
1162: x11pth="\
1163: /usr/openwin/share/lib\
1164: /usr/openwin/lib\
1165: /usr/X11R6/lib\
1166: /usr/X11R5/lib\
1167: /usr/X11R4/lib\
1168: /usr/lib/X11R6\
1169: /usr/lib/X11R5\
1170: /usr/lib/X11R4\
1171: /usr/local/X11R6/lib\
1172: /usr/local/X11R5/lib\
1173: /usr/local/X11R4/lib\
1174: /usr/local/lib/X11R6\
1175: /usr/local/lib/X11R5\
1176: /usr/local/lib/X11R4\
1177: /usr/X11/lib\
1178: /usr/lib/X11\
1179: /usr/local/X11/lib\
1180: /usr/local/lib/X11\
1181: /usr/X386/lib\
1182: /usr/x386/lib\
1183: /usr/XFree86/lib/X11\
1184: /usr/lib\
1185: /usr/local/lib\
1186: /usr/unsupported/lib\
1187: /usr/athena/lib\
1188: /usr/local/x11r5/lib\
1189: /usr/lpp/Xamples/lib\
1190: ";
1191: pth=`echo $x11pth | s,/lib,/include,g`
1192: x=`./locate X11/Xos.h '' $pth`
1193: case $x in
1194: /*) Xincroot=`echo $x | sed 's,/X11/Xos.h,,'`;;
1195: *) Xincroot=;;
1196: esac
1197: if test -n "$Xincroot"; then
1198: echo ..."Found X11 header files in $Xincroot/X11"
1199: fi
1200: fi
1201: # X11 -- Lib
1202: if test -f $Xincroot/X11/Xos.h -a -z "$X11"; then
1203: pth=$x11pth;
1204: lib=X11; . ./locatelib
1205: fi ;;
1206: esac
1207: case "$which_graphic_lib" in
1208: *gnuplot*) ;;
1209: *)gnuplot=;;
1210: esac
1211: else # fastread = yes
1212: # TEST: --graphic was not given, X11 not found, and gnuplot library found
1213: if test "$which_graphic_lib" = none -a -z "$graph_cmd" -a -n "$gnuplot"; then
1214: which_graphic_lib=gnuplot
1215: fi
1216: if test -z "$X11" -a -z "$gnuplot" -a -z "$readline" -a "X$which_graphic_lib" != Xgnuplot-dynamic; then
1217: echo ...none
1218: fi
1.1 noro 1219: fi
1220: fi
1221:
1222: ####################### CONFIGURE - MAKE ####################################
1223: dflt=$prefix; rep=
1224: test "$fastread" = yes || cat <<EOT
1225: ==========================================================================
1226: By default, gp will be installed in $dflt/bin, manual pages under
1227: $dflt/man, etc..., with $dflt as prefix for all installation directories.
1228: If you wish to have binaries under /bin but manual pages under
1229: /usr/local/man, that's ok: you will be prompted separately for each of the
1230: installation directories, the prefix being only used to set the defaults.
1231: (You will be prompted before the actual installation is done.)
1232: The names of executables and libraries contain their version number $version.
1233: A symbolic link to gp or libpari.[a/so] will point to the most recent
1234: installation of GP/PARI.
1235: EOT
1236: echo $n "Installation prefix ? $c"
1237: . ./myread; prefix=$ans
1238:
1239: echo $n "...for architecture-independant files (share-prefix) ? $c"
1240: dflt=$share_prefix; . ./myread; share_prefix=$ans
1241:
1242: if test -z "$share_prefix"; then
1243: dfltman=$prefix/man/man1
1244: dfltall=$prefix/lib/pari
1245: else
1246: dfltman=$share_prefix/man/man1
1247: dfltall=$share_prefix/doc/pari
1248: fi
1249:
1250: echo $n ..."\"gp\" executable ? $c"
1251: dflt=${dfltbindir:-$prefix/bin}; . ./myread; bindir=$ans
1252:
1253: echo $n ..."\"pari\" library ? $c"
1254: dflt=${dfltlibdir:-$prefix/lib}; . ./myread; libdir=$ans
1255:
1256: echo $n ..."include files ? $c"
1257: dflt=${dlftincludedir:-$prefix/include/pari}; . ./myread; includedir=$ans
1258:
1259: echo $n ..."manual pages ? $c"
1260: dflt=${dfltmandir:-$dfltman}; . ./myread; mandir=$ans
1261:
1262: echo $n ..."documentation, examples, and emacs macros ? $c"
1263: dflt=${dfltmiscdir:-$dfltall}; . ./myread; miscdir=$ans
1264:
1265: if test -z "$share_prefix"; then
1266: dfltdat=$miscdir/galdata
1267: else
1268: dfltdat=$share_prefix/pari/galdata
1269: fi
1270:
1271: echo $n ..."miscellaneous data (galois resolvents) ? $c"
1272: dflt=${dfltdatadir:-$dfltdat}; . ./myread; datadir=$ans
1273:
1274: if test "$optimization" = debugging; then static=y; fi
1275: if test "$fastread" != yes; then
1276: if test -z "$DLLD"; then
1277: cat <<EOT
1278: ==========================================================================
1279: We cannot build a dynamic executable. We will build the static version.
1280: EOT
1281: else
1282: cat <<EOT
1283: ==========================================================================
1284: By default, we will try to build the shared library and gp will be an
1285: executable dynamically linked with it. Do you prefer to have the static
1286: archive libpari.a and a statically linked executable (which is a bit
1287: faster, but takes more disk place) ?
1288: You can always type "make all" in case you want both later.
1289: EOT
1290: echo $n "Do you want static executable and library ? $c"
1291: dflt=$static; rep='y n'; . ./myread; static=$ans
1292: fi
1293: fi
1294: case "$static" in
1295: y) echo "Default is static executable and archive library, graphic=$which_graphic_lib" ;;
1296: n) echo "Default is dynamic executable and shared library, graphic=$which_graphic_lib" ;;
1297: esac
1298:
1299: #
1300: # Target directory
1301: #
1302: pre=O
1303: case "$optimization" in
1304: full) objdir=$pre$osname-$arch ;;
1305: debugging) objdir=$pre$osname-$arch.dbg ;;
1306: profiling) objdir=$pre$osname-$arch.prf ;;
1307: esac
1308: if test "$fastread" != yes; then
1309: cat << EOT
1310: ==========================================================================
1311: This is the name of the directory where all the object files will be :
1312: EOT
1313: echo $n ..."Enter dir name : $c"
1314: dflt=$objdir; rep=; . ./myread
1315: objdir=$ans
1316: fi
1317:
1318: #
1319: # For dynamic linking, before and after installing
1320: #
1321: case "$osname" in
1322: *cygwin*) LDDYN="-L$libdir -lpari_dll" ; runpath="$libdir" ;
1323: DYNLIBS=-lpari_dll ; DYNFLAGS=-Dlibpari_USE_DLL ;;
1324: *) LDDYN="-L$libdir -l$libpari_base" ; runpath="$libdir" ;;
1325: esac
1326:
1327: cat << EOT
1328: ==========================================================================
1329: EOT
1330:
1331: ####################### CONFIGURE - SPIT ####################################
1332: #
1333: # Now spit out the results
1334: #
1335: cd $TOP
1336: if test ! -d $objdir; then mkdir -p $objdir; fi
1337: dflt_conf_file=$objdir/$dflt_conf_file
1338:
1339: cat > $dflt_conf_file << EOT
1340: # Config file for Pari $release -- $pretty
1341:
1342: EOT
1343: case "$osname" in
1344: os2) shell_q='"'; echo "shell_q='\"'" >> $dflt_conf_file;;
1345: *) shell_q="'"; echo "shell_q=\"'\"" >> $dflt_conf_file;;
1346: esac
1347:
1348: for variable in\
1.3 noro 1349: pari_release\
1.1 noro 1350: libpari_base version TOP config_dir src_dir emacs_dir doc_dir\
1351: bindir includedir mandir miscdir libdir datadir\
1352: optimization objdir static suffix\
1.3 noro 1353: ASMINLINE arch asmarch osname pretty prefix share_prefix\
1.1 noro 1354: __gnuc__ gnuas CPP AS ASFLAGS CC cflags DBGFLAGS OPTFLAGS LD LDFLAGS\
1355: DLLD DLSUFFIX soname sodest KERNELCPPFLAGS DLLDFLAGS EXTRADLLDFLAGS\
1356: runpath runpathprefix LDDYN LIBS DYNLIBS DYNFLAGS DYNRELOC\
1357: ranlib gzip zcat emacs perl ln_s make_sh exe_suff\
1358: readline readline_enabledp CPPF_defined rl_refresh_line_oldproto\
1359: rl_appendchar rl_genericbind rl_save_prompt _rl_save_prompt rl_message\
1360: rl_completion_matches rl_completion_func_t\
1361: RLINCLUDE RLLIBS\
1.3 noro 1362: sizeof_long doubleformat\
1.1 noro 1363: gnuplot extralib X11 Xincroot which_graphic_lib gnuplot_libs\
1.3 noro 1364: $_has_list; do
1.1 noro 1365: eval "echo $variable=\'"'$'"$variable\'" \>\> $dflt_conf_file
1366: done
1367:
1368: . $config_dir/extract_files
1369:
1370: #
1371: # Building...
1372: #
1373: cat << EOT
1374: ==========================================================================
1375: EOT
1376:
1377: echo $n "Shall we try to build pari $version.$patch ($status) now (y/n)? $c"
1378: dflt=n; rep='y n'; . $config_dir/myread
1379:
1380: case $ans in
1381: y) if (make gp); then
1382: echo $n "Shall we install the files where they belong (y/n)? $c"
1383: dflt=n; rep='y n'; . $config_dir/myread
1384: case $ans in
1385: y) make install;;
1386: n) echo "Ok. Type \"make install\" when you are ready";;
1387: esac
1388: fi;;
1389: n) echo "Ok. Type \"make install\" when you are ready";;
1390: esac
1391: echo 'Bye !'
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>