From 1c0988b8e2a0bee2b499f3fe7d3079a53d8f5c90 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 28 Nov 2021 19:22:45 +0100 Subject: [PATCH] Fix #18: optional compat symlink lite -> libite/ Default is to create the symlink, to facilitate upgrades. Signed-off-by: Joachim Wiberg --- configure.ac | 10 ++++++++-- src/Makefile.am | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8c0c11a..b2d51c1 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,13 @@ DX_CHM_FEATURE(OFF) DX_HTML_FEATURE(ON) DX_MAN_FEATURE(OFF) DX_INIT_DOXYGEN(${PACKAGE_NAME}, [${top_builddir}/doc/Doxyfile], [${top_builddir}/doc]) -AM_CONDITIONAL(ENABLE_DOXYGEN,[test "x${DX_FLAG_doc}" = x1]) -AM_CONDITIONAL(ENABLE_HTML,[test "x${DX_FLAG_html}" = x1]) + +AC_ARG_WITH([symlink], + AS_HELP_STRING([--without-symlink], [Disable compat /usr/include/lite -> libite symlink]),, + [with_symlink=yes]) + +AM_CONDITIONAL([ENABLE_DOXYGEN], [test "x${DX_FLAG_doc}" = x1]) +AM_CONDITIONAL([ENABLE_HTML], [test "x${DX_FLAG_html}" = x1]) +AM_CONDITIONAL([COMPAT_SYMLINK], [test "x$with_symlink" != "xno"]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 4fde732..d905730 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,3 +28,18 @@ pkginclude_HEADERS = lite.h queue.h conio.h tree.h strlite.h strdupa.h \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libite.pc + +## For compatibility with existing installations that look for lite/lite.h +if COMPAT_SYMLINK +install-data-hook: + link=$(DESTDIR)$(includedir)/lite; \ + if [ ! -f $$link ]; then \ + $(LN_S) libite $$link; \ + fi + +uninstall-hook: + link=$(shell readlink $(DESTDIR)$(includedir)/lite); \ + if [ "$$link" = "libite" ]; then \ + $(RM) $(DESTDIR)$(includedir)/lite; \ + fi +endif