Home | History | Annotate | Line # | Download | only in tests
      1 #							-*- Autotest -*-
      2 
      3 AT_BANNER([Compatibility with other tools.])
      4 
      5 # Copyright (C) 2000-2007, 2009-2012 Free Software Foundation, Inc.
      6 #
      7 # This program is free software: you can redistribute it and/or modify
      8 # it under the terms of the GNU General Public License as published by
      9 # the Free Software Foundation, either version 3 of the License, or
     10 # (at your option) any later version.
     11 #
     12 # This program is distributed in the hope that it will be useful,
     13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 # GNU General Public License for more details.
     16 #
     17 # You should have received a copy of the GNU General Public License
     18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     19 
     20 
     21 ## --------- ##
     22 ## Libtool.  ##
     23 ## --------- ##
     24 
     25 AT_SETUP([Libtool])
     26 
     27 # Skip this test if there is no libtoolize.
     28 AT_CHECK([libtoolize --version || exit 77],
     29 	 [ignore], [ignore], [ignore])
     30 # Modern Libtool has further tests for compatibility with older autoconf;
     31 # from the Autoconf side, we will merely assume newer libtool.
     32 AT_CHECK([[
     33 case `libtoolize --version |
     34       sed -n '/^.* \([0-9][0-9.a-z]*\)$/{
     35 		s//\1/
     36 		p
     37 		q
     38 	}'` in
     39   0.*    ) exit 77;;
     40   1.*    ) exit 77;;
     41 esac]],
     42 	 [ignore], [ignore], [ignore])
     43 
     44 # Using a configure.ac, have libtoolize confess where libtool.m4 is.
     45 AT_DATA([configure.ac],
     46 [[AC_INIT
     47 # State that we explicitly want auxiliary files here, so libtoolize
     48 # won't pollute files outside the test directory.
     49 AC_CONFIG_AUX_DIR([.])
     50 AC_PROG_LIBTOOL
     51 ]])
     52 AT_CHECK([libtoolize -i], [0], [stdout], [ignore])
     53 
     54 # Some broken libtoolize fail to install a functional config.guess.
     55 AT_CHECK([./config.guess || exit 77], [], [ignore], [ignore])
     56 
     57 # Make sure at-path contains something valid, and let the test suite
     58 # display it when verbose.  And fail, skipping would too easily hide
     59 # problems.
     60 AT_CHECK([sed -n ["s,^.*\`\\(/[^']*\\)'.*,\\1,p"] stdout], [0], [stdout])
     61 AT_CHECK([test -f "`sed -n 1p stdout`"])
     62 
     63 # Older libtoolize installed everything but install-sh...
     64 AT_CHECK([test -f install-sh || touch install-sh])
     65 
     66 # Build the concatenation of libtool.m4 and configure.ac.
     67 AT_CHECK([[sed 's/.*/m4''_include([&])/' stdout]], [0], [stdout])
     68 AT_CHECK([mv stdout aclocal.m4])
     69 cat >configure.ac <<_EOF
     70 AC_INIT
     71 AC_CONFIG_AUX_DIR([.])
     72 AC_CANONICAL_SYSTEM
     73 AC_PROG_LIBTOOL
     74 _EOF
     75 
     76 # FIXME: Once Libtool really fixed, stop ignoring stderr.
     77 AT_CHECK_AUTOCONF([], [], [], [ignore])
     78 
     79 # Ignore stderr, because ltconfig always loads the cache, which is
     80 # /dev/null, and some shells choke on this.  For instance with Bash
     81 # 2.05, you get:
     82 #
     83 #   loading cache /dev/null within ltconfig
     84 #   ./ltconfig: .: /dev/null: not a regular file
     85 #
     86 # But the script executes properly.
     87 AT_CHECK_CONFIGURE([], [], [], [ignore])
     88 
     89 AT_CLEANUP
     90 
     91 
     92 AT_SETUP([shtool])
     93 
     94 AT_DATA([configure.ac],
     95 [[AC_INIT([shtool test], [1.0])
     96 AC_CONFIG_AUX_DIR([build-aux])
     97 AC_PATH_PROG([SHTOOL], [shtool], [false])
     98 AC_PROG_INSTALL
     99 AC_SUBST([ac_install_sh])
    100 AC_CONFIG_FILES([Makefile])
    101 AC_OUTPUT
    102 ]])
    103 
    104 AT_DATA([Makefile.in],
    105 [[SHTOOL = @SHTOOL@
    106 # fake these, so that we use shtool wherever possible.
    107 INSTALL_PROGRAM = $(ac_install_sh)
    108 INSTALL_DATA = $(ac_install_sh) -m 644
    109 prefix = @prefix@
    110 ac_install_sh = @ac_install_sh@
    111 
    112 install:
    113 	$(INSTALL_PROGRAM) file1 $(prefix)/file1
    114 	$(INSTALL_DATA) file2 $(prefix)/file2
    115 
    116 copy-shtool:
    117 	test '$(SHTOOL)' != false
    118 	cp '$(SHTOOL)' build-aux
    119 ]])
    120 
    121 : >file1
    122 : >file2
    123 chmod +x file1
    124 : "${MAKE=make}"
    125 mkdir build-aux inst
    126 instdir=`pwd`/inst
    127 AT_CHECK_AUTOCONF
    128 cp "$abs_top_srcdir/build-aux/install-sh" build-aux
    129 AT_CHECK_CONFIGURE
    130 AT_CHECK([$MAKE copy-shtool], [], [ignore], [ignore],
    131 	 [AT_CHECK([: >build-aux/shtool])])
    132 rm -f build-aux/install-sh
    133 AT_CHECK_CONFIGURE([--prefix="$instdir" ac_cv_path_SHTOOL=false])
    134 AT_CHECK([grep '^ac_install_sh = .*shtool install -c' Makefile], [], [ignore])
    135 if test -s build-aux/shtool; then
    136   AT_CHECK([$MAKE install], [], [ignore], [ignore])
    137   AT_CHECK([test -f inst/file1 && test -f inst/file2 && test -x inst/file1])
    138 fi
    139 
    140 AT_CLEANUP
    141