[PATCH 2/2] Add a tiny configure script for BSD and Linux systems

From: sin <sin_AT_2f30.org>
Date: Thu, 14 Nov 2013 11:42:43 +0000

---
 Makefile     |  7 +++++--
 config.bsd   | 23 +++++++++++++++++++++++
 config.linux | 23 +++++++++++++++++++++++
 config.mk    | 30 ------------------------------
 configure    | 10 ++++++++++
 5 files changed, 61 insertions(+), 32 deletions(-)
 create mode 100644 config.bsd
 create mode 100644 config.linux
 delete mode 100644 config.mk
 create mode 100755 configure
diff --git a/Makefile b/Makefile
index 2bea555..2bf78e5 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -1,6 +1,9 @@
 # slock - simple screen locker
 # See LICENSE file for copyright and license details.
 
+# slock version
+VERSION=1.2
+
 include config.mk
 
 SRC = slock.c
_AT_@ -40,8 +43,8 @@ install: all
 	_AT_echo installing executable file to ${DESTDIR}${PREFIX}/bin
 	_AT_mkdir -p ${DESTDIR}${PREFIX}/bin
 	_AT_cp -f slock ${DESTDIR}${PREFIX}/bin
-	_AT_chmod 755 ${DESTDIR}${PREFIX}/bin/slock
-	_AT_chmod u+s ${DESTDIR}${PREFIX}/bin/slock
+	_AT_chgrp ${GROUP} ${DESTDIR}${PREFIX}/bin/slock
+	_AT_chmod ${MODE} ${DESTDIR}${PREFIX}/bin/slock
 
 uninstall:
 	_AT_echo removing executable file from ${DESTDIR}${PREFIX}/bin
diff --git a/config.bsd b/config.bsd
new file mode 100644
index 0000000..afbc825
--- /dev/null
+++ b/config.bsd
_AT_@ -0,0 +1,23 @@
+# Customize below to fit your system
+
+# paths
+PREFIX = /usr/local
+
+X11INC = /usr/X11R6/include
+X11LIB = /usr/X11R6/lib
+
+# includes and libs
+INCS = -I${X11INC}
+LIBS = -L${X11LIB} -lX11 -lXext
+
+# flags
+CPPFLAGS = -DVERSION=\"${VERSION}\" -DHAVE_BSD_AUTH -DCOLOR1=\"black\" -DCOLOR2=\"\#005577\"
+CFLAGS += ${INCS} ${CPPFLAGS}
+LDFLAGS += ${LIBS}
+
+# compiler and linker
+CC = cc
+
+# install mode
+MODE=2755
+GROUP=auth
diff --git a/config.linux b/config.linux
new file mode 100644
index 0000000..41bfe4f
--- /dev/null
+++ b/config.linux
_AT_@ -0,0 +1,23 @@
+# Customize below to fit your system
+
+# paths
+PREFIX = /usr/local
+
+X11INC = /usr/X11R6/include
+X11LIB = /usr/X11R6/lib
+
+# includes and libs
+INCS = -I. -I/usr/include -I${X11INC}
+LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext
+
+# flags
+CPPFLAGS = -DVERSION=\"${VERSION}\" -DHAVE_SHADOW_H -DCOLOR1=\"black\" -DCOLOR2=\"\#005577\"
+CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
+LDFLAGS = -s ${LIBS}
+
+# compiler and linker
+CC = cc
+
+# install mode
+MODE=4755
+GROUP=root
diff --git a/config.mk b/config.mk
deleted file mode 100644
index 8cc3f68..0000000
--- a/config.mk
+++ /dev/null
_AT_@ -1,30 +0,0 @@
-# slock version
-VERSION = 1.2
-
-# Customize below to fit your system
-
-# paths
-PREFIX = /usr/local
-
-X11INC = /usr/X11R6/include
-X11LIB = /usr/X11R6/lib
-
-# includes and libs
-INCS = -I. -I/usr/include -I${X11INC}
-LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext
-
-# flags
-CPPFLAGS = -DVERSION=\"${VERSION}\" -DHAVE_SHADOW_H -DCOLOR1=\"black\" -DCOLOR2=\"\#005577\"
-CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
-LDFLAGS = -s ${LIBS}
-
-# On *BSD remove -DHAVE_SHADOW_H from CPPFLAGS and add -DHAVE_BSD_AUTH
-# On OpenBSD and Darwin remove -lcrypt from LIBS
-
-# compiler and linker
-CC = cc
-
-# Install mode. On BSD systems MODE=2755 and GROUP=auth
-# On others MODE=4755 and GROUP=root
-#MODE=2755
-#GROUP=auth
diff --git a/configure b/configure
new file mode 100755
index 0000000..82db20d
--- /dev/null
+++ b/configure
_AT_@ -0,0 +1,10 @@
+#!/bin/sh
+
+case $(uname) in
+*BSD)
+	ln config.bsd config.mk
+	;;
+*)
+	ln config.linux config.mk
+	;;
+esac
\ No newline at end of file
-- 
1.8.4.2
--T4sUOijqQbZv57TR--
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Thu Nov 14 2013 - 13:36:11 CET