diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-09 17:47:39 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-09 17:51:25 -0800 |
commit | 2ae049bdffdd7b3d421200a24a6c59ba84532daa (patch) | |
tree | d4bbf29de902666210c46560f2f67ee9a9c796db | |
parent | 6ae703860f9214235861a424fcee498562a1b6f5 (diff) |
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | Makefile.am | 18 | ||||
-rw-r--r-- | ccmakedep.in (renamed from mdepend.cpp) | 64 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | m4/ax_define_dir.m4 | 49 | ||||
-rw-r--r-- | mergelib.cpp | 103 | ||||
-rw-r--r-- | mergelib.in | 103 | ||||
-rw-r--r-- | xmkmf.in (renamed from xmkmf.cpp) | 6 |
7 files changed, 195 insertions, 156 deletions
diff --git a/Makefile.am b/Makefile.am index ceda7d1..744ad5b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,10 +20,6 @@ # PERFORMANCE OF THIS SOFTWARE. CPP_PROGRAM = @CPP_PROGRAM@ -XCONFDIR = @XCONFDIR@ -PREPROCESSCMD_MKDEPEND = @PREPROCESSCMD_MKDEPEND@ -ARCMD = @ARCMD@ -RANLIB = @RANLIB@ if BUILD_REVPATH REVPATH = revpath @@ -75,15 +71,6 @@ bin_SCRIPTS = \ $(CLEANLINKS) \ $(MKHTMLINDEX) -xmkmf: xmkmf.cpp - $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) -DCONFIGDIRSPEC='"-I$(XCONFDIR)"' $(srcdir)/xmkmf.cpp | $(SED) -e /^\#/d | $(SED) -e s/XCOMM/\#/ > $@ - -ccmakedep: mdepend.cpp - $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) -DPREPROC='"$(PREPROCESSCMD_MKDEPEND)"' $(srcdir)/mdepend.cpp | $(SED) -e /^\#/d | $(SED) -e s/XCOMM/\#/ > $@ - -mergelib: mergelib.cpp - $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) -DARCMD="$(ARCMD)" -DRANLIB="$(RANLIB)" $(srcdir)/mergelib.cpp | $(SED) -e /^\#/d | $(SED) -e s/XCOMM/\#/ > $@ - if HAS_PERL MKHTMLINDEX_SCRIPT = $(srcdir)/mkhtmlindex.pl else @@ -103,9 +90,6 @@ CLEANFILES = \ EXTRA_DIST = \ README.md \ makeg \ - xmkmf.cpp \ - mdepend.cpp \ - mergelib.cpp \ mkdirhier \ cleanlinks \ mkhtmlindex.pl \ @@ -140,6 +124,8 @@ SUFFIXES = .$(APP_MAN_SUFFIX) .man .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ +ACLOCAL_AMFLAGS = -I m4 + EXTRA_DIST += ChangeLog MAINTAINERCLEANFILES = ChangeLog diff --git a/mdepend.cpp b/ccmakedep.in index ec8b5dd..dee1edf 100644 --- a/mdepend.cpp +++ b/ccmakedep.in @@ -1,27 +1,27 @@ -XCOMM!/bin/sh -XCOMM -XCOMM Do the equivalent of the 'makedepend' program, but do it right. -XCOMM -XCOMM Usage: -XCOMM -XCOMM makedepend [cpp-flags] [-w width] [-s magic-string] [-f makefile] -XCOMM [-o object-suffix] [-v] [-a] [-cc compiler] [-d dependencyflag] -XCOMM -XCOMM Notes: -XCOMM -XCOMM The C compiler used can be overridden with the environment -XCOMM variable "CC" or the command line flag -cc. -XCOMM -XCOMM The "-v" switch of the "makedepend" program is not supported. -XCOMM -XCOMM -XCOMM This script should -XCOMM work on both USG and BSD systems. However, when System V.4 comes out, -XCOMM USG users will probably have to change "silent" to "-s" instead of -XCOMM "-" (at least, that is what the documentation implies). -XCOMM +#!/bin/sh +# +# Do the equivalent of the 'makedepend' program, but do it right. +# +# Usage: +# +# makedepend [cpp-flags] [-w width] [-s magic-string] [-f makefile] +# [-o object-suffix] [-v] [-a] [-cc compiler] [-d dependencyflag] +# +# Notes: +# +# The C compiler used can be overridden with the environment +# variable "CC" or the command line flag -cc. +# +# The "-v" switch of the "makedepend" program is not supported. +# +# +# This script should +# work on both USG and BSD systems. However, when System V.4 comes out, +# USG users will probably have to change "silent" to "-s" instead of +# "-" (at least, that is what the documentation implies). +# -CC=PREPROC +CC="@PREPROCESSCMD_MKDEPEND@" silent='-' @@ -125,9 +125,9 @@ do shift ;; - XCOMM Flag to tell compiler to output dependencies directly - XCOMM For example, with Sun compilers, -xM or -xM1 or - XCOMM with gcc, -M + # Flag to tell compiler to output dependencies directly + # For example, with Sun compilers, -xM or -xM1 or + # with gcc, -M -d) compilerlistsdepends="y" compilerlistdependsflag="$2" @@ -247,12 +247,12 @@ case "$makefile" in ;; esac -XCOMM -XCOMM If not -a, append the magic string and a blank line so that -XCOMM /^$magic_string/+1,\$d can be used to delete everything from after -XCOMM the magic string to the end of the file. Then, append a blank -XCOMM line again and then the dependencies. -XCOMM +# +# If not -a, append the magic string and a blank line so that +# /^$magic_string/+1,\$d can be used to delete everything from after +# the magic string to the end of the file. Then, append a blank +# line again and then the dependencies. +# if [ "$append" = "n" ] then cat >> $makefile << END_OF_APPEND diff --git a/configure.ac b/configure.ac index f9118dd..bcb78ae 100644 --- a/configure.ac +++ b/configure.ac @@ -26,6 +26,7 @@ AC_INIT([imake], [1.0.10], [https://gitlab.freedesktop.org/xorg/util/imake/-/issues], [imake]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-xz]) @@ -57,7 +58,7 @@ AC_ARG_WITH(config-dir, AS_HELP_STRING([--with-config-dir=<path>], [Path to config dir (default: ${libdir}/X11/config)]), [XCONFDIR="$withval"], [XCONFDIR="$DEFAULT_XCONFDIR"]) -AC_SUBST(XCONFDIR) +AX_DEFINE_DIR(XCONFDIR, XCONFDIR, [Path to config dir]) DEFAULT_PREPROCESSCMD_MKDEPEND="gcc -E" AC_ARG_WITH(script-preproc-cmd, @@ -131,5 +132,8 @@ AM_CONDITIONAL([BUILD_MKHTMLINDEX], [test "x$BUILD_MKHTMLINDEX" = xyes]) # Checks for pkg-config packages PKG_CHECK_MODULES(XPROTO, xproto) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile + ccmakedep + mergelib + xmkmf]) AC_OUTPUT diff --git a/m4/ax_define_dir.m4 b/m4/ax_define_dir.m4 new file mode 100644 index 0000000..b74d155 --- /dev/null +++ b/m4/ax_define_dir.m4 @@ -0,0 +1,49 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_define_dir.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) +# +# DESCRIPTION +# +# This macro sets VARNAME to the expansion of the DIR variable, taking +# care of fixing up ${prefix} and such. +# +# VARNAME is then offered as both an output variable and a C preprocessor +# symbol. +# +# Example: +# +# AX_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) +# +# LICENSE +# +# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz> +# Copyright (c) 2008 Andreas Schwab <schwab@suse.de> +# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> +# Copyright (c) 2008 Alexandre Oliva +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR]) +AC_DEFUN([AX_DEFINE_DIR], [ + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix +dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn +dnl refers to ${prefix}. Thus we have to use `eval' twice. + eval ax_define_dir="\"[$]$2\"" + eval ax_define_dir="\"$ax_define_dir\"" + AC_SUBST($1, "$ax_define_dir") + AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3]) + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE +]) diff --git a/mergelib.cpp b/mergelib.cpp deleted file mode 100644 index afb4a91..0000000 --- a/mergelib.cpp +++ /dev/null @@ -1,103 +0,0 @@ -XCOMM!/bin/sh -XCOMM -XCOMM Copyright (c) 1989, 1998 The Open Group -XCOMM -XCOMM Permission to use, copy, modify, distribute, and sell this software and -XCOMM its documentation for any purpose is hereby granted without fee, provided -XCOMM that the above copyright notice appear in all copies and that both that -XCOMM copyright notice and this permission notice appear in supporting -XCOMM documentation. -XCOMM -XCOMM The above copyright notice and this permission notice shall be included in -XCOMM all copies or substantial portions of the Software. -XCOMM -XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XCOMM OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -XCOMM AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -XCOMM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -XCOMM -XCOMM Except as contained in this notice, the name of The Open Group shall not be -XCOMM used in advertising or otherwise to promote the sale, use or other dealings -XCOMM in this Software without prior written authorization from The Open Group. -XCOMM -XCOMM Author: Jim Fulton, MIT X Consortium -XCOMM -XCOMM mergelib - merge one library into another; this is commonly used by X -XCOMM to add the extension library into the base Xlib. -XCOMM - -usage="usage: $0 to-library from-library [object-filename-prefix]" -objprefix=_ - -case $# in - 2) ;; - 3) objprefix=$3 ;; - *) echo "$usage" 1>&2; exit 1 ;; -esac - -tolib=$1 -fromlib=$2 - -if [ ! -f $fromlib ]; then - echo "$0: no such from-library $fromlib" 1>&2 - exit 1 -fi - -if [ ! -f $tolib ]; then - echo "$0: no such to-library $tolib" 1>&2 - exit 1 -fi - - -XCOMM -XCOMM Create a temp directory, and figure out how to reference the -XCOMM object files from it (i.e. relative vs. absolute path names). -XCOMM - -tmpdir=tmp.$$ -origdir=.. - -XCOMM Remove directory if we fail -trap "rm -rf $tmpdir; exit 1" 1 2 15 -trap "rm -rf $tmpdir; exit 0" 1 2 13 - -mkdir $tmpdir - -XCOMM Security: if $tmpdir exists before mkdir exit immediately -if [ $? -gt 0 -o ! -d $tmpdir ]; then - echo "$0: unable to create temporary directory $tmpdir" 1>&2 - exit 1 -fi - -case "$fromlib" in - /?*) upfrom= ;; - *) upfrom=../ ;; -esac - -case "$tolib" in - /?*) upto= ;; - *) upto=../ ;; -esac - - -XCOMM -XCOMM In the temp directory, extract all of the object files and prefix -XCOMM them with some symbol to avoid name clashes with the base library. -XCOMM -cd $tmpdir || exit 1 -ar x ${upfrom}$fromlib -for i in *.o; do - mv $i ${objprefix}$i -done - - -XCOMM -XCOMM Merge in the object modules, ranlib (if appropriate) and cleanup -XCOMM -ARCMD ${upto}$tolib *.o -RANLIB ${upto}$tolib -cd $origdir -rm -rf $tmpdir - diff --git a/mergelib.in b/mergelib.in new file mode 100644 index 0000000..c6b8b42 --- /dev/null +++ b/mergelib.in @@ -0,0 +1,103 @@ +#!/bin/sh +# +# Copyright (c) 1989, 1998 The Open Group +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation. +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of The Open Group shall not be +# used in advertising or otherwise to promote the sale, use or other dealings +# in this Software without prior written authorization from The Open Group. +# +# Author: Jim Fulton, MIT X Consortium +# +# mergelib - merge one library into another; this is commonly used by X +# to add the extension library into the base Xlib. +# + +usage="usage: $0 to-library from-library [object-filename-prefix]" +objprefix=_ + +case $# in + 2) ;; + 3) objprefix=$3 ;; + *) echo "$usage" 1>&2; exit 1 ;; +esac + +tolib=$1 +fromlib=$2 + +if [ ! -f $fromlib ]; then + echo "$0: no such from-library $fromlib" 1>&2 + exit 1 +fi + +if [ ! -f $tolib ]; then + echo "$0: no such to-library $tolib" 1>&2 + exit 1 +fi + + +# +# Create a temp directory, and figure out how to reference the +# object files from it (i.e. relative vs. absolute path names). +# + +tmpdir=tmp.$$ +origdir=.. + +# Remove directory if we fail +trap "rm -rf $tmpdir; exit 1" 1 2 15 +trap "rm -rf $tmpdir; exit 0" 1 2 13 + +mkdir $tmpdir + +# Security: if $tmpdir exists before mkdir exit immediately +if [ $? -gt 0 -o ! -d $tmpdir ]; then + echo "$0: unable to create temporary directory $tmpdir" 1>&2 + exit 1 +fi + +case "$fromlib" in + /?*) upfrom= ;; + *) upfrom=../ ;; +esac + +case "$tolib" in + /?*) upto= ;; + *) upto=../ ;; +esac + + +# +# In the temp directory, extract all of the object files and prefix +# them with some symbol to avoid name clashes with the base library. +# +cd $tmpdir || exit 1 +ar x ${upfrom}$fromlib +for i in *.o; do + mv $i ${objprefix}$i +done + + +# +# Merge in the object modules, ranlib (if appropriate) and cleanup +# +@ARCMD@ ${upto}$tolib *.o +@RANLIB@ ${upto}$tolib +cd $origdir +rm -rf $tmpdir + @@ -1,10 +1,10 @@ -XCOMM!/bin/sh +#!/bin/sh -XCOMM make a Makefile from an Imakefile from inside or outside the sources +# make a Makefile from an Imakefile from inside or outside the sources usage="usage: $0 [-a] [top_of_sources_pathname [current_directory]]" -configdirspec=CONFIGDIRSPEC +configdirspec="-I@XCONFDIR@" topdir= curdir=. do_all= |