Skip to content

Commit a0569b5

Browse files
authored
Merge pull request #128 from garlick/build_cleanup
drop TCP Wrappers support + misc. build system cleanup
2 parents bd0d3ac + cf4bfac commit a0569b5

22 files changed

+38
-186
lines changed

Makefile.am

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
SUBDIRS = \
22
src \
33
man \
4-
etc
5-
6-
if ENABLE_TESTS
7-
SUBDIRS += tests
8-
endif
4+
etc \
5+
tests
96

107
EXTRA_DIST = diod.spec
118

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#### On Debian
99
```
10-
sudo apt-get install build-essential libpopt-dev ncurses-dev automake autoconf git pkgconf
11-
sudo apt-get install lua5.1 liblua5.1-dev libmunge-dev libwrap0-dev libcap-dev libattr1-dev
10+
sudo apt-get install build-essential ncurses-dev automake autoconf git pkgconf
11+
sudo apt-get install lua5.1 liblua5.1-dev libmunge-dev libcap-dev libattr1-dev
1212
./autogen.sh
1313
./configure
1414
make
@@ -19,7 +19,7 @@ make check
1919

2020
```
2121
sudo yum install epel-release gperftools-devel ncurses-devel automake autoconf libattr-devel
22-
sudo yum install lua lua-devel munge-devel tcp_wrappers-devel libcap-devel pkgconf
22+
sudo yum install lua lua-devel munge-devel libcap-devel pkgconf
2323
./autogen.sh
2424
./configure
2525
make

config/x_ac_wrap.m4

-27
This file was deleted.

configure.ac

+3-50
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ PKG_CHECK_MODULES([ncurses], [ncurses])
5454
# Checks for header files.
5555
##
5656
AC_CHECK_HEADERS( \
57-
getopt.h \
5857
pthread.h \
5958
sys/prctl.h \
6059
sys/statfs.h \
@@ -72,14 +71,10 @@ AC_C_CONST
7271
# Checks for library functions
7372
##
7473
AC_CHECK_FUNCS( \
75-
getopt_long \
76-
vsnprintf \
77-
vsscanf \
7874
utimensat \
7975
)
8076
AC_FUNC_STRERROR_R
8177
X_AC_CHECK_PTHREADS
82-
X_AC_WRAP
8378
X_AC_CHECK_COND_LIB(munge, munge_ctx_create)
8479
X_AC_CHECK_COND_LIB(cap, cap_get_proc)
8580
X_AC_TCMALLOC
@@ -98,13 +93,8 @@ AC_SYS_LARGEFILE
9893
# Optional features
9994
##
10095
AC_ARG_ENABLE([diodmount],
101-
[AS_HELP_STRING([--disable-diodmount], [do not build diodmount])],
102-
[],
103-
[enable_diodmount=auto])
104-
AC_ARG_ENABLE([tests],
105-
[AS_HELP_STRING([--disable-tests], [do not build tests])],
106-
[],
107-
[enable_tests=auto])
96+
[AS_HELP_STRING([--disable-diodmount], [do not build diodmount])])
97+
10898
AC_ARG_ENABLE([impersonation],
10999
[AS_HELP_STRING([--enable-impersonation], [allow access=user])],
110100
[],
@@ -126,18 +116,6 @@ AS_IF([test "x$enable_config" != "xno"], [
126116

127117
case "${host_os}" in
128118
linux*)
129-
case "${enable_diodmount}" in
130-
no)
131-
;;
132-
*)
133-
enable_diodmount=yes;;
134-
esac
135-
case "${enable_tests}" in
136-
no)
137-
;;
138-
*)
139-
enable_tests=yes;;
140-
esac
141119
case "${enable_impersonation}" in
142120
no)
143121
;;
@@ -148,18 +126,6 @@ case "${host_os}" in
148126
esac
149127
;;
150128
freebsd*)
151-
case "${enable_diodmount}" in
152-
yes)
153-
;;
154-
*)
155-
enable_diodmount=no;;
156-
esac
157-
case "${enable_tests}" in
158-
yes)
159-
;;
160-
*)
161-
enable_tests=no;;
162-
esac
163129
case "${enable_impersonation}" in
164130
no|auto)
165131
enable_impersonation=no;;
@@ -170,18 +136,6 @@ case "${host_os}" in
170136
esac
171137
;;
172138
*)
173-
case "${enable_diodmount}" in
174-
yes)
175-
;;
176-
*)
177-
enable_diodmount=no;;
178-
esac
179-
case "${enable_tests}" in
180-
yes)
181-
;;
182-
*)
183-
enable_tests=no;;
184-
esac
185139
case "${enable_impersonation}" in
186140
no|auto)
187141
enable_impersonation=no;;
@@ -191,8 +145,7 @@ case "${host_os}" in
191145
;;
192146
esac
193147

194-
AM_CONDITIONAL([ENABLE_DIODMOUNT], [test "x${enable_diodmount}" = "xyes"])
195-
AM_CONDITIONAL([ENABLE_TESTS], [test "x${enable_tests}" = "xyes"])
148+
AM_CONDITIONAL([ENABLE_DIODMOUNT], [test "x${enable_diodmount}" != "xno"])
196149
AM_CONDITIONAL([USE_IMPERSONATION_LINUX], [test "x${enable_impersonation}" = "xlinux"])
197150
AM_CONDITIONAL([USE_IMPERSONATION_GANESHA], [test "x${enable_impersonation}" = "xganesha"])
198151

debian/control

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Standards-Version: 4.1.2
66
Build-Depends:
77
debhelper (>= 10),
88
libncurses-dev,
9-
libpopt-dev,
109
lua5.1,
1110
liblua5.1-dev
1211

diod.spec.in

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ URL: http://github.com/chaos/diod
99
Source0: %{name}-%{version}.tar.gz
1010
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
1111

12-
BuildRequires: tcp_wrappers-devel
1312
BuildRequires: lua-devel
1413
BuildRequires: munge-devel
1514
BuildRequires: ncurses-devel

scripts/install-deps-deb.sh

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ apt install \
66
make \
77
pkg-config \
88
libc6-dev \
9-
libpopt-dev \
109
libncurses-dev \
1110
libcap2-dev \
1211
lua5.1 \

src/cmd/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ common_ldadd = \
1717
$(top_builddir)/src/libnpfs/libnpfs.a \
1818
$(top_builddir)/src/liblsd/liblsd.a \
1919
$(top_builddir)/src/libdiod/libdiod.a \
20-
$(LIBWRAP) $(LIBPTHREAD) $(LUA_LIB) $(LIBMUNGE) $(LIBCAP) \
20+
$(LIBPTHREAD) $(LUA_LIB) $(LIBMUNGE) $(LIBCAP) \
2121
$(LIBIBVERBS) $(LIBRDMACM) $(LIBTCMALLOC) $(ncurses_LIBS)
2222

2323
common_sources = \

src/cmd/diod.c

+3-10
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
#include <sys/syscall.h>
2626
#endif
2727
#include <stdio.h>
28-
#if HAVE_GETOPT_H
2928
#include <getopt.h>
30-
#endif
3129
#include <errno.h>
3230
#include <pwd.h>
3331
#include <grp.h>
@@ -68,10 +66,8 @@ static void _service_run (srvmode_t mode, int rfdno, int wfdno);
6866
#define NR_OPEN 1048576 /* works on RHEL 5 x86_64 arch */
6967
#endif
7068

71-
#define OPTIONS "fr:w:d:l:t:e:Eo:u:SL:nHpc:NU:s"
69+
static const char *options = "fr:w:d:l:t:e:Eo:u:SL:nHpc:NU:s";
7270

73-
#if HAVE_GETOPT_LONG
74-
#define GETOPT(ac,av,opt,lopt) getopt_long (ac,av,opt,lopt,NULL)
7571
static const struct option longopts[] = {
7672
{"foreground", no_argument, 0, 'f'},
7773
{"rfdno", required_argument, 0, 'r'},
@@ -94,9 +90,6 @@ static const struct option longopts[] = {
9490
{"socktest", no_argument, 0, 's'},
9591
{0, 0, 0, 0},
9692
};
97-
#else
98-
#define GETOPT(ac,av,opt,lopt) getopt (ac,av,opt)
99-
#endif
10093

10194
static void
10295
usage()
@@ -139,7 +132,7 @@ main(int argc, char **argv)
139132

140133
/* config file overrides defaults */
141134
opterr = 0;
142-
while ((c = GETOPT (argc, argv, OPTIONS, longopts)) != -1) {
135+
while ((c = getopt_long (argc, argv, options, longopts, NULL)) != -1) {
143136
switch (c) {
144137
case 'c': /* --config-file PATH */
145138
copt = optarg;
@@ -154,7 +147,7 @@ main(int argc, char **argv)
154147
*/
155148
optind = 0;
156149
opterr = 0;
157-
while ((c = GETOPT (argc, argv, OPTIONS, longopts)) != -1) {
150+
while ((c = getopt_long (argc, argv, options, longopts, NULL)) != -1) {
158151
switch (c) {
159152
case 'f': /* --foreground */
160153
diod_conf_set_foreground (1);

src/cmd/diodcat.c

+3-9
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
#include <stdint.h>
2222
#include <stdarg.h>
2323
#include <stdio.h>
24-
#if HAVE_GETOPT_H
2524
#include <getopt.h>
26-
#endif
2725
#include <string.h>
2826
#include <errno.h>
2927
#include <ctype.h>
@@ -38,9 +36,8 @@
3836
#include "src/libdiod/diod_sock.h"
3937
#include "src/libdiod/diod_auth.h"
4038

41-
#define OPTIONS "a:s:m:u:t:p"
42-
#if HAVE_GETOPT_LONG
43-
#define GETOPT(ac,av,opt,lopt) getopt_long (ac,av,opt,lopt,NULL)
39+
static const char *options = "a:s:m:u:t:p";
40+
4441
static const struct option longopts[] = {
4542
{"aname", required_argument, 0, 'a'},
4643
{"server", required_argument, 0, 's'},
@@ -50,9 +47,6 @@ static const struct option longopts[] = {
5047
{"privport",no_argument, 0, 'p'},
5148
{0, 0, 0, 0},
5249
};
53-
#else
54-
#define GETOPT(ac,av,opt,lopt) getopt (ac,av,opt)
55-
#endif
5650

5751
static int catfiles (int fd, uid_t uid, int msize, char *aname,
5852
char **av, int ac);
@@ -87,7 +81,7 @@ main (int argc, char *argv[])
8781
diod_log_init (argv[0]);
8882

8983
opterr = 0;
90-
while ((c = GETOPT (argc, argv, OPTIONS, longopts)) != -1) {
84+
while ((c = getopt_long (argc, argv, options, longopts, NULL)) != -1) {
9185
switch (c) {
9286
case 'a': /* --aname NAME */
9387
aname = optarg;

src/cmd/dioddate.c

+3-9
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
#include <inttypes.h>
2525
#include <stdarg.h>
2626
#include <stdio.h>
27-
#if HAVE_GETOPT_H
2827
#include <getopt.h>
29-
#endif
3028
#include <string.h>
3129
#include <errno.h>
3230
#include <ctype.h>
@@ -41,9 +39,8 @@
4139
#include "src/libdiod/diod_sock.h"
4240
#include "src/libdiod/diod_auth.h"
4341

44-
#define OPTIONS "s:m:u:t:S"
45-
#if HAVE_GETOPT_LONG
46-
#define GETOPT(ac,av,opt,lopt) getopt_long (ac,av,opt,lopt,NULL)
42+
static const char *options = "s:m:u:t:S";
43+
4744
static const struct option longopts[] = {
4845
{"server", required_argument, 0, 's'},
4946
{"msize", required_argument, 0, 'm'},
@@ -52,9 +49,6 @@ static const struct option longopts[] = {
5249
{"set-time",no_argument, 0, 'S'},
5350
{0, 0, 0, 0},
5451
};
55-
#else
56-
#define GETOPT(ac,av,opt,lopt) getopt (ac,av,opt)
57-
#endif
5852

5953
static void sigalarm (int arg);
6054

@@ -92,7 +86,7 @@ main (int argc, char *argv[])
9286
diod_log_init (argv[0]);
9387

9488
opterr = 0;
95-
while ((c = GETOPT (argc, argv, OPTIONS, longopts)) != -1) {
89+
while ((c = getopt_long (argc, argv, options, longopts, NULL)) != -1) {
9690
switch (c) {
9791
case 's': /* --server HOST[:PORT] or /path/to/socket */
9892
server = optarg;

src/cmd/diodload.c

+3-9
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
#include <inttypes.h>
2323
#include <stdarg.h>
2424
#include <stdio.h>
25-
#if HAVE_GETOPT_H
2625
#include <getopt.h>
27-
#endif
2826
#include <string.h>
2927
#include <errno.h>
3028
#include <ctype.h>
@@ -41,9 +39,8 @@
4139
#include "src/libdiod/diod_sock.h"
4240
#include "src/libdiod/diod_auth.h"
4341

44-
#define OPTIONS "s:m:n:r:g"
45-
#if HAVE_GETOPT_LONG
46-
#define GETOPT(ac,av,opt,lopt) getopt_long (ac,av,opt,lopt,NULL)
42+
static const char *options = "s:m:n:r:g";
43+
4744
static const struct option longopts[] = {
4845
{"server", required_argument, 0, 's'},
4946
{"msize", required_argument, 0, 'm'},
@@ -52,9 +49,6 @@ static const struct option longopts[] = {
5249
{"getattr", no_argument, 0, 'g'},
5350
{0, 0, 0, 0},
5451
};
55-
#else
56-
#define GETOPT(ac,av,opt,lopt) getopt (ac,av,opt)
57-
#endif
5852

5953
typedef enum { LOAD_IO, LOAD_GETATTR } load_t;
6054

@@ -109,7 +103,7 @@ main (int argc, char *argv[])
109103
diod_log_init (argv[0]);
110104

111105
opterr = 0;
112-
while ((c = GETOPT (argc, argv, OPTIONS, longopts)) != -1) {
106+
while ((c = getopt_long (argc, argv, options, longopts, NULL)) != -1) {
113107
switch (c) {
114108
case 's': /* --server HOST[:PORT] or /path/to/socket */
115109
server = optarg;

0 commit comments

Comments
 (0)