X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2FMakefile.am;h=7278c688342b042b6b2bed6f763a9be7bb020f3f;hb=841cc138ef9153d376d11d219450298dd80a60c7;hp=bc35a787ae5b1006c21aeb782ce7d24f55843e63;hpb=c7bfa8812b79c41b826793862373809950ddb2d9;p=liboping.git diff --git a/src/Makefile.am b/src/Makefile.am index bc35a78..7278c68 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,6 +33,24 @@ if BUILD_WITH_LIBXNET 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 @@ -51,3 +69,16 @@ if BUILD_WITH_LIBRT 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