1#!/bin/sh
2
3# "configurehere" for system-specific subdirectories of ampl/solvers
4# Originally written by David M. Gay at Sandia National Labs, where it
5# was Approved for Unclassified-Unlimited release: SAND Number 2005-7813P
6# Modified to remove a now unnecessary test.
7
8## Invoke ./configurehere
9## (no args) to create makefile from makefile.u for compiling amplsolver.a
10## in this directory.  Then invoke "make -r" to compile amplsolver.a
11## Specify CC before ./configurehere to adjust the CC setting in makefile.
12## Specify CFLAGS before ./configurehere to adjust CFLAGS setting in the
13## makefile.  CFLAGS may be further adjusted by tests done below.
14
15if [ -f makefile ]; then make clean; rm makefile; fi
16
17case $CFLAGS in '') CFLAGS='-O';; esac
18
19# For Cygwin or MinGW/MSYS...
20EXEmodify=""
21case $WINDIR in C:*)
22	case $CC in "") CC=gcc;; esac
23	EXEmodify=";s!a\\.out!a.exe!";;
24	esac
25
26${CC=cc} -c xectim.c 2>/dev/null && rm xectim.o || CFLAGS="$CFLAGS -DNO_RUSAGE"
27
28SC="s!^CC = cc!CC = $CC!$EXEmodify"
29
30case `uname -m` in
31	alpha) if cc --version 2>/dev/null | sed 1q | grep -q GCC
32		then CFLAGS="$CFLAGS -mieee"
33		else CFLAGS="$CFLAGS -ieee_with_no_inexact"
34		fi;;
35	esac
36
37case `uname -s` in
38	AIX) CFLAGS="$CFLAGS -qnomaf";;
39	Darwin) CFLAGS="$CFLAGS -D_NONSTD_SOURCE";;
40	SunOS) case `uname -i` in
41		i386)  SC="$SC;s/^a = \\\\$/a = fpsetprec.s \\\\/";;
42		i86pc) SC="$SC;s/^a = \\\\$/a = fpsetprec64.s \\\\/";;
43		esac;;
44	CYGWIN_*) case $EXEmodify in "") SC="$SC;s/a\.out/a.exe/";; esac;;
45	esac
46
47case $CFLAGS in -O);; *) SC="$SC;s@^CFLAGS = -O@CFLAGS = $CFLAGS@";; esac
48
49sed "$SC" makefile.u >makefile
50