summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Santos <daniel.santos@pobox.com>2021-10-11 23:58:22 -0500
committerjaseg <git@jaseg.net>2021-10-14 23:11:20 +0200
commit8173ed8cb62f22ca2ebb33a63b5b9954afb20d7e (patch)
tree4263ebd97466328b6ced984153c3b42036060203
parent1d52554cb1023bed428d71bb3b051d2fbab4327c (diff)
downloadlolcat-8173ed8cb62f22ca2ebb33a63b5b9954afb20d7e.tar.gz
lolcat-8173ed8cb62f22ca2ebb33a63b5b9954afb20d7e.tar.bz2
lolcat-8173ed8cb62f22ca2ebb33a63b5b9954afb20d7e.zip
build: Add autotools option for those who want it
Closes #40.
-rw-r--r--autotools/Makefile.am7
-rw-r--r--autotools/README7
-rwxr-xr-xautotools/autogen.sh36
-rw-r--r--autotools/configure.ac35
4 files changed, 85 insertions, 0 deletions
diff --git a/autotools/Makefile.am b/autotools/Makefile.am
new file mode 100644
index 0000000..002d475
--- /dev/null
+++ b/autotools/Makefile.am
@@ -0,0 +1,7 @@
+bin_PROGRAMS = lolcat censor
+lolcat_SOURCES = ../lolcat.c
+censor_SOURCES = ../censor.c
+
+LIBS += -lm
+CFLAGS ?= -O3
+AM_CFLAGS = -std=c11 -Wall -Wextra -Wno-sign-compare -Werror=implicit
diff --git a/autotools/README b/autotools/README
new file mode 100644
index 0000000..7845e4e
--- /dev/null
+++ b/autotools/README
@@ -0,0 +1,7 @@
+This directory contains an autotools config for building lolcat for those who need it. This is an alternative to the
+Makefile provided in the git root. Run it like so:
+
+cd autotools # go here
+./autogen.sh
+./configure
+make
diff --git a/autotools/autogen.sh b/autotools/autogen.sh
new file mode 100755
index 0000000..1f3109d
--- /dev/null
+++ b/autotools/autogen.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+auxdir=autoscripts
+
+set -x
+
+# aclocal generated files
+rm -rf aclocal.m4 autom4te.cache
+
+# autoheader generated files
+rm -f config.h.in
+
+# autoconf generated files
+rm -f configure
+
+# automake generated files
+rm -f ${auxdir}/{config.guess,config.sub,depcomp,install-sh,missing}
+rm -f Makefile.in
+
+# configure generated files
+rm -f config.h config.log config.status Makefile Makefile.in stamp-h1
+
+rm -f $(find ${auxdir} -type l 2>/dev/null)
+rmdir ${auxdir} 2>/dev/null
+
+if [[ "$1" == clean ]]; then
+ exit 0
+fi
+
+mkdir ${auxdir} 2>/dev/null
+
+aclocal
+autoheader
+autoconf
+automake --add-missing
+
diff --git a/autotools/configure.ac b/autotools/configure.ac
new file mode 100644
index 0000000..030e1d5
--- /dev/null
+++ b/autotools/configure.ac
@@ -0,0 +1,35 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([lolcat], [1.2], [jaseg <github@jaseg.de>])
+AC_CONFIG_SRCDIR([../lolcat.c])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_AUX_DIR([autoscripts])
+AC_CANONICAL_TARGET
+AC_CANONICAL_HOST
+
+# Automake
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+
+# Checks for libraries.
+AC_CHECK_LIB([m], [cos])
+
+# Checks for header files.
+AC_CHECK_HEADERS([locale.h stdint.h stdlib.h string.h sys/time.h unistd.h wchar.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+AC_CHECK_HEADER_STDBOOL
+AC_TYPE_UINT8_T
+
+# Checks for library functions.
+AC_FUNC_STRTOD
+AC_CHECK_FUNCS([gettimeofday setlocale strchr strerror strstr wcwidth])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT