149d8c9ecSmrg#! /bin/sh 249d8c9ecSmrg# 349d8c9ecSmrg# Copyright (c) 2013 Matthew R. Green 449d8c9ecSmrg# All rights reserved. 549d8c9ecSmrg# 649d8c9ecSmrg# Redistribution and use in source and binary forms, with or without 749d8c9ecSmrg# modification, are permitted provided that the following conditions 849d8c9ecSmrg# are met: 949d8c9ecSmrg# 1. Redistributions of source code must retain the above copyright 1049d8c9ecSmrg# notice, this list of conditions and the following disclaimer. 1149d8c9ecSmrg# 2. Redistributions in binary form must reproduce the above copyright 1249d8c9ecSmrg# notice, this list of conditions and the following disclaimer in the 1349d8c9ecSmrg# documentation and/or other materials provided with the distribution. 1449d8c9ecSmrg# 1549d8c9ecSmrg# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1649d8c9ecSmrg# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1749d8c9ecSmrg# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1849d8c9ecSmrg# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1949d8c9ecSmrg# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2049d8c9ecSmrg# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 2149d8c9ecSmrg# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2249d8c9ecSmrg# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2349d8c9ecSmrg# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2449d8c9ecSmrg# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2549d8c9ecSmrg# SUCH DAMAGE. 2649d8c9ecSmrg 2749d8c9ecSmrg# 2849d8c9ecSmrg# Generate a c++config.h that will include the correct multilib c++config.h 2949d8c9ecSmrg# 3049d8c9ecSmrg# mkcxxconfig_h.sh [[<arch> <define>] ...] <arch> 3149d8c9ecSmrg# 3249d8c9ecSmrg# generates a series of #ifdef 's with the final <arch> being the default 3349d8c9ecSmrg# 3449d8c9ecSmrg 3549d8c9ecSmrgemit_intro() { 3649d8c9ecSmrg cat <<'__EOH1__' 37*d914a3c1Smrg/* $NetBSD: mkcxxconfig_h.sh,v 1.2 2021/12/11 19:24:19 mrg Exp $ */ 3849d8c9ecSmrg 3949d8c9ecSmrg/* This file is automatically generated. DO NOT EDIT! */ 4049d8c9ecSmrg__EOH1__ 4149d8c9ecSmrg 42*d914a3c1Smrg netbsd_id=$(echo '$NetBSD: mkcxxconfig_h.sh,v 1.2 2021/12/11 19:24:19 mrg Exp $' | sed 's,[#$],,g;s,.*,&,') 4349d8c9ecSmrg cat <<__EOH2__ 4449d8c9ecSmrg/* Generated from: $netbsd_id */ 4549d8c9ecSmrg 4649d8c9ecSmrg__EOH2__ 4749d8c9ecSmrg} 4849d8c9ecSmrg 4949d8c9ecSmrgemit_final() { 5049d8c9ecSmrg echo "#endif" 5149d8c9ecSmrg} 5249d8c9ecSmrg 5349d8c9ecSmrg# $1 - arch to include 5449d8c9ecSmrgemit_include() { 5549d8c9ecSmrg echo "#include "'"'"bits/$1/c++config.h"'"' 5649d8c9ecSmrg} 5749d8c9ecSmrg 5849d8c9ecSmrg# $1 - define to ifdef 5949d8c9ecSmrgifdef=ifdef 6049d8c9ecSmrgemit_ifdef() { 6149d8c9ecSmrg echo "#$ifdef $1" 6249d8c9ecSmrg ifdef="elif" 6349d8c9ecSmrg} 6449d8c9ecSmrg 6549d8c9ecSmrgmain() { 6649d8c9ecSmrg emit_intro 6749d8c9ecSmrg while [ $# -gt 0 ]; do 6849d8c9ecSmrg if [ $# -eq 1 ]; then 6949d8c9ecSmrg echo '#else' 7049d8c9ecSmrg emit_include $1 7149d8c9ecSmrg break 7249d8c9ecSmrg fi 7349d8c9ecSmrg emit_ifdef $2 7449d8c9ecSmrg emit_include $1 7549d8c9ecSmrg shift 7649d8c9ecSmrg shift 7749d8c9ecSmrg done 7849d8c9ecSmrg emit_final 7949d8c9ecSmrg} 8049d8c9ecSmrg 8149d8c9ecSmrgmain "$@" 82