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