Migrated to the latest automake & libtool releases/prereleases, with all
[alexxy/gromacs.git] / admin / README.patches
1
2 To support special compiler and OS combinations like the Portland
3 compilers on Linux/x86, Compaq compilers on Linux/Alpha, and enable
4 shared libraries when using wrapper scripts like mpcc we are using
5 a prerelease version of libtool (1.4b), and the libtool.m4 script has been
6 patched and included at the end of acinclude.m4.
7
8 To be able to use fortran and assembly code in the libraries we
9 unfortunately also have to use a prerelease version of automake (1.4h)
10 To fix a problem with dependency tracking for Compaq Compilers on
11 Linux/Alpha we have also patched the depcomp and depend.m4 files.
12
13 PLEASE NOTE - you do NOT have to install these programs to compile GROMACS.
14 You NEVER have to install libtool, and autoconf/automake are only 
15 necessary for developers who change the Makefile.in's. You can find
16 the software at ftp.gromacs.org/developers.
17
18 This file summarizes the patches/extensions we made so we can check it
19 if we ever update the files in GROMACS:
20
21
22 *******************************************************************
23
24 A. Changes in automake-1.4h:
25 1. m4/depend.m4 - This file is not directly included in GROMACS, but
26    the macro AM_DEPENDENCIES is used when you run aclocal.
27    The depmode is erroneously identified as gcc for ccc/linux. This 
28    compiler uses the same flags as gcc, but the resulting dependency
29    file can't be included directly. Add a check where we try to 
30    include it in a makefile:
31
32 NB: This is now in the automake CVS!
33
34 m4/depend.m4:
35 =====================================================================
36     # We need to recreate these files for each test, as the compiler may
37     # overwrite some of them when testing with obscure command lines.
38     # This happens at least with the AIX C compiler.
39     echo '#include "conftest.h"' > conftest.c
40     echo 'int i;' > conftest.h
41 +    echo 'include conftest.Po' > Makefile
42
43     case $depmode in
44     nosideeffect)
45       # after this tag, mechanisms are not by side-effect, so they'll
46       # only be used when explicitly requested
47
48     case $depmode in
49     nosideeffect)
50       # after this tag, mechanisms are not by side-effect, so they'll
51       # only be used when explicitly requested
52       if test "x$enable_dependency_tracking" = xyes; then
53         continue
54       else
55         break
56       fi
57       ;;
58     none) break ;;
59     esac
60     # We check with `-c' and `-o' for the sake of the "dashmstdout"
61     # mode.  It turns out that the SunPro C++ compiler does not properly
62     # handle `-M -o', and we need to detect this.
63     if depmode=$depmode \
64        source=conftest.c object=conftest.o \
65        depfile=conftest.Po tmpdepfile=conftest.TPo \
66        $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
67 -       grep conftest.h conftest.Po > /dev/null 2>&1; then
68 +       grep conftest.h conftest.Po > /dev/null 2>&1 &&
69 +       ${MAKE-make} > /dev/null 2>&1; then
70       am_cv_$1_dependencies_compiler_type=$depmode
71       break
72     fi
73   done
74 ==========================================================================
75
76 2. The generated dependencies are named file.o.d on tru64 unix, but
77    just file.d at least on some version of ccc on Linux. Check for both
78    extensions in depcomp:
79
80 NB: This is in the automake CVS now.
81
82 lib/depcomp: (also present in GROMACS as config/depcomp)
83 ==========================================================================
84 tru64)
85    # The Tru64 AIX compiler uses -MD to generate dependencies as a side
86    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
87 +   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
88 +   # dependencies in `foo.d' instead, so we check for that too.
89    # Subdirectories are respected.
90
91 -   tmpdepfile="$object.d"
92 +   tmpdepfile1="$object.d"
93 +   tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` 
94    if test "$libtool" = yes; then
95       "$@" -Wc,-MD
96    else
97       "$@" -MD
98    fi
99
100    stat=$?
101    if test $stat -eq 0; then :
102    else
103 -      rm -f "$tmpdepfile"
104 +      rm -f "$tmpdepfile1" "$tmpdepfile2" 
105          exit $stat
106    fi
107
108 +   if test -f "$tmpdepfile1"; then
109 +     tmpdepfile="$tmpdepfile1"
110 +   else
111 +     tmpdepfile="$tmpdepfile2"
112 +   fi
113 +
114    if test -f "$tmpdepfile"; then
115       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
116       # That's a space and a tab in the [].
117       sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
118    else
119 ==================================================================
120
121
122
123
124
125
126
127 **********************************************************************
128
129 B. Changes in libtool-1.4b:
130    All these changes should go in libtool.m4. This file is included
131    in the GROMACS acinclude.m4 to make sure we use the right version.
132
133 1. I have implemented Fortran 77 support in libtool. This involves
134    the AC_LIBTOOL_LANG_F77_CONFIG macro, and all supporting routines
135    with "F77" in the name :-) 
136    Since a couple of f77 compilers (ibm xlf notably) dont accept -DPIC
137    I also separated the compiler flag test into one for -fPIC and
138    a separate one for -DPIC.
139    I have changed echo to printf for the lt_simple.. variables, to
140    get the fortran formatting right.
141    I removed the --with-tags argument from _LT_AC_TAGCONFIG, 
142    to fix libtool always creating the F77 and CXX macros, 
143    and replaced it with a check for ac_cv_prog_**_g to determine
144    whether we should use CXX and/or F77. Don't care about GCJ...
145    To avoid AC_PROG_CXX always being expanded, I introduced the macro 
146    inside an always-false test in our configure.ac.
147   
148 2. To support dynamic libraries on Alpha/Linux with the Compaq Compilers,
149    I have added some flag specifications in the non-gcc compiler section 
150    of the AC_LIBTOOL_PROG_COMPILER_PIC macro. I added the linux*) case:
151
152 =============================================================
153   irix5* | irix6*)
154     _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
155     # PIC (with -KPIC) is the default.
156     _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
157     ;;
158
159 +  linux*)
160 +    # Check flags for non-gnu compilers on Linux 
161 +    case "$host_cpu" in
162 +    alpha*)
163 +      # The only non-gnu compiler on Linux/Alpha is the Compaq one:
164 +      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
165 +      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
166 +      ;;
167 +    *)
168 +      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
169 +      ;;
170 +    esac
171 +    ;;
172
173   newsos6)
174     _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
175     _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
176     ;;
177 ===============================================================
178
179 3. When we use the mpcc wrapper script for MPI compile on aix,
180    the MPI library directory is added by the script, but the normal
181    -blibpath option to the compiler overrides all -L flags, so the
182    MPI dynamic libs are not found at runtime, although the libtool
183    script thinks dynamic libraries work.
184
185    I have worked around this by trying to link a small program, and
186    use dump -H to check for the libpath encoded in the executable.
187    This default aix libpath is extended with $libdir, and encoded
188    with -blibpath. (added AC_CHECK_AIX_LIBPATH, and four calls to it)
189    
190
191 *********************************************************************
192
193 C. Changes in config/config.guess:
194
195 The Portland compilers write "Linking:" on standard out, which
196 fscked up the host detection completely... I work around this by
197 discarding standard error too in a lot of places all over the file,
198 e.g.:   
199
200 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null >/dev/null
201
202 ********************************************************************
203
204 That's it. I've submitted all patches and extensions to 
205 automake/libtool mailing lists, so hopefully the next release will be 
206 easier if they are included in future versions :-)
207
208 Erik Lindahl <lindahl@gromacs.org>, 2001-07-17
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224