diff options
author | nytpu <alex@nytpu.com> | 2021-05-21 23:32:30 -0600 |
---|---|---|
committer | nytpu <alex@nytpu.com> | 2021-05-21 23:32:30 -0600 |
commit | 245208f1c3736f34a2f7d6ccbd9e193187d2290d (patch) | |
tree | a3e117b648d60d340ea758f3c30eb4054895106a /configure | |
parent | initial commit (diff) | |
download | ed-245208f1c3736f34a2f7d6ccbd9e193187d2290d.tar.bz2 ed-245208f1c3736f34a2f7d6ccbd9e193187d2290d.zip |
add configure script (currently pretty useless
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/configure b/configure new file mode 100755 index 0000000..cb5add1 --- /dev/null +++ b/configure @@ -0,0 +1,73 @@ +#!/usr/bin/env sh +# configure script for nytpu's implementation of ed(1) +# It should be pretty generic though, with just slight modifications +# +# Copyright (C) 2021 nytpu <alex@nytpu.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# 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 +# AUTHORS OR COPYRIGHT HOLDERS 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. + +set -eu + +add_cflags() { + echo "CFLAGS += $*" +} +add_ld() { + echo "LDLIBS += $*" +} + +set_macro() { + add_cflags "-D'$1=\"$2\"'" +} + +add_lib() { + pkg-config --print-errors "$@" + cflags $(pkg-config --cflags "$@") + for lib in "$@"; do ldadd "$lib" $(pkg-config --libs "$lib"); done +} + +# save stdout and redirec to config.mk +exec >config.mk + +echo "# Configuration for makefile for nytpu's implementation of ed(1)" +echo "# This file was generated automatically by configure. Don't edit." + +for opt in "$@"; do + case "${opt}" in + --help | -h) + exec 1>&2 + echo "Usage: $0 [--OPTION]..." + echo + echo "Options and variables: [defaults in brackets]" + echo " -h, --help display this help text" + echo " --prefix=DIR install into DIR [/usr]" + echo " --bindir=DIR location to install executables [\$(PREFIX)/bin]" + echo " --mandir=DIR location to install man pages [\$(PREFIX)/share/man]" + echo " --cc=COMPILER command to invoke the C11 compiler [cc]" + echo " --cflags=FLAGS command line options for the C compiler [-Wall -Wextra -Wfatal-errors -Wno-missing-field-initializers -Wno-unused-parameter -std=c11 -O2]" + echo " --ldflags=FLAGS command line options for the linker []" + ;; + --prefix=*) echo "PREFIX = ${opt#*=}" ;; + --bindir=*) echo "BINDIR = ${opt#*=}" ;; + --mandir=*) echo "MANDIR = ${opt#*=}" ;; + --cc=*) echo "CC = ${opt#*=}" ;; + --cflags=*) echo "CFLAGS = ${opt#*=}" ;; + --ldflags=*) echo "LDFLAGS = ${opt#*=}" ;; + *) echo "warning: unsupported option ${opt}" >&2 ;; + esac +done |