diff --git a/src/Makefile.am b/src/Makefile.am
index bc35a787ae5b1006c21aeb782ce7d24f55843e63..7278c688342b042b6b2bed6f763a9be7bb020f3f 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
liboping_la_LIBADD += -lxnet
endif
+oping.pc:
+ echo 'prefix=$(prefix)' > $@
+ echo 'exec_prefix=$(exec_prefix)' >> $@
+ echo 'includedir=$(includedir)' >> $@
+ echo 'libdir=$(libdir)' >> $@
+ echo >> $@
+ echo 'Name: $(PACKAGE_TARNAME)' >> $@
+ echo 'Description: $(PACKAGE_NAME)' >> $@
+ echo 'URL: $(PACKAGE_URL)' >> $@
+ echo 'Version: $(PACKAGE_VERSION)' >> $@
+ echo 'Cflags: -I${includedir}' >> $@
+ echo 'Libs: -L${libdir} -loping' >> $@
+ echo 'Libs.private: $(AM_LDFLAGS) $(LIBS) $(liboping_la_LIBADD)' >> $@
+
+pkgconfig_DATA = oping.pc
+
+MOSTLYCLEANFILES = $(pkgconfig_DATA)
+
bin_PROGRAMS = oping
oping_SOURCES = oping.c
noping_LDADD += -lrt
endif
endif # BUILD_WITH_LIBNCURSES
+
+install-exec-hook:
+ @if test "x0" = "x$$UID"; then \
+ if test "xLinux" = "x`uname -s`"; then \
+ echo "Setting CAP_NET_RAW capability on binaries."; \
+ setcap cap_net_raw=ep $(DESTDIR)$(bindir)/oping || true; \
+ setcap cap_net_raw=ep $(DESTDIR)$(bindir)/noping || true; \
+ else \
+ echo "Setting set-UID bit on binaries."; \
+ chmod u+s $(DESTDIR)$(bindir)/oping || true; \
+ chmod u+s $(DESTDIR)$(bindir)/noping || true; \
+ fi; \
+ fi