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