summaryrefslogtreecommitdiff
blob: a61696b6fb1681022d144b2455acf2fbd786cc18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
--- a/Makefile.conf.in
+++ b/Makefile.conf.in
@@ -100,3 +100,6 @@ initdir = @initdir@
 
 # Location of systemd unit files
 systemddir = @systemddir@
+
+# Use the compiler determined by configure
+CC := @CC@
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -16,44 +16,30 @@ INSTALLROOT = $(DESTDIR)
 AUTOFS_LIB = ../lib/autofs.a
 
 # Compilers, linkers and flags
-# The STRIP defined here *must not* remove any dynamic-loading symbols
-
 ifdef DMALLOCLIB
 DEBUG=1
 endif
 
 ifdef DEBUG
 CFLAGS    ?= -g -Wall -DDEBUG
-LDFLAGS   = -g
-STRIP     = :
 else
-ifdef DONTSTRIP
 CFLAGS    ?= -O2 -g
-LDFLAGS   = -g
-STRIP     = :
-else
-CFLAGS    ?= -O2 -Wall
-LDFLAGS   = -s
-STRIP     = strip --strip-debug
-endif
 endif
+AUTOFS_LDFLAGS = -g
 
-CC        = gcc
-CXX       = g++
 CXXFLAGS  = $(CFLAGS)
 LD        = ld
 SOLDFLAGS = -shared
 
 CFLAGS += -D_REENTRANT -D_FILE_OFFSET_BITS=64
-LDFLAGS += -lpthread
 
 ifdef TIRPCLIB
 CFLAGS += -I/usr/include/tirpc
-LDFLAGS += $(TIRPCLIB)
+AUTOFS_LDFLAGS += $(TIRPCLIB)
 endif
 
 ifdef DMALLOCLIB
-LDFLAGS += $(DMALLOCLIB)
+AUTOFS_LDFLAGS += $(DMALLOCLIB)
 endif
 
 ifdef SASL
@@ -71,5 +57,4 @@ endif
 	$(CC) $(CFLAGS) -S $<
 
 .c.so:
-	$(CC) $(SOLDFLAGS) $(CFLAGS) -o $*.so $< $(AUTOFS_LIB) $(DMALLOCLIB) $(LIBNSL)
-	$(STRIP) $*.so
+	$(CC) $(LDFLAGS) $(SOLDFLAGS) $(CFLAGS) -o $*.so $< $(AUTOFS_LIB) $(DMALLOCLIB) $(LIBNSL)
--- a/configure.in
+++ b/configure.in
@@ -183,7 +183,7 @@ AC_ARG_WITH(hesiod,
 		: Search for Hesiod in normal directory path
 	else
 		: Search for Hesiod in specific directory
-		LDFLAGS="$LDFLAGS -L${withval}/lib"
+		LDFLAGS="$LDFLAGS -Wl,--no-as-needed -L${withval}/lib"
 		LIBHESIOD="-L${withval}/lib"
 		HESIOD_FLAGS="-I${withval}/include"
 	fi
--- a/daemon/Makefile
+++ b/daemon/Makefile
@@ -2,8 +2,8 @@
 # Makefile for autofs
 #
 
--include ../Makefile.conf
 include ../Makefile.rules
+-include ../Makefile.conf
 
 SRCS = automount.c indirect.c direct.c spawn.c module.c mount.c \
 	lookup.c state.c flag.c
@@ -20,7 +20,7 @@ CFLAGS += -DAUTOFS_FIFO_DIR=\"$(autofsfi
 CFLAGS += -DAUTOFS_FLAG_DIR=\"$(autofsflagdir)\"
 CFLAGS += -DVERSION_STRING=\"$(version)\"
 LDFLAGS += -rdynamic
-LIBS = -ldl
+LIBS = -ldl -lpthread
 
 ifeq ($(LDAP), 1)
     CFLAGS += $(XML_FLAGS)
@@ -30,8 +30,7 @@ endif
 all: automount
 
 automount: $(OBJS) $(AUTOFS_LIB)
-	$(CC) $(LDFLAGS) $(DAEMON_LDFLAGS) -o automount $(OBJS) $(AUTOFS_LIB) $(LIBS)
-	$(STRIP) automount
+	$(CC) $(AUTOFS_LDFLAGS) $(DAEMON_LDFLAGS) $(LDFLAGS) -o automount $(OBJS) $(AUTOFS_LIB) $(LIBS)
 
 clean:
 	rm -f *.o *.s *~ automount
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -41,14 +41,12 @@ mount_clnt.c: mount.h
 
 mount_clnt.o: mount_clnt.c
 	$(CC) $(CFLAGS) -o mount_clnt.o -c mount_clnt.c
-	$(STRIP) mount_clnt.o
 
 mount_xdr.c: mount.h
 	$(RPCGEN) -c -o mount_xdr.c mount.x
 
 mount_xdr.o: mount_xdr.c
 	$(CC) $(CFLAGS) -Wno-unused-variable -o mount_xdr.o -c mount_xdr.c
-	$(STRIP) mount_xdr.o
 
 master_tok.c: master_tok.l
 	$(LEX) -o$@ -Pmaster_ $?
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -87,9 +87,8 @@ endif
 # Ad hoc compilation rules for modules which need auxilliary libraries
 #
 lookup_hesiod.so: lookup_hesiod.c
-	$(CC) $(SOLDFLAGS) $(CFLAGS) $(HESIOD_FLAGS) -o lookup_hesiod.so \
+	$(CC) $(LDFLAGS) $(SOLDFLAGS) $(CFLAGS) $(HESIOD_FLAGS) -o lookup_hesiod.so \
 		lookup_hesiod.c $(AUTOFS_LIB) $(LIBHESIOD) $(LIBRESOLV)
-	$(STRIP) lookup_hesiod.so
 
 cyrus-sasl.o: cyrus-sasl.c
 	$(CC) $(CFLAGS) $(LDAP_FLAGS) -c $<
@@ -98,13 +97,10 @@ cyrus-sasl-extern.o: cyrus-sasl-extern.c
 	$(CC) $(CFLAGS) $(LDAP_FLAGS) -c $<
 
 lookup_ldap.so: lookup_ldap.c dclist.o base64.o $(SASL_OBJ)
-	$(CC) $(SOLDFLAGS) $(CFLAGS) $(LDAP_FLAGS) -o lookup_ldap.so \
+	$(CC) $(LDFLAGS) $(SOLDFLAGS) $(CFLAGS) $(LDAP_FLAGS) -o lookup_ldap.so \
 		lookup_ldap.c dclist.o base64.o $(SASL_OBJ) \
 		$(AUTOFS_LIB) $(LIBLDAP) $(LIBRESOLV)
-	$(STRIP) lookup_ldap.so
 
 mount_nfs.so: mount_nfs.c replicated.o
-	$(CC) $(SOLDFLAGS) $(CFLAGS) -o mount_nfs.so \
+	$(CC) $(LDFLAGS) $(SOLDFLAGS) $(CFLAGS) -o mount_nfs.so \
 		mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBNSL)
-	$(STRIP) mount_nfs.so
-