-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Replace Makefile with Makefile.in - Add configure.ac
- Loading branch information
Showing
3 changed files
with
89 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
CC=@CC@ | ||
LD=@CC@ | ||
PREFIX=@prefix@ | ||
|
||
CFLAGS=@CFLAGS@ | ||
DAEMON=runns | ||
CLIENT=runnsctl | ||
HELPER=build-net clean-net | ||
_ := $() $() | ||
comma := , | ||
|
||
all: $(DAEMON) $(CLIENT) | ||
|
||
$(DAEMON): runns.o | ||
$(CC) -o $@ $< | ||
|
||
$(CLIENT): client.o | ||
$(CC) -o $@ $< | ||
|
||
.PHONY: client | ||
clean: | ||
rm -f $(DAEMON) $(CLIENT) *.o | ||
|
||
.PHONY: install | ||
install: $(DAEMON) $(CLIENT) $(HELPER) | ||
mkdir -p $(DESTDIR)/$(PREFIX)/bin | ||
cp {$(subst $(_),$(comma),$^)} $(DESTDIR)/$(PREFIX)/bin/ | ||
chmod 755 $(DESTDIR)/$(PREFIX)/bin/{$(subst $(_),$(comma),$^)} | ||
|
||
.PHONY: uninstall | ||
uninstall: $(CLIENT) $(DAEMON) $(HELPER) | ||
rm -f $(DESTDIR)/$(PREFIX)/bin/{$(subst $(_),$(comma),$^)} | ||
|
||
.PHONY: distclean | ||
distclean: | ||
rm -vrf $(DAEMON) $(CLIENT) *.o Makefile autom4te.cache config.log config.status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
dnl | ||
dnl Process this file in order to make a configure script | ||
dnl | ||
|
||
dnl Setup autoconf | ||
AC_INIT([runns], [1.0], [[email protected]]) | ||
dnl AM_INIT_AUTOMAKE | ||
|
||
dnl Debug option | ||
AC_ARG_ENABLE(debug, | ||
AS_HELP_STRING([--enable-debug],[enable debugging, defult: no]), | ||
[case "${enableval}" in | ||
yes) debug = true ;; | ||
no) debug = false ;; | ||
*) AC_MSG_ERROR([bad value ${enablevalue} for --enable-debug]) ;; | ||
esac], [debug=false]) | ||
|
||
dnl Check dependences | ||
echo "Cheking dependences" | ||
AC_LANG(C) | ||
AC_CHECK_TOOL(IPTABLES, iptables, "", PATH="$PATH:/sbin") | ||
AC_CHECK_TOOL(IP, ip) | ||
AC_CHECK_TOOL(GAWK, gawk) | ||
|
||
dnl Disable all CFLAGS if it was not declarated | ||
if [test -z $CFLAGS; ] then | ||
if test x"${debug}" == x"true"; then | ||
CFLAGS="-g -O0" | ||
else | ||
CFLAGS="-O2" | ||
fi | ||
fi | ||
AC_PROG_CC | ||
|
||
if [ test "x$IPTABLES" == "x"; ] then | ||
AC_MSG_ERROR([iptables is required]) | ||
fi | ||
|
||
if [ test "x$IP" == "x"; ] then | ||
AC_MSG_ERROR([ip from iproute2 is required]) | ||
fi | ||
|
||
if [ test "x$GAWK" == "x"; ] then | ||
AC_MSG_ERROR([gawk is required]) | ||
fi | ||
|
||
dnl Get source code path | ||
dnl AC_DEFINE_UNQUOTED([SRC_PATH], ["$srcdir"], [source path]) | ||
|
||
dnl Configure Makefile from Makefile.in | ||
AC_CONFIG_FILES([Makefile]) | ||
|
||
AC_OUTPUT |