1#! /bin/sh 2# Copyright (C) 2010-2021 Free Software Foundation, Inc. 3# 4# This program is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 2, or (at your option) 7# any later version. 8# 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program. If not, see <https://www.gnu.org/licenses/>. 16 17# Make sure AC_LIBOBJ and friends work. 18# Please keep this in sync with sister test 'libobj16b.sh'. 19 20required=cc 21. test-init.sh 22 23mv configure.ac configure.proto 24cat >> configure.proto << 'END' 25AC_PROG_CC 26AM_PROG_AR 27AC_PROG_RANLIB 28%LIBOBJ-STUFF% # Will be activated later. 29AC_OUTPUT 30END 31 32cat > Makefile.am << 'END' 33noinst_LIBRARIES = libtu.a 34libtu_a_SOURCES = 35libtu_a_LIBADD = $(LIBOBJS) 36 37include extra-checks.am 38.PHONY: $(extra_checks) pre-test 39 40pre-test: distdir 41 ls -l $(srcdir) $(builddir) $(distdir) 42 $(AR) tv libtu.a 43$(extra_checks): pre-test 44check-local: $(extra_checks) 45 46maude-src: 47 grep dummy_maude $(srcdir)/maude.c 48maude-dist: 49 grep dummy_maude $(distdir)/maude.c 50liver-src: 51 grep dummy_liver $(srcdir)/liver.c 52liver-dist: 53 grep dummy_liver $(distdir)/liver.c 54liver-not-dist: distdir 55 test ! -r $(distdir)/liver.c 56maude-not-dist: distdir 57 test ! -r $(distdir)/maude.c 58maude-lib: 59 $(AR) t libtu.a | grep maude 60maude-not-lib: 61 $(AR) t libtu.a | grep maude && exit 1; exit 0 62liver-lib: 63 $(AR) t libtu.a | grep liver 64liver-not-lib: 65 $(AR) t libtu.a | grep liver && exit 1; exit 0 66END 67 68cat > maude.c << 'END' 69extern int dummy_maude; 70END 71 72cat > liver.c << 'END' 73extern int dummy_liver; 74END 75 76sed '/%LIBOBJ-STUFF%/{ 77s/.*// 78i\ 79AC_LIBOBJ([maude]) 80}' configure.proto > configure.ac 81cat configure.ac # For debugging. 82 83cat > extra-checks.am << 'END' 84extra_checks = maude-src maude-dist maude-lib liver-not-dist 85END 86 87$ACLOCAL 88$AUTOCONF 89$AUTOMAKE --add-missing 90 91./configure 92 93$MAKE 94$MAKE check 95$MAKE distcheck 96$MAKE distclean 97 98# Avoid timestamp-related differences. 99rm -rf autom4te*.cache 100 101cat > extra-checks.am << 'END' 102extra_checks = maude-src maude-dist liver-src liver-dist 103if MAUDE_COND 104extra_checks += maude-lib liver-not-lib 105else 106extra_checks += maude-not-lib liver-lib 107endif 108END 109 110sed '/%LIBOBJ-STUFF%/{ 111s/.*// 112i\ 113AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\ 114if test x"$MAUDE" = x"yes"; then\ 115 AC_LIBOBJ([maude])\ 116else\ 117 AC_LIBOBJ([liver])\ 118fi\ 119AC_LIBSOURCES([maude.c, liver.c]) 120}' configure.proto > configure.ac 121cat configure.ac # For debugging. 122 123$ACLOCAL 124$AUTOCONF 125$AUTOMAKE 126 127./configure MAUDE=yes 128$MAKE 129$MAKE check 130$MAKE distcheck 131$MAKE distclean 132 133./configure MAUDE=no 134$MAKE 135$MAKE check 136$MAKE distcheck 137$MAKE distclean 138 139: 140