
To support special compiler and OS combinations like the Portland
compilers on Linux/x86, Compaq compilers on Linux/Alpha, and enable
shared libraries when using wrapper scripts like mpcc we are using
a prerelease version of libtool (1.4e), and the libtool.m4 script has been
patched and included at the end of acinclude.m4.

PLEASE NOTE - You NEVER have to install libtool, and autoconf/automake 
are only necessary for developers who change the Makefile.in's. You can 
find the software at ftp.gromacs.org/developers.

This file summarizes the patches/extensions we made so we can check it
if we ever update the files in GROMACS:



**********************************************************************

B. Changes in libtool-1.4e:
   All these changes should go in libtool.m4. This file is included
   in the GROMACS acinclude.m4 to make sure we use the right version.

1. I have implemented Fortran 77 support in libtool, which hopefully
   will make its way into the main distribution. This involves
   the AC_LIBTOOL_LANG_F77_CONFIG macro, and all supporting routines
   with "F77" in the name :-) 
   Since a couple of f77 compilers (ibm xlf notably) dont accept -DPIC
   I also separated the compiler flag test into one for -fPIC and
   a separate one for -DPIC.
   I have changed echo to printf for the lt_simple.. variables, to
   get the fortran formatting right.

   There is one specific Gromacs-related change that won't be a
   part of the main libtool distribution:

   I removed the --with-tags argument from _LT_AC_TAGCONFIG, 
   to fix libtool always creating the F77 and CXX macros, 
   and replaced it with a check for ac_cv_prog_**_g to determine
   whether we should use CXX and/or F77. Don't care about GCJ...
   To avoid AC_PROG_CXX always being expanded, I introduced the macro 
   inside an always-false test in our configure.ac.
  
2. To support dynamic libraries on Alpha/Linux with the Compaq Compilers,
   I have added some flag specifications in the non-gcc compiler section 
   of the AC_LIBTOOL_PROG_COMPILER_PIC macro. I added the linux*) case:

=============================================================
    irix5* | irix6* | nonstopux*)
      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
      # PIC (with -KPIC) is the default.
      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
      ;;

+  linux*)
+    # Check flags for non-gnu compilers on Linux 
+    case "$host_cpu" in
+    alpha*)
+      # The only non-gnu compiler on Linux/Alpha is the Compaq one:
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    i?86)
+      # Intel icc compiler
+      if $CC -V 2>&1 | grep 'Intel Corporation' > /dev/null 2>&1; then
+          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption,link,'
+          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        else
+          _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+        fi     
+	;;
+	
+     ia64)
+	# Intel icc compiler
+	if $CC -V 2>&1 | grep 'Intel Corporation' > /dev/null 2>&1; then
+          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption,link,'
+          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        else
+          _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+        fi     
+	;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+    ;;

    newsos6)
      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
      ;;


=====================================================================
The intel compilers echoes stupid stuff to stderr, which is interpreted
as errors when libtool checks for supported flags. As a workaround we
only grep for the actual flag tried, or the words "flag" or "option".
The modified versions of the macros are:


# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------------------
# Check whether the given compiler option works
AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
[AC_CACHE_CHECK([$1], [$2],
  [$2=no
  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $3"
   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
   if (eval $ac_compile 2>conftest.err) && test -s $ac_outfile; then 
     # Modified by Erik Lindahl:
     # Some compilers (icc, pgcc) echo stupid stuff to stderr.
     # To avoid this being interpreted as errors we check the output
     # and only fail the test if the option is present, or one of the
     # words 'option' or 'flag'.
     if test -n "$3" && grep "$3" conftest.err > /dev/null 2>&1 || grep "option" conftest.err > /dev/null 2>&1 || grep "flag" conftest.err > /dev/null 2>&1 ; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
     else
       $2=yes
     fi
   fi
   $rm conftest*
   CFLAGS="$save_CFLAGS"
])

if test x"[$]$2" = xyes; then
    ifelse([$5], , :, [$5])
else
    ifelse([$6], , :, [$6])
fi
])# AC_LIBTOOL_COMPILER_OPTION


# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
#                          [ACTION-SUCCESS], [ACTION-FAILURE])
# ------------------------------------------------------------
# Check whether the given compiler option works
AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
[AC_CACHE_CHECK([$1], [$2],
  [$2=no
   save_LDFLAGS="$LDFLAGS"
   LDFLAGS="$LDFLAGS $3"
   printf "$lt_simple_link_test_code" > conftest.$ac_ext
   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
     # The compiler can only warn and ignore the option if not recognized
     # So say no if there are warnings
     if test -n "$3" && grep "$3" conftest.err > /dev/null 2>&1 || grep "option" conftest.err > /dev/null 2>&1 || grep "flag" conftest.err > /dev/null 2>&1 ; then
       # Append any errors to the config.log.
       cat conftest.err 1>&AS_MESSAGE_LOG_FD
     else
       $2=yes
     fi
   fi
   $rm conftest*
   LDFLAGS="$save_LDFLAGS"
])

if test x"[$]$2" = xyes; then
    ifelse([$4], , :, [$4])
else
    ifelse([$5], , :, [$5])
fi
])# AC_LIBTOOL_LINKER_OPTION



===============================================================

That's it. I've submitted most patches and extensions to 
automake/libtool mailing lists, so hopefully the next release will be 
easier if they are included in future versions :-)

Erik Lindahl <lindahl@gromacs.org>, 2002-01-23
















