Commit ff2eefb9 authored by Ralf Müller's avatar Ralf Müller
Browse files

Remove m4 library from ScalES-PPM project (DKRZ)

Add libtool support for linking cdo (refs #82)
Make use of CDI's m4 library for configure options
Use Json file for saving/representing configuration status (refs #371)
parent 531508b2
......@@ -10,13 +10,16 @@
/README -text
/acinclude.m4 -text
/aclocal.m4 -text
/cdo.settings.in -text
/cdo.spec -text
/cdo.spec.in -text
config/compile -text
config/config.guess -text
config/config.sub -text
config/default -text
config/depcomp -text
config/install-sh -text
config/ltmain.sh -text
config/missing -text
config/mkinstalldirs -text
/configure -text
......@@ -236,40 +239,7 @@ doc/tex/ref_intro_transf.tex -text
doc/tex/time.tex -text
doc/tex/usage.tex -text
doc/tex/zaxis.tex -text
m4/ac_fc_freeform.m4 -text
m4/ac_lang_program_fortran.m4 -text
m4/acx_assert_lang_is_fortran_variant.m4 -text
m4/acx_c_check_sizeof_gt_relation.m4 -text
m4/acx_c_package.m4 -text
m4/acx_check_doxygen_layout.m4 -text
m4/acx_fc_integer_size.m4 -text
m4/acx_fc_library_ldflags.m4 -text
m4/acx_fc_real_size.m4 -text
m4/acx_fc_type_kinds.m4 -text
m4/acx_fortran2003_kinds.m4 -text
m4/acx_fortran_check_libfunc.m4 -text
m4/acx_fortran_check_module.m4 -text
m4/acx_fortran_package.m4 -text
m4/acx_lang_c_check_include.m4 -text
m4/acx_lang_check_include.m4 -text
m4/acx_lang_fortran_check_include.m4 -text
m4/acx_lang_other_suffix_conftest.m4 -text
m4/acx_lang_package.m4 -text
m4/acx_m4_generate_subsets.m4 -text
m4/acx_machine_config.m4 -text
m4/acx_option_search_libs.m4 -text
m4/acx_sl_fc_mod_path_flag.m4 -text
m4/acx_sl_mod_suffix.m4 -text
m4/asx_tr_arg.m4 -text
m4/asx_unset.m4 -text
m4/ax_compare_version.m4 -text
m4/ax_prog_perl_version.m4 -text
m4/ax_with_perl.m4 -text
m4/ax_with_prog.m4 -text
m4/check_gnu_make.m4 -text
m4/gcc_ac_c_char_bit.m4 -text
m4/starlink_fpp.m4 -text
m4/tj_find_type.m4 -text
m4/acx_options.m4 -text
src/Arith.c -text
src/Arithc.c -text
src/Arithdays.c -text
......
## Process this file with automake to produce Makefile.in
SUBDIRS = src contrib
SUBDIRS =
if USE_INTERNAL_CDI
SUBDIRS += libcdi
endif
SUBDIRS += src contrib
#
EXTRA_DIST=config/default OPERATORS doc/cdo.pdf doc/cdo_refcard.pdf cdo.spec
#
......
......@@ -33,38 +33,26 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@USE_INTERNAL_CDI_TRUE@am__append_1 = libcdi
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/cdo.spec.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
config/config.guess config/config.sub config/depcomp \
config/install-sh config/ltmain.sh config/missing \
config/mkinstalldirs
$(srcdir)/Makefile.in $(srcdir)/cdo.settings.in \
$(srcdir)/cdo.spec.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog INSTALL NEWS config/compile config/config.guess \
config/config.sub config/depcomp config/install-sh \
config/ltmain.sh config/missing config/mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_c_package.m4 \
$(top_srcdir)/m4/acx_lang_check_include.m4 \
$(top_srcdir)/m4/acx_lang_package.m4 \
$(top_srcdir)/m4/acx_m4_generate_subsets.m4 \
$(top_srcdir)/m4/acx_option_search_libs.m4 \
$(top_srcdir)/m4/asx_tr_arg.m4 $(top_srcdir)/m4/asx_unset.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/m4/ac_fc_freeform.m4 \
$(top_srcdir)/m4/acx_fc_library_ldflags.m4 \
$(top_srcdir)/m4/ac_lang_program_fortran.m4 \
$(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \
$(top_srcdir)/m4/acx_lang_c_check_include.m4 \
$(top_srcdir)/m4/ac_fc_freeform.m4 \
$(top_srcdir)/m4/acx_fc_library_ldflags.m4 \
$(top_srcdir)/m4/ac_lang_program_fortran.m4 \
$(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \
$(top_srcdir)/m4/acx_lang_c_check_include.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES = cdo.spec
CONFIG_CLEAN_FILES = cdo.spec cdo.settings
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
......@@ -82,7 +70,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DIST_SUBDIRS = libcdi src contrib
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
......@@ -129,49 +117,68 @@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CDI_C_INCLUDE = @CDI_C_INCLUDE@
CDI_C_LIB = @CDI_C_LIB@
CDI_LDFLAGS = @CDI_LDFLAGS@
CFLAGS = @CFLAGS@
CLDFLAGS = @CLDFLAGS@
CLIBS = @CLIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@
ENABLE_IEG = @ENABLE_IEG@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
FCFLAGS = @FCFLAGS@
FGREP = @FGREP@
GREP = @GREP@
GRIB_APIROOT = @GRIB_APIROOT@
GRIB_API_C_INCLUDE = @GRIB_API_C_INCLUDE@
GRIB_API_C_LIB = @GRIB_API_C_LIB@
HDF5ROOT = @HDF5ROOT@
HDF5_C_INCLUDE = @HDF5_C_INCLUDE@
HDF5_C_LIB = @HDF5_C_LIB@
GRIB_API_INCLUDE = @GRIB_API_INCLUDE@
GRIB_API_LDFLAGS = @GRIB_API_LDFLAGS@
HDF5_INCLUDE = @HDF5_INCLUDE@
HDF5_LDFLAGS = @HDF5_LDFLAGS@
HOST_NAME = @HOST_NAME@
INCLUDES = @INCLUDES@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JASPERROOT = @JASPERROOT@
JASPER_C_LIB = @JASPER_C_LIB@
INTERNAL_CDI = @INTERNAL_CDI@
JASPER_LDFLAGS = @JASPER_LDFLAGS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NETCDFROOT = @NETCDFROOT@
NETCDF_C_INCLUDE = @NETCDF_C_INCLUDE@
NETCDF_C_LIB = @NETCDF_C_LIB@
NETCDF_INCLUDE = @NETCDF_INCLUDE@
NETCDF_LDFLAGS = @NETCDF_LDFLAGS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
......@@ -180,25 +187,27 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PROJROOT = @PROJROOT@
PROJ_C_INCLUDE = @PROJ_C_INCLUDE@
PROJ_C_LIB = @PROJ_C_LIB@
PROJ_LDFLAGS = @PROJ_LDFLAGS@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SZLIBROOT = @SZLIBROOT@
SZLIB_C_INCLUDE = @SZLIB_C_INCLUDE@
SZLIB_C_LIB = @SZLIB_C_LIB@
SYSTEM_TYPE = @SYSTEM_TYPE@
SZLIB_INCLUDE = @SZLIB_INCLUDE@
SZLIB_LDFLAGS = @SZLIB_LDFLAGS@
THREADS_INCLUDE = @THREADS_INCLUDE@
THREADS_LDFLAGS = @THREADS_LDFLAGS@
USER_NAME = @USER_NAME@
VERSION = @VERSION@
ZLIBROOT = @ZLIBROOT@
ZLIB_C_INCLUDE = @ZLIB_C_INCLUDE@
ZLIB_C_LIB = @ZLIB_C_LIB@
ZLIB_LDFLAGS = @ZLIB_LDFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
......@@ -239,12 +248,13 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src contrib
SUBDIRS = $(am__append_1) src contrib
#
EXTRA_DIST = config/default OPERATORS doc/cdo.pdf doc/cdo_refcard.pdf cdo.spec
#
......@@ -290,6 +300,17 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
cdo.spec: $(top_builddir)/config.status $(srcdir)/cdo.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
cdo.settings: $(top_builddir)/config.status $(srcdir)/cdo.settings.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
......@@ -634,12 +655,13 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
......@@ -689,7 +711,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
......@@ -706,18 +728,19 @@ uninstall-am:
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
distclean distclean-generic distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
......
......@@ -41,13 +41,6 @@ dnl
dnl
dnl Code:
dnl
# override AC_LANG_PROGRAM(Fortran)([PROLOGUE], [BODY]) with a version
# that uses prologue
m4_include([m4/ac_fc_freeform.m4])
m4_include([m4/acx_fc_library_ldflags.m4])
m4_include([m4/ac_lang_program_fortran.m4])
m4_include([m4/acx_lang_fortran_check_include.m4])
m4_include([m4/acx_lang_c_check_include.m4])
dnl
dnl Local Variables:
dnl mode: autoconf
......@@ -97,13 +90,6 @@ dnl
dnl
dnl Code:
dnl
# override AC_LANG_PROGRAM(Fortran)([PROLOGUE], [BODY]) with a version
# that uses prologue
m4_include([m4/ac_fc_freeform.m4])
m4_include([m4/acx_fc_library_ldflags.m4])
m4_include([m4/ac_lang_program_fortran.m4])
m4_include([m4/acx_lang_fortran_check_include.m4])
m4_include([m4/acx_lang_c_check_include.m4])
dnl
dnl Local Variables:
dnl mode: autoconf
......
......@@ -19,6 +19,30 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# Generated from ltversion.in.
# serial 3175 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.2.10])
m4_define([LT_PACKAGE_REVISION], [1.3175])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.2.10'
macro_revision='1.3175'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
......@@ -651,6 +675,41 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 6
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
if test "$am_t" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
......@@ -961,11 +1020,9 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/acx_c_package.m4])
m4_include([m4/acx_lang_check_include.m4])
m4_include([m4/acx_lang_package.m4])
m4_include([m4/acx_m4_generate_subsets.m4])
m4_include([m4/acx_option_search_libs.m4])
m4_include([m4/asx_tr_arg.m4])
m4_include([m4/asx_unset.m4])
m4_include([m4/acx_options.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/lt~obsolete.m4])
m4_include([acinclude.m4])
{
"CC" : "@CC@",
"CPP" : "@CPP@",
"CPPFLAGS" : "@CPPFLAGS@",
"CFLAGS" : "@CFLAGS@",
"LDFLAGS" : "@LDFLAGS@",
"LIBS" : "@LIBS@",
"FCPPFLAGS" : "@FCPPFLAGS@",
"FCFLAGS" : "@FCFLAGS@",
"INCLUDES" : "@INCLUDES@",
"LD" : "@LD@",
"NM" : "@NM@",
"AR" : "@AR@",
"AS" : "@AS@",
"DLLTOOL" : "@DLLTOOL@",
"OBJDUMP" : "@OBJDUMP@",
"STRIP" : "@STRIP@",
"RANLIB" : "@RANLIB@",
"INSTALL" : "@INSTALL@",
"cdi" : {
"use_internal_cdi" : @INTERNAL_CDI@,
"lib" : "@CDI_C_LIB@",
"include" : "@CDI_C_INCLUDE@"
},
"threads" : {
"lib" : "@THREADS_LDFLAGS@",
"include" : "@THREADS_INCLUDE@"
},
"zlib" : {
"lib" : "@ZLIB_LDFLAGS@",
},
"szlib" : {
"lib" : "@SZLIB_LDFLAGS@",
"include" : "@SZLIB_INCLUDE@"
},
"hdf5" : {
"lib" : "@HDF5_LDFLAGS@",
"include" : "@HDF5_INCLUDE@"
},
"netcdf" : {
"lib" : "@NETCDF_LDFLAGS@",
"include" : "@NETCDF_INCLUDE@"
},
"grip_api" : {
"lib" : "@GRIB_API_LDFLAGS@",
"include" : "@GRIB_API_INCLUDE@"
},
"jasper" : {
"lib" : "@JASPER_LDFLAGS@"
},
"proj" : {
"lib" : "@PROJ_LDFLAGS@",
},
"USER_NAME" : "@USER_NAME@",
"HOST_NAME" : "@HOST_NAME@",
"SYSTEM_TYPE" : "@SYSTEM_TYPE@"
}
......@@ -4,7 +4,7 @@
Name: cdo
#BuildRequires:
Version: 1.4.6rc4
Version: 1.4.5
Release: 1
Summary: Climate Data Operators
License: GNU GENERAL PUBLIC LICENSE Version 2, June 1991
......
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2009-10-06.20; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
# Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"