Drop use of libattr for our trivial use case of kernel API.

Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
diff --git a/Make.Rules b/Make.Rules
index 18b7cf7..a768dc6 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -70,7 +70,6 @@
 PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
 INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
 DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
-LIBATTR := yes
 
 # When installing setcap, set its inheritable bit to be able to place
 # capabilities on files. It can be used in conjunction with pam_cap
@@ -80,7 +79,7 @@
 #
 #    make RAISE_SETFCAP=no install
 #
-RAISE_SETFCAP := $(LIBATTR)
+RAISE_SETFCAP := yes
 
 # Global cleanup stuff
 
diff --git a/libcap/Makefile b/libcap/Makefile
index 0ccd2e7..d189777 100644
--- a/libcap/Makefile
+++ b/libcap/Makefile
@@ -10,15 +10,7 @@
 STALIBNAME=$(LIBTITLE).a
 #
 
-FILES=cap_alloc cap_proc cap_extint cap_flag cap_text
-
-# make including file support something you can override (no libattr
-# no support).
-ifeq ($(LIBATTR),yes)
-FILES += cap_file
-LDFLAGS += -lattr
-DEPS = -lattr
-endif
+FILES=cap_alloc cap_proc cap_extint cap_flag cap_text cap_file
 
 INCLS=libcap.h cap_names.h $(INCS)
 OBJS=$(addsuffix .o, $(FILES))
diff --git a/libcap/cap_file.c b/libcap/cap_file.c
index 553c2d2..3acafb2 100644
--- a/libcap/cap_file.c
+++ b/libcap/cap_file.c
@@ -5,14 +5,27 @@
  */
 
 #include <sys/types.h>
-#include <sys/xattr.h>
 #include <byteswap.h>
 #include <sys/stat.h>
 #include <unistd.h>
-
 #include <linux/xattr.h>
 
+/*
+ * We hardcode the prototypes for the Linux system calls here since
+ * there are no libcap library APIs that expose the user to these
+ * details, and that way we don't need to foce clients to link any
+ * other libraries to access them.
+ */
+#ifndef XATTR_SECURITY_PREFIX
 #define XATTR_SECURITY_PREFIX "security."
+#endif /* ndef XATTR_SECURITY_PREFIX */
+
+extern ssize_t getxattr(const char *, const char *, void *, size_t);
+extern ssize_t fgetxattr(int, const char *, void *, size_t);
+extern int setxattr(const char *, const char *, const void *, size_t, int);
+extern int fsetxattr(int, const char *, const void *, size_t, int);
+extern int removexattr(const char *, const char *);
+extern int fremovexattr(int, const char *);
 
 #include "libcap.h"
 
diff --git a/progs/Makefile b/progs/Makefile
index 778149e..c094a24 100644
--- a/progs/Makefile
+++ b/progs/Makefile
@@ -4,10 +4,7 @@
 #
 # Programs: all of the examples that we will compile
 #
-PROGS=getpcaps capsh
-ifeq ($(LIBATTR),yes)
-PROGS += getcap setcap
-endif
+PROGS=getpcaps capsh getcap setcap
 
 BUILD=$(PROGS)