use autoconf
This commit is contained in:
parent
321d8d8c72
commit
f1f87f2ce4
6 changed files with 139 additions and 53 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
@ -3,3 +3,12 @@
|
|||
/iast
|
||||
/tests/test
|
||||
*.1.gz
|
||||
|
||||
/Makefile
|
||||
/configure
|
||||
/aclocal.m4
|
||||
/install-sh
|
||||
/config.h*
|
||||
/*.status
|
||||
/*.cache
|
||||
/*.log
|
||||
|
|
51
Makefile
51
Makefile
|
@ -1,51 +0,0 @@
|
|||
SHELL = /bin/sh
|
||||
CC = gcc
|
||||
|
||||
PREFIX = /usr/local
|
||||
BINDIR = $(PREFIX)/bin
|
||||
MANDIR = $(PREFIX)/share/man
|
||||
|
||||
OBJECTS = iast.o iast-czech.o transliteration.o transcription.o utf8.o velthuis.o
|
||||
TEST_OBJECTS = tests/main.o tests/translit.o tests/transcript.o tests/velthuis.o
|
||||
CFLAGS = -Wall
|
||||
LIBS =
|
||||
|
||||
TEST_CFLAGS = $(CFLAGS) $(shell pkg-config --cflags check)
|
||||
TEST_LIBS = $(shell pkg-config --libs check)
|
||||
|
||||
|
||||
.PHONY: all main test install uninstall clean
|
||||
|
||||
all: iast iast.1.gz
|
||||
|
||||
include $(wildcard *.d)
|
||||
|
||||
iast: main.o $(OBJECTS)
|
||||
$(CC) $^ -o $@ $(CFLAGS)
|
||||
|
||||
test: iast tests/test
|
||||
tests/test
|
||||
sh tests/integration.sh
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -MMD -MP -c $< -o $@ $(CFLAGS)
|
||||
|
||||
tests/%.o: tests/%.c
|
||||
$(CC) -MMD -MP -c $< -o $@ $(TEST_CFLAGS) $(TEST_LIBS)
|
||||
|
||||
tests/test: $(OBJECTS) $(TEST_OBJECTS)
|
||||
$(CC) $^ -o $@ $(TEST_CFLAGS) $(TEST_LIBS)
|
||||
|
||||
%.1.gz: %.1
|
||||
cat $< | gzip -f >$@
|
||||
|
||||
install:
|
||||
install -m 0755 iast $(BINDIR)
|
||||
install -m 644 iast.1.gz $(MANDIR)/man1
|
||||
|
||||
uninstall:
|
||||
rm -f $(BINDIR)/iast
|
||||
rm -f $(MANDIR)/man1/iast.1.gz
|
||||
|
||||
clean:
|
||||
$(RM) iast tests/test *.o */*.o *.d */*.d *.1.gz
|
72
Makefile.in
Normal file
72
Makefile.in
Normal file
|
@ -0,0 +1,72 @@
|
|||
PROGNAME = @PROGNAME@
|
||||
|
||||
CC = @CC@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
datarootdir = @datarootdir@
|
||||
mandir = @mandir@
|
||||
|
||||
CFLAGS = -Wall @CFLAGS@
|
||||
LFLAGS =
|
||||
|
||||
TEST_CFLAGS = @CFLAGS@ @CHECK_CFLAGS@
|
||||
TEST_LFLAGS = @CHECK_LIBS@
|
||||
|
||||
OBJECTS = iast.o iast-czech.o transliteration.o transcription.o utf8.o velthuis.o
|
||||
TEST_OBJECTS = tests/main.o tests/translit.o tests/transcript.o tests/velthuis.o
|
||||
|
||||
AUX_FILES = Makefile configure aclocal.m4 install-sh config.h* *.log \
|
||||
*.status *.cache
|
||||
|
||||
all: $(PROGNAME) tests/test $(PROGNAME).1.gz
|
||||
|
||||
include $(wildcard *.d tests/*.d)
|
||||
|
||||
$(PROGNAME): main.o $(OBJECTS)
|
||||
$(QUIET_LD) $(CC) $^ -o $@ $(LFLAGS)
|
||||
|
||||
test: all
|
||||
tests/test
|
||||
|
||||
%.o: %.c
|
||||
$(QUIET_CC) $(CC) -MMD -MP -c $< -o $@ $(CFLAGS)
|
||||
|
||||
tests/%.o: tests/%.c
|
||||
$(QUIET_CC) $(CC) -MMD -MP -c $< -o $@ $(TEST_CFLAGS)
|
||||
|
||||
tests/test: $(OBJECTS) $(TEST_OBJECTS)
|
||||
$(QUIET_LD) $(CC) $^ -o $@ $(TEST_CFLAGS) $(TEST_LFLAGS)
|
||||
|
||||
%.1.gz: %.1
|
||||
$(QUIET_GEN) cat $< | gzip -f >$@
|
||||
|
||||
install:
|
||||
$(MKDIR_P) $(bindir) $(mandir)/man1
|
||||
$(INSTALL_PROGRAM) $(PROGNAME) $(bindir)
|
||||
$(INSTALL_DATA) $(PROGNAME).1.gz $(mandir)/man1
|
||||
|
||||
uninstall:
|
||||
$(RM) $(bindir)/$(PROGNAME)
|
||||
$(RM) $(mandir)/man1/$(PROGNAME).1.gz
|
||||
|
||||
clean:
|
||||
$(RM) $(PROGNAME) tests/test $(PROGNAME).1.gz
|
||||
$(RM) *.o */*.o */*.d *.d
|
||||
|
||||
clean-aux:
|
||||
$(RM) -r $(AUX_FILES)
|
||||
|
||||
distclean: clean clean-aux
|
||||
|
||||
|
||||
ifndef V
|
||||
QUIET_CC = @echo " CC $@";
|
||||
QUIET_LD = @echo " CCLD $@";
|
||||
QUIET_GEN = @echo " GEN $@";
|
||||
endif
|
23
autogen.sh
Executable file
23
autogen.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
test -n "$srcdir" || srcdir=$(dirname "$0")
|
||||
test -n "$srcdir" || srcdir=.
|
||||
|
||||
AUTORECONF=$(which autoreconf || true)
|
||||
AUTOMAKE=$(which automake || true)
|
||||
|
||||
if [ -z "$AUTORECONF" ] || [ -z "$AUTOMAKE" ]; then
|
||||
echo "*** No autoreconf or automake found, please intall it ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
olddir=$(pwd)
|
||||
cd "$srcdir"
|
||||
|
||||
autoreconf --force --install --verbose
|
||||
|
||||
# Install 'install-sh' and do not bother with missing 'Makefile.am'
|
||||
automake --add-missing --copy 2>/dev/null || true
|
||||
|
||||
cd "$olddir"
|
33
configure.ac
Normal file
33
configure.ac
Normal file
|
@ -0,0 +1,33 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([sanskrit-iast], [2.0.0], [vlastavesely@protonmail.ch])
|
||||
AC_CONFIG_SRCDIR([iast.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
PROGNAME=iast
|
||||
AC_SUBST(PROGNAME)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MKDIR_P
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# Checks for libraries.
|
||||
PKG_CHECK_MODULES(CHECK, check)
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_INLINE
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS([memmove])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
4
main.c
4
main.c
|
@ -2,9 +2,9 @@
|
|||
#include "transliteration.h"
|
||||
#include "transcription.h"
|
||||
#include "velthuis.h"
|
||||
#include "config.h"
|
||||
|
||||
#define PROGNAME "iast"
|
||||
#define VERSION "2.0"
|
||||
|
||||
#define FLAG_REVERSE 1 << 0
|
||||
#define FLAG_ENCODE 1 << 1
|
||||
|
@ -38,7 +38,7 @@ static void print_usage()
|
|||
|
||||
static void print_version()
|
||||
{
|
||||
fprintf(stdout, PROGNAME " v" VERSION "\n");
|
||||
fprintf(stdout, PROGNAME " v" PACKAGE_VERSION "\n");
|
||||
}
|
||||
|
||||
static void error(const char *msg, ...)
|
||||
|
|
Loading…
Reference in a new issue