[BACK]Return to Configure CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2

Annotation of OpenXM_contrib/pari-2.2/Configure, Revision 1.3

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:         "
        !           874:        cygtop=/
        !           875:         else
        !           876: # cygnus for version 0.*
        !           877:        libpth="
        !           878:            $cygtop/H-${arch}-cygwin32/lib\
        !           879:            $cygtop/H-${arch}-cygwin32/${arch}-cygwin32/lib\
        !           880:         "
        !           881:        fi;;
        !           882:     os2) libpth=`echo $LIBRARY_PATH | sed 's/;/ /g' | sed 's,\\\\,/,g'`;;
        !           883:     *) libpth="\
        !           884:        /usr/local/lib\
        !           885:        /lib\
        !           886:        /usr/lib\
        !           887:        /opt/lib\
        !           888:        /opt/local/lib\
        !           889:        /opt/gnu/lib\
        !           890:        /lib/pa1.1\
        !           891:        /usr/lib/large\
        !           892:        /lib/large\
        !           893:        /usr/lib/small\
        !           894:        /lib/small\
        !           895:        /usr/ccs/lib\
        !           896:        /usc/ucblib\
        !           897:        /usr/shlib\
        !           898:        .\
        !           899:      ";;
        !           900:   esac
1.1       noro      901:
1.3     ! noro      902:   tdir=$osname-$arch-X11$$
        !           903:   mkdir $tdir; cp Imakefile $tdir; cd $tdir
        !           904:   if (xmkmf) >/dev/null 2>&1 && test -f Makefile; then
        !           905:     eval `make gp-X11 2> /dev/null | grep -v make`
        !           906:     rm -f Makefile Makefile.bak
        !           907:     x11pth="$usrlibdir $libdir";
        !           908:   fi
        !           909:   cd ..; rm -rf $tdir
1.1       noro      910:
1.3     ! noro      911: # We want these libraries:
1.1       noro      912: #
1.3     ! noro      913:   echo Checking for optional libraries and headers...
        !           914:
        !           915: # ========  GRAPHICS environment search  ==============
        !           916:
        !           917: # At this moment $which_graphic_lib is either none, or the argument to
        !           918: # --graphic option; $graph_cmd is "" unless --graphic option was specified.
        !           919:
        !           920: #   LIB: X11
        !           921:   pth=$x11pth
        !           922:   lib=X11; . ./locatelib
        !           923:   if test -f $Xincroot/X11/Xos.h -a -z "$graph_cmd"; then
        !           924:     which_graphic_lib=X11
        !           925:     test -n "$extralib" && echo ..."Extra Libraries are $extralib"
        !           926:     echo ..."Found X11 header files in $Xincroot/X11"
        !           927:   fi
        !           928:
        !           929: #   LIB: gnuplot
        !           930: #   Look for it unconditionally, without read/write of
        !           931: #     $which_graphic_lib or $graph_cmd
        !           932:   pth="$TOP/gnuplot-$osname-$arch $TOP/gnuplot\
        !           933:        $TOP/../gnuplot-$osname-$arch $TOP/../gnuplot\
        !           934:        $TOP/../../gnuplot-$osname-$arch $TOP/../../gnuplot $libpth"
        !           935:   lib=gnuplot; . ./locatelib
        !           936:   gnuplot_fullpath="$try"
        !           937:   gnuplot_libs=
        !           938:   case $gnuplot in
        !           939:     /*|[c-z]:/*)
        !           940:         addgnuplot=gnuplot
        !           941:        for lib in vga vesa jmgraph linuxvga gd png z
        !           942:        do
        !           943:            . ./locatelib
        !           944:            eval "elib=\$$lib"
        !           945:            case $elib in
        !           946:              /*|[c-z]:/*) gnuplot_libs="$gnuplot_libs -l$lib";;
        !           947:            esac
        !           948:        done
        !           949:        if test "$which_graphic_lib" = gnuplot; then
        !           950:            if test -z "$gnuplot_libs"; then
        !           951:                echo "...I expect that no libraries are needed for gnuplot"
        !           952:            else
        !           953:                echo "...I expect that libraries $gnuplot_libs are needed for gnuplot"
        !           954:            fi
        !           955:        fi
        !           956:        ;;
        !           957:     *)
        !           958:        if test "$which_graphic_lib" = gnuplot; then
        !           959:             pth=`echo $pth | sed -e "s,$TOP,.,g"`
        !           960:            echo "###"
        !           961:            echo "### Could not find gnuplot library in $pth"
        !           962:            echo "###"
        !           963:            case "$osname" in
        !           964:                os2) tlib=gnuplot.a ;;
        !           965:                *)   tlib=libgnuplot.a ;;
        !           966:            esac
        !           967:            echo "### You may need to execute"
        !           968:            echo "###   ar cr $tlib version.o util.o term.o bitmap.o stdfn.o"
        !           969:            echo "### In the build directory of gnuplot-3.7, and move"
        !           970:            echo "### $tlib to ./gnuplot-$osname-$arch or ./gnuplot subdirs"
        !           971:            echo "### or to similarly-named directories up the directory tree."
        !           972:            echo "###"
        !           973:        fi
        !           974:        ;;
        !           975:   esac
        !           976:
        !           977: # ========  END of GRAPHICS environment search  ==============
1.1       noro      978:
1.3     ! noro      979: #   LIB: GNU ReadLine
        !           980:   readline_add="$GP_READLINE $TOP/readline-$osname-$arch $TOP/readline"
        !           981:   pth="$readline_add $libpth"
        !           982:   lib=readline; . ./locatelib
        !           983:   rl_fullname=$try
1.1       noro      984:
1.3     ! noro      985:   if test -n "$readline"; then
        !           986: # Readline -- Headers
        !           987:     case "$osname" in
        !           988:       os2) incpth=`echo $C_INCLUDE_PATH | sed -e 's/\([^;]\)$/\1;/g' -e 's%;%/readline %g' -e 's,\\\\,/,g'` ;;
        !           989:       cygwin*) incpth="\
        !           990:        $cygtop/usr/local/include/readline\
        !           991:        $cygtop/usr/local/include\
        !           992:        $cygtop/usr/include/readline\
        !           993:        $cygtop/usr/include\
        !           994:        $cygtop/H-${arch}-cygwin32/${arch}-cygwin32/include\
        !           995:      ";;
        !           996:       *) incpth="\
        !           997:       /usr/local/include/readline\
        !           998:       /usr/include/readline\
        !           999:       /opt/include/readline\
        !          1000:       /opt/local/include/readline\
        !          1001:       /opt/gnu/include/readline\
        !          1002:       /usr/unsupported/include/readline\
        !          1003:       /usr/local/include\
        !          1004:       /usr/include\
        !          1005:       /opt/include\
        !          1006:       /opt/local/include\
        !          1007:       /opt/gnu/include\
        !          1008:     ";;
        !          1009:     esac
        !          1010:     pth="$readline_add $incpth"
        !          1011:     x=`./locate 'readline.h' '' $pth`
        !          1012:     CPPF_defined=
        !          1013:     case $x in
        !          1014:      ?:/*|/*) rl_include=`echo $x | sed 's,/readline.h,,'`
        !          1015:          echo ..."Found readline header in $rl_include"
        !          1016:          if (grep CPPFunction $x > /dev/null 2>&1); then CPPF_defined=yes; fi
        !          1017:          if (grep rl_message  $x > /dev/null 2>&1); then rl_message=yes; fi
        !          1018:          if (grep rl_completion_matches $x > /dev/null 2>&1); then
        !          1019:            rl_completion_matches=yes;
        !          1020:          fi
        !          1021:          if (grep rl_completion_func_t $x > /dev/null 2>&1); then
        !          1022:            rl_completion_func_t=yes;
        !          1023:          fi
        !          1024:          if (grep "rl_refresh_line *()" $x > /dev/null 2>&1); then
        !          1025:            rl_refresh_line_oldproto=yes
        !          1026:          fi
        !          1027:          if (grep rl_completion_append_character $x > /dev/null 2>&1); then
        !          1028:            rl_appendchar=yes
        !          1029:          fi
        !          1030:          if (grep rl_generic_bind $x > /dev/null 2>&1); then
        !          1031:            rl_genericbind=yes
        !          1032:          fi
        !          1033:          if (grep rl_save_prompt $x > /dev/null 2>&1); then
        !          1034:            rl_save_prompt=yes;
        !          1035:          else # might be defined but not declared (old readline)
        !          1036:           lib=$rl_fullname; sym=rl_save_prompt; . ./locatesymbol
        !          1037:           _rl_save_prompt=$try
        !          1038:          fi;;
        !          1039:       *) echo ..."But no header file has been found"
        !          1040:          readline=;;
1.1       noro     1041:     esac
                   1042:   fi
                   1043:
1.3     ! noro     1044:   pth="$readline_add $libpth"
        !          1045:   if test -n "$readline"; then
        !          1046: # Readline -- Allocation
        !          1047:     lib=$rl_fullname; sym=alloca; . ./locatesymbol
        !          1048:     if test -n "$try"; then # alloca needed
        !          1049:       lib=iberty; . ./locatelib
        !          1050:       rl_liberty="$try"
        !          1051:     fi
        !          1052: # Readline -- TermCap
        !          1053:     lib=$rl_fullname; sym=tgetent; . ./locatesymbol
        !          1054:     need_tgetent="$try"
        !          1055:     if test -n "$need_tgetent"; then
        !          1056:       lib=ncurses; . ./locatelib
        !          1057:       if test -n "$try"; then # ncurses found. Does it contain tgetent ?
        !          1058:         lib=$try; . ./locatesymbol
        !          1059:       fi
        !          1060:       if test -n "$try"; then
        !          1061:         rl_ncurses=$ncurses
        !          1062:         need_tgetent=
        !          1063:       else # give termcap a try
        !          1064:         lib=termcap; . ./locatelib
        !          1065:         if test -n "$try"; then
        !          1066:           rl_termcap=$termcap
        !          1067:           need_tgetent=
        !          1068:         fi
        !          1069:       fi
        !          1070:     fi
        !          1071: # Readline -- CFLAGS
        !          1072:     if (echo $rl_include | grep "readline$" > /dev/null); then
        !          1073:       rl_include=`echo $rl_include | sed 's,/readline$,,'`
        !          1074:       RLINCLUDE="-I$rl_include"
        !          1075:     else # in case headers are not installed correctly
        !          1076:       RLINCLUDE="-I$rl_include -DREADLINE_LIBRARY"
        !          1077:     fi
        !          1078:     RLLIBS="-L$readline -lreadline"
        !          1079:     if test -n "$rl_ncurses"; then
        !          1080:       echo ..."Library ncurses needed by readline"
        !          1081:       RLLIBS="$RLLIBS -L$rl_ncurses -lncurses"
        !          1082:     fi
        !          1083:     if test -n "$rl_termcap"; then
        !          1084:       echo ..."Library termcap needed by readline"
        !          1085:       RLLIBS="$RLLIBS -L$rl_termcap -ltermcap"
        !          1086:     fi
        !          1087:     if test -n "$rl_liberty"; then
        !          1088:       echo ..."Library liberty needed by readline"
        !          1089:       RLLIBS="$RLLIBS -L$rl_liberty -liberty"
        !          1090:     fi
        !          1091: # Readline -- last chance for tgetent
        !          1092:     if test -n "$need_tgetent"; then # try to compile anyway (in libc?)
        !          1093:       list=readline; extra_flags="$RLLIBS $RLINCLUDE"; ./look
        !          1094:       if test "$has_readline" = no; then
        !          1095:         echo "cannot use readline: please install libncurses or libtermcap."
        !          1096:         readline=
        !          1097:       fi
        !          1098:     fi
1.1       noro     1099:   fi
                   1100:
1.3     ! noro     1101:   if test -z "$readline"; then
        !          1102:     echo "### Building without GNU readline support"
        !          1103:   else
        !          1104:     if test "$fastread" = yes; then
        !          1105:       exe=$osname-$arch-rlv$$
        !          1106:       $CC $extraflag $RLINCLUDE -o $exe rl_version.c $RLLIBS 2> /dev/null
        !          1107:       if test -r $exe; then readline=`$exe`; else readline=1.0; fi
        !          1108:       rm -f $exe $exe$exe_suff
        !          1109:       echo "Using GNU readline, version $readline"
        !          1110:     fi
        !          1111:     if test -z "$rl_appendchar"; then
        !          1112:       echo ..."Library readline does not have completion_append_char"
        !          1113:     fi
        !          1114:     if test -z "$rl_genericbind"; then
        !          1115:       echo ..."Library readline does not have rl_generic_bind"
        !          1116:     fi
        !          1117:     if test -z "$rl_save_prompt"; then
        !          1118:       echo ..."Library readline does not have rl_save_prompt"
        !          1119:       if test -n "$_rl_save_prompt"; then
        !          1120:         echo ......"but it has _rl_save_prompt"
        !          1121:       fi
        !          1122:     fi
1.1       noro     1123:
1.3     ! noro     1124:     if test "$fastread" != yes; then
        !          1125:       cat << EOM
1.1       noro     1126: ==========================================================================
1.3     ! noro     1127: EOM
        !          1128:       echo $n "Do you want to use GNU readline library within GP ? $c"
        !          1129:       rep='y n'; dflt=y; . ./myread
        !          1130:       case $ans in
        !          1131:         n) readline=;;
        !          1132:       esac
        !          1133:     fi
        !          1134:   fi
1.1       noro     1135:
1.3     ! noro     1136:   if test -n "$readline"; then readline_enabledp="t"; fi
1.1       noro     1137:
1.3     ! noro     1138: #  Graphic libs now.
1.1       noro     1139: #
1.3     ! noro     1140:   if test "$fastread" != yes; then
        !          1141:     if test -n "$X11"; then addX11="X11 builtin.X11-gnuplot-dynamic"; fi
        !          1142:     if test -n "$X11" -a -n "$addgnuplot"; then
        !          1143:        addX11="$addX11 builtin.X11-gnuplot"
        !          1144:     fi
        !          1145:     cat << EOT
        !          1146: ==========================================================================
        !          1147: GP contains high resolution plotting functions. Choose among
        !          1148:        none       $addX11         $addgnuplot  gnuplot-dynamic
1.1       noro     1149: EOT
1.3     ! noro     1150:     echo $n ..."Use which graphic library (\"none\" means no hi-res plot) ? $c"
        !          1151:     rep="none $addX11 $addgnuplot gnuplot-dynamic";
        !          1152:     dflt=$which_graphic_lib; . ./myread
        !          1153:     which_graphic_lib=$ans
1.1       noro     1154:
1.3     ! noro     1155:   case "$which_graphic_lib" in
        !          1156:     *X11*)
        !          1157:       # If xmkmf did not give the right answer
        !          1158:       # X11 -- Headers
        !          1159:       if test ! -f $Xincroot/X11/Xos.h; then
        !          1160:         x11pth="\
        !          1161:           /usr/openwin/share/lib\
        !          1162:           /usr/openwin/lib\
        !          1163:           /usr/X11R6/lib\
        !          1164:           /usr/X11R5/lib\
        !          1165:           /usr/X11R4/lib\
        !          1166:           /usr/lib/X11R6\
        !          1167:           /usr/lib/X11R5\
        !          1168:           /usr/lib/X11R4\
        !          1169:           /usr/local/X11R6/lib\
        !          1170:           /usr/local/X11R5/lib\
        !          1171:           /usr/local/X11R4/lib\
        !          1172:           /usr/local/lib/X11R6\
        !          1173:           /usr/local/lib/X11R5\
        !          1174:           /usr/local/lib/X11R4\
        !          1175:           /usr/X11/lib\
        !          1176:           /usr/lib/X11\
        !          1177:           /usr/local/X11/lib\
        !          1178:           /usr/local/lib/X11\
        !          1179:           /usr/X386/lib\
        !          1180:           /usr/x386/lib\
        !          1181:           /usr/XFree86/lib/X11\
        !          1182:           /usr/lib\
        !          1183:           /usr/local/lib\
        !          1184:           /usr/unsupported/lib\
        !          1185:           /usr/athena/lib\
        !          1186:           /usr/local/x11r5/lib\
        !          1187:           /usr/lpp/Xamples/lib\
        !          1188:         ";
        !          1189:         pth=`echo $x11pth | s,/lib,/include,g`
        !          1190:         x=`./locate X11/Xos.h '' $pth`
        !          1191:         case $x in
        !          1192:          /*) Xincroot=`echo $x | sed 's,/X11/Xos.h,,'`;;
        !          1193:          *)  Xincroot=;;
        !          1194:         esac
        !          1195:         if test -n "$Xincroot"; then
        !          1196:           echo ..."Found X11 header files in $Xincroot/X11"
        !          1197:         fi
        !          1198:       fi
        !          1199:       # X11 -- Lib
        !          1200:       if test -f $Xincroot/X11/Xos.h -a -z "$X11"; then
        !          1201:         pth=$x11pth;
        !          1202:         lib=X11; . ./locatelib
        !          1203:       fi ;;
        !          1204:   esac
        !          1205:   case "$which_graphic_lib" in
        !          1206:     *gnuplot*) ;;
        !          1207:     *)gnuplot=;;
        !          1208:   esac
        !          1209:   else # fastread = yes
        !          1210:     # TEST: --graphic was not given, X11 not found, and gnuplot library found
        !          1211:     if test "$which_graphic_lib" = none -a -z "$graph_cmd" -a -n "$gnuplot"; then
        !          1212:       which_graphic_lib=gnuplot
        !          1213:     fi
        !          1214:     if test -z "$X11" -a -z "$gnuplot" -a -z "$readline" -a "X$which_graphic_lib" != Xgnuplot-dynamic; then
        !          1215:       echo ...none
        !          1216:     fi
1.1       noro     1217:   fi
                   1218: fi
                   1219:
                   1220: ####################### CONFIGURE - MAKE ####################################
                   1221: dflt=$prefix; rep=
                   1222: test "$fastread" = yes || cat <<EOT
                   1223: ==========================================================================
                   1224: By default, gp will be installed in $dflt/bin, manual pages under
                   1225:   $dflt/man, etc..., with $dflt as prefix for all installation directories.
                   1226:   If you wish to have binaries under /bin but manual pages under
                   1227:   /usr/local/man, that's ok: you will be prompted separately for each of the
                   1228:   installation directories, the prefix being only used to set the defaults.
                   1229:   (You will be prompted before the actual installation is done.)
                   1230: The names of executables and libraries contain their version number $version.
                   1231:   A symbolic link to gp or libpari.[a/so] will point to the most recent
                   1232:   installation of GP/PARI.
                   1233: EOT
                   1234: echo $n "Installation prefix ? $c"
                   1235: . ./myread; prefix=$ans
                   1236:
                   1237: echo $n "...for architecture-independant files (share-prefix) ? $c"
                   1238: dflt=$share_prefix; . ./myread; share_prefix=$ans
                   1239:
                   1240: if test -z "$share_prefix"; then
                   1241:   dfltman=$prefix/man/man1
                   1242:   dfltall=$prefix/lib/pari
                   1243: else
                   1244:   dfltman=$share_prefix/man/man1
                   1245:   dfltall=$share_prefix/doc/pari
                   1246: fi
                   1247:
                   1248: echo $n ..."\"gp\" executable ? $c"
                   1249: dflt=${dfltbindir:-$prefix/bin}; . ./myread; bindir=$ans
                   1250:
                   1251: echo $n ..."\"pari\" library ? $c"
                   1252: dflt=${dfltlibdir:-$prefix/lib}; . ./myread; libdir=$ans
                   1253:
                   1254: echo $n ..."include files ? $c"
                   1255: dflt=${dlftincludedir:-$prefix/include/pari}; . ./myread; includedir=$ans
                   1256:
                   1257: echo $n ..."manual pages ? $c"
                   1258: dflt=${dfltmandir:-$dfltman}; . ./myread; mandir=$ans
                   1259:
                   1260: echo $n ..."documentation, examples, and emacs macros ? $c"
                   1261: dflt=${dfltmiscdir:-$dfltall}; . ./myread; miscdir=$ans
                   1262:
                   1263: if test -z "$share_prefix"; then
                   1264:   dfltdat=$miscdir/galdata
                   1265: else
                   1266:   dfltdat=$share_prefix/pari/galdata
                   1267: fi
                   1268:
                   1269: echo $n ..."miscellaneous data (galois resolvents) ? $c"
                   1270: dflt=${dfltdatadir:-$dfltdat}; . ./myread; datadir=$ans
                   1271:
                   1272: if test "$optimization" = debugging; then static=y; fi
                   1273: if test "$fastread" != yes; then
                   1274:   if test -z "$DLLD"; then
                   1275:     cat <<EOT
                   1276: ==========================================================================
                   1277: We cannot build a dynamic executable. We will build the static version.
                   1278: EOT
                   1279:   else
                   1280:     cat <<EOT
                   1281: ==========================================================================
                   1282: By default, we will try to build the shared library and gp will be an
                   1283:   executable dynamically linked with it. Do you prefer to have the static
                   1284:   archive libpari.a and a statically linked executable (which is a bit
                   1285:   faster, but takes more disk place) ?
                   1286: You can always type "make all" in case you want both later.
                   1287: EOT
                   1288:   echo $n "Do you want static executable and library ? $c"
                   1289:   dflt=$static; rep='y n'; . ./myread; static=$ans
                   1290:   fi
                   1291: fi
                   1292: case "$static" in
                   1293:   y) echo "Default is static executable and archive library, graphic=$which_graphic_lib" ;;
                   1294:   n) echo "Default is dynamic executable and shared library, graphic=$which_graphic_lib" ;;
                   1295: esac
                   1296:
                   1297: #
                   1298: # Target directory
                   1299: #
                   1300: pre=O
                   1301: case "$optimization" in
                   1302:   full)      objdir=$pre$osname-$arch ;;
                   1303:   debugging) objdir=$pre$osname-$arch.dbg ;;
                   1304:   profiling) objdir=$pre$osname-$arch.prf ;;
                   1305: esac
                   1306: if test "$fastread" != yes; then
                   1307:   cat << EOT
                   1308: ==========================================================================
                   1309: This is the name of the directory where all the object files will be :
                   1310: EOT
                   1311:   echo $n ..."Enter dir name : $c"
                   1312:   dflt=$objdir; rep=; . ./myread
                   1313:   objdir=$ans
                   1314: fi
                   1315:
                   1316: #
                   1317: # For dynamic linking, before and after installing
                   1318: #
                   1319: case "$osname" in
                   1320:   *cygwin*) LDDYN="-L$libdir -lpari_dll" ; runpath="$libdir" ;
                   1321:            DYNLIBS=-lpari_dll ; DYNFLAGS=-Dlibpari_USE_DLL ;;
                   1322:   *)        LDDYN="-L$libdir -l$libpari_base" ; runpath="$libdir" ;;
                   1323: esac
                   1324:
                   1325: cat << EOT
                   1326: ==========================================================================
                   1327: EOT
                   1328:
                   1329: ####################### CONFIGURE - SPIT ####################################
                   1330: #
                   1331: #  Now spit out the results
                   1332: #
                   1333: cd $TOP
                   1334: if test ! -d $objdir; then mkdir -p $objdir; fi
                   1335: dflt_conf_file=$objdir/$dflt_conf_file
                   1336:
                   1337: cat > $dflt_conf_file << EOT
                   1338: # Config file for Pari $release -- $pretty
                   1339:
                   1340: EOT
                   1341: case "$osname" in
                   1342:   os2) shell_q='"'; echo "shell_q='\"'" >> $dflt_conf_file;;
                   1343:     *) shell_q="'"; echo "shell_q=\"'\"" >> $dflt_conf_file;;
                   1344: esac
                   1345:
                   1346: for variable in\
1.3     ! noro     1347:   pari_release\
1.1       noro     1348:   libpari_base version TOP config_dir src_dir emacs_dir doc_dir\
                   1349:   bindir includedir mandir miscdir libdir datadir\
                   1350:   optimization objdir static suffix\
1.3     ! noro     1351:   ASMINLINE arch asmarch osname pretty prefix share_prefix\
1.1       noro     1352:   __gnuc__ gnuas CPP AS ASFLAGS CC cflags DBGFLAGS OPTFLAGS LD LDFLAGS\
                   1353:   DLLD DLSUFFIX soname sodest KERNELCPPFLAGS DLLDFLAGS EXTRADLLDFLAGS\
                   1354:   runpath runpathprefix LDDYN LIBS DYNLIBS DYNFLAGS DYNRELOC\
                   1355:   ranlib gzip zcat emacs perl ln_s make_sh exe_suff\
                   1356:   readline readline_enabledp CPPF_defined rl_refresh_line_oldproto\
                   1357:   rl_appendchar rl_genericbind rl_save_prompt _rl_save_prompt rl_message\
                   1358:   rl_completion_matches rl_completion_func_t\
                   1359:   RLINCLUDE RLLIBS\
1.3     ! noro     1360:   sizeof_long doubleformat\
1.1       noro     1361:   gnuplot extralib X11 Xincroot which_graphic_lib gnuplot_libs\
1.3     ! noro     1362:   $_has_list; do
1.1       noro     1363:   eval "echo $variable=\'"'$'"$variable\'" \>\> $dflt_conf_file
                   1364: done
                   1365:
                   1366: . $config_dir/extract_files
                   1367:
                   1368: #
                   1369: #  Building...
                   1370: #
                   1371: cat << EOT
                   1372: ==========================================================================
                   1373: EOT
                   1374:
                   1375: echo $n "Shall we try to build pari $version.$patch ($status) now (y/n)? $c"
                   1376: dflt=n; rep='y n'; . $config_dir/myread
                   1377:
                   1378: case $ans in
                   1379: y) if (make gp); then
                   1380:      echo $n "Shall we install the files where they belong (y/n)? $c"
                   1381:      dflt=n; rep='y n'; . $config_dir/myread
                   1382:      case $ans in
                   1383:        y) make install;;
                   1384:        n) echo "Ok. Type \"make install\" when you are ready";;
                   1385:      esac
                   1386:    fi;;
                   1387: n) echo "Ok. Type \"make install\" when you are ready";;
                   1388: esac
                   1389: echo 'Bye !'

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>