source: ThirdParty/ASL/trunk/compile_Unix_ASL.in @ 729

Last change on this file since 729 was 725, checked in by lou, 12 years ago

Changes to build ASL on Solaris / x86. Introduce compile_Unix_ASL.in. Tweaks to
eliminate comptry.bat in compile_MS_ASL.in; solves problem with cygwin / cl.

File size: 3.0 KB
Line 
1#!/bin/sh
2
3# Script to compile the Ampl Solver Library on Unix systems. Why this approach?
4# Well, we don't want to get into the business of creating (and maintaining)
5# the full set of autotools source files for the ASL. This approach tries to
6# leverage makefile.u, which comes with ASL.
7
8# To support VPATH builds, the strategy is to copy the sources to the build
9# directory, build, and then erase the sources when we're done. Start by
10# copying the sources.
11
12# set -x
13mkinstalldirs="@install_sh@ -d"
14abs_source_dir=@abs_source_dir@
15compdir=compdir
16
17# Remove the old compilation directory, if present, and create a new one. Then
18# copy the sources. The wildcards given to ls will produce duplicates, which
19# may result in a warning as the files are linked or copied.
20
21rm -rf $compdir
22$mkinstalldirs $compdir
23files=`cd $abs_source_dir/solvers ; ls *.[chs] *.[ch]0 *.hd arith.* makefile* *.bat amplsolv.lbc`
24
25cd $compdir
26for file in $files ; do
27  @LN_S@ $abs_source_dir/solvers/$file $file
28done
29
30# Acquire the system details.
31
32sys_details=`uname -sr`
33
34sed -e "/sysdetails_ASL/s/System_details/$sys_details/" details.c0 > details.c
35
36# Adjust solvers/makefile.u for the system at hand. Really all we're doing
37# is trying to automate he instructions in makefile.u. If you have build
38# problems, a good thing to do is compare the shell code here with makefile.u,
39# to see if it contains instructions that are not automated here. The final
40# result is left in makefile.coin
41
42# Allow make to decide the name of the archive program and the appropriate
43# flags. makefile.u hardwires `ar' and sets ARFLAGS = ruv. Since we trash the
44# entire build and start from scratch, the `u' in ruv stands for `useless'.
45
46sed -e 's/\<ar\>/\$(AR)/g' \
47    -e 's/^ARFLAGS =/# ARFLAGS =/' < makefile.u > makefile.coin
48
49# If we're in a fake unix environment on a Windows box, the default compiler
50# output file is a.exe, not a.out.
51
52if test "x@EXEEXT@" = "x.exe" ; then
53  sed -e 's/a\.out/a.exe/' < makefile.coin > makefile.coin.tmp
54  mv makefile.coin.tmp makefile.coin
55fi
56
57# System-specific tweaks.
58# On Solaris x86, we need to build fpsetprec.s. Add it to the dependency list
59# for amplsolver.a
60# In the original configure.ac, there was a case here that adjusted the
61# makefile.u rule that builds details.c from details.c0. We've done that
62# above. Also, the edit rule in the original configure.ac didn't match the
63# text in makefile.u. So I'm going to leave it out and see what breaks.
64# -- lh, 071019 --
65
66case "@build@" in
67  *86-*-solaris*)
68    sed -e 's/^amplsolver.a:/amplsolver.a: fpsetprec.s/' \
69      < makefile.coin > makefile.coin.tmp
70    mv makefile.coin.tmp makefile.coin
71    ;;
72esac
73
74# That's it, we can do the build.
75# A last detail: makefile.u will try to force CC=cc. We need to make sure
76# that we stay with our chosen compiler. It will try and force CFLAGS, too, but
77# configure has already put the appropriate information into ASLMAKEFLAGS.
78
79make -f makefile.coin @ASLMAKEFLAGS@ CC=@CC@
80mv amplsolver.a ../$libampl
81mv stdio1.h arith.h funcadd0.@OBJEXT@ ..
82cd ..
83# rm -rf $compdir
84
Note: See TracBrowser for help on using the repository browser.