]> git.ozlabs.org Git - ppp.git/blob - pppd/Makefile.linux
pppd: Use a run-time test to detect libutil availability on Linux
[ppp.git] / pppd / Makefile.linux
1 #
2 # pppd makefile for Linux
3 # Processed by configure to produce pppd/Makefile
4 #
5
6 # Default installation locations
7 DESTDIR = $(INSTROOT)@DESTDIR@
8 BINDIR = $(DESTDIR)/sbin
9 MANDIR = $(DESTDIR)/share/man/man8
10 INCDIR = $(DESTDIR)/include
11
12 TARGETS = pppd
13
14 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap-new.c md5.c ccp.c \
15            ecp.c ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c \
16            demand.c utils.c tty.c eap.c chap-md5.c session.c
17
18 HEADERS = ccp.h session.h chap-new.h ecp.h fsm.h ipcp.h \
19         ipxcp.h lcp.h magic.h md5.h patchlevel.h pathnames.h pppd.h \
20         upap.h eap.h
21
22 MANPAGES = pppd.8
23 PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap-new.o md5.o ccp.o \
24            ecp.o auth.o options.o demand.o utils.o sys-linux.o ipxcp.o tty.o \
25            eap.o chap-md5.o session.o
26
27 #
28 # include dependencies if present
29 ifeq (.depend,$(wildcard .depend))
30 include .depend
31 endif
32
33 # CC = gcc
34 #
35 COPTS = -O2 -pipe -Wall -g
36 LIBS = -lrt
37
38 # Uncomment the next line to include support for Microsoft's
39 # MS-CHAP authentication protocol.  Also, edit plugins/radius/Makefile.linux.
40 CHAPMS=y
41 #USE_CRYPT=y
42 # Don't use MSLANMAN unless you really know what you're doing.
43 #MSLANMAN=y
44 # Uncomment the next line to include support for MPPE.  CHAPMS (above) must
45 # also be enabled.  Also, edit plugins/radius/Makefile.linux.
46 MPPE=y
47
48 # Uncomment the next line to include support for PPP packet filtering.
49 # This requires that the libpcap library and headers be installed
50 # and that the kernel driver support PPP packet filtering.
51 FILTER=y
52
53 # Uncomment the next line to enable multilink PPP (enabled by default)
54 # Linux distributions: Please leave multilink ENABLED in your builds
55 # of pppd!
56 HAVE_MULTILINK=y
57
58 # Uncomment the next line to enable the TDB database (enabled by default.)
59 # If you enable multilink, then TDB is automatically enabled also.
60 # Linux distributions: Please leave TDB ENABLED in your builds.
61 USE_TDB=y
62
63 # Uncomment the next line to enable Type=notify services in systemd
64 # If enabled, and the user sets the up_sdnotify option, then
65 # pppd will not detach and will notify systemd when up.
66 #SYSTEMD=y
67
68 HAS_SHADOW=y
69 #USE_PAM=y
70 HAVE_INET6=y
71
72 # Enable plugins
73 PLUGIN=y
74
75 # Enable Microsoft proprietary Callback Control Protocol
76 #CBCP=y
77
78 # Enable EAP SRP-SHA1 authentication (requires libsrp)
79 #USE_SRP=y
80
81 # Use libutil; test if logwtmp is declared in <utmp.h> to detect
82 ifeq ($(shell echo '\#include <utmp.h>' | $(CC) -E - 2>/dev/null | grep -q logwtmp && echo yes),yes)
83 USE_LIBUTIL=y
84 endif
85
86 # Enable EAP-TLS authentication (requires MPPE support, libssl and libcrypto)
87 USE_EAPTLS=y
88
89 MAXOCTETS=y
90
91 INCLUDE_DIRS= -I../include
92
93 COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP
94
95 CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"'
96
97 ifdef CHAPMS
98 CFLAGS   += -DCHAPMS=1
99 NEEDDES=y
100 PPPDOBJS += md4.o chap_ms.o
101 HEADERS += md4.h chap_ms.h
102 ifdef MSLANMAN
103 CFLAGS   += -DMSLANMAN=1
104 endif
105 ifdef MPPE
106 CFLAGS   += -DMPPE=1
107 HEADERS  += mppe.h
108 endif
109 endif
110
111 # EAP SRP-SHA1
112 ifdef USE_SRP
113 CFLAGS  += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
114 LIBS    += -lsrp -L/usr/local/ssl/lib
115 NEEDCRYPTOLIB = y
116 TARGETS += srp-entry
117 EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry
118 MANPAGES += srp-entry.8
119 EXTRACLEAN += srp-entry.o
120 NEEDDES=y
121 else
122 # OpenSSL has an integrated version of SHA-1, and its implementation
123 # is incompatible with this local SHA-1 implementation.  We must use
124 # one or the other, not both.
125 PPPDSRCS += sha1.c
126 HEADERS += sha1.h
127 PPPDOBJS += sha1.o
128 endif
129
130 # EAP-TLS
131 ifdef USE_EAPTLS
132 CFLAGS += -DUSE_EAPTLS=1
133 LIBS += -lssl
134 NEEDCRYPTOLIB = y
135 PPPDSRC += eap-tls.c
136 HEADERS += eap-tls.h
137 PPPDOBJS += eap-tls.o
138 endif
139
140 ifdef HAS_SHADOW
141 CFLAGS   += -DHAS_SHADOW
142 #LIBS     += -lshadow $(LIBS)
143 endif
144
145 ifeq ($(shell echo '\#include <crypt.h>' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes)
146 CFLAGS  += -DHAVE_CRYPT_H=1
147 LIBS    += -lcrypt
148 endif
149
150 ifdef USE_LIBUTIL
151 CFLAGS  += -DHAVE_LOGWTMP=1
152 LIBS    += -lutil
153 endif
154
155 ifdef NEEDDES
156 ifndef USE_CRYPT
157 CFLAGS   += -I$(shell $(CC) --print-sysroot)/usr/include/openssl
158 NEEDCRYPTOLIB = y
159 else
160 CFLAGS   += -DUSE_CRYPT=1
161 endif
162 PPPDOBJS += pppcrypt.o
163 HEADERS += pppcrypt.h
164 endif
165
166 ifdef NEEDCRYPTOLIB
167 LIBS     += -lcrypto
168 endif
169
170 # For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
171 ifdef USE_PAM
172 CFLAGS   += -DUSE_PAM
173 LIBS     += -lpam -ldl
174 endif
175
176 # Multi-linnk
177 ifdef HAVE_MULTILINK
178         # Multilink implies the use of TDB
179         USE_TDB=y
180
181         CFLAGS += -DHAVE_MULTILINK
182         PPPDSRCS += multilink.c
183         PPPDOBJS += multilink.o
184 endif
185
186 # TDB
187 ifdef USE_TDB
188         CFLAGS += -DUSE_TDB=1
189         PPPDSRCS += tdb.c spinlock.c
190         PPPDOBJS += tdb.o spinlock.o
191         HEADERS += tdb.h spinlock.h
192 endif
193
194 # Lock library binary for Linux is included in 'linux' subdirectory.
195 ifdef LOCKLIB
196 LIBS     += -llock
197 CFLAGS   += -DLOCKLIB=1
198 endif
199
200 ifdef SYSTEMD
201 LIBS += -lsystemd
202 CFLAGS   += -DSYSTEMD=1
203 endif
204
205 ifdef PLUGIN
206 CFLAGS  += -DPLUGIN
207 LDFLAGS_PLUGIN  += -Wl,-E
208 LIBS    += -ldl
209 endif
210
211 ifdef FILTER
212 LIBS    += -lpcap
213 CFLAGS  += -DPPP_FILTER
214 endif
215
216 ifdef HAVE_INET6
217      PPPDSRCS += ipv6cp.c eui64.c
218      HEADERS  += ipv6cp.h eui64.h
219      PPPDOBJS += ipv6cp.o eui64.o
220      CFLAGS   += -DINET6=1
221 endif
222
223 ifdef CBCP
224      PPPDSRCS += cbcp.c
225      PPPDOBJS += cbcp.o
226      CFLAGS += -DCBCP_SUPPORT
227      HEADERS += cbcp.h
228 endif
229
230 ifdef MAXOCTETS
231      CFLAGS += -DMAXOCTETS
232 endif
233
234 INSTALL= install
235
236 all: $(TARGETS)
237
238 install: pppd
239         mkdir -p $(BINDIR) $(MANDIR)
240         $(EXTRAINSTALL)
241         $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd
242         if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
243           chmod o-rx,u+s $(BINDIR)/pppd; fi
244         $(INSTALL) -c -m 444 pppd.8 $(MANDIR)
245
246 pppd: $(PPPDOBJS)
247         $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_PLUGIN) -o pppd $(PPPDOBJS) $(LIBS)
248
249 srp-entry:      srp-entry.c
250         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ srp-entry.c $(LIBS)
251
252 install-devel:
253         mkdir -p $(INCDIR)/pppd
254         $(INSTALL) -c -m 644 $(HEADERS) $(INCDIR)/pppd
255
256 clean:
257         rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *~ #* core
258
259 depend:
260         $(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend