Browse code

- sun ld autodetection

Andrei Pelinescu-Onciul authored on 10/09/2002 17:04:28
Showing 1 changed files
... ...
@@ -8,7 +8,7 @@
8 8
 VERSION = 0
9 9
 PATCHLEVEL = 8
10 10
 SUBLEVEL = 7
11
-EXTRAVERSION = -13
11
+EXTRAVERSION = -13-1
12 12
 
13 13
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
14 14
 OS = $(shell uname -s)
... ...
@@ -177,6 +177,32 @@ $(warning	Unknown compiler $(CC)\; supported compilers: \
177 177
 			gcc, sun cc, intel icc )
178 178
 endif
179 179
 
180
+# find ldname (gnu or solaris)
181
+ifeq ($(ARCH), sparc64)
182
+ifeq ($(CC_NAME), gcc)
183
+		LDGCC=$(shell $(CC) -v 2>&1 | grep with-ld| \
184
+				   sed -e 's/.*--with-ld=\([^ ][^ ]*\).*/\1/' )
185
+		LDPATH=$(shell  if [ -z "$(LDGCC)" ] ; then echo "ld" ;\
186
+						else \
187
+						if $(LDGCC) -V 2>/dev/null 1>/dev/null; then \
188
+							echo $(LDGCC); \
189
+						else echo "ld" ; \
190
+						fi\
191
+						fi)
192
+						
193
+		LDTYPE=$(shell if $(LDPATH) -V 1>/dev/null  2>/dev/null; then \
194
+							if $(LDPATH) -V 2>&1|grep GNU >/dev/null; \
195
+							then echo gnu; \
196
+							else \
197
+							if $(LDPATH) -V 2>&1|grep Solaris >/dev/null;\
198
+							then echo solaris; \
199
+							else \
200
+								echo unknown ; \
201
+							fi \
202
+							fi \
203
+						fi)
204
+endif
205
+endif
180 206
 
181 207
 # arh. specific definitions
182 208
 ifeq ($(ARCH), i386)
... ...
@@ -322,15 +348,30 @@ endif	#ARCH, i386
322 348
 
323 349
 # setting LDFLAGS
324 350
 ifeq	($(CC_NAME), gcc)
325
-	#gcc and maybe others
326
-	LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
351
+ifeq		($(ARCH), sparc64)
352
+ifeq			($(LDTYPE), solaris)
353
+					# solaris ld
354
+					LDFLAGS+=-O2 $(PROFILE)
355
+					MOD_LDFLAGS=-G $(LDFLAGS)
356
+else			
357
+					#gcc and maybe others, on solaris, with gnu ld
358
+					LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
359
+					MOD_LDFLAGS=-shared $(LDFLAGS)
360
+endif
361
+else
362
+			#gcc and maybe others
363
+			LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
364
+			MOD_LDFLAGS=-shared $(LDFLAGS)
365
+endif
327 366
 endif
328 367
 ifeq	($(CC_NAME), icc)
329 368
 	#gcc and maybe others
330 369
 	LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
370
+	MOD_LDFLAGS=-shared $(LDFLAGS)
331 371
 endif
332 372
 ifeq	($(CC_NAME), suncc)
333 373
 	LDFLAGS+=-xO5 $(PROFILE)
374
+	MOD_LDFLAGS=-G $(LDFLAGS)
334 375
 endif
335 376
 	# we need -fPIC -DPIC only for shared objects, we don't need them for
336 377
 	# the executable file, because it's always loaded at a fixed address
... ...
@@ -338,15 +379,28 @@ endif
338 379
 else	#mode,release
339 380
 ifeq	($(CC_NAME), gcc)
340 381
 		CFLAGS=-g -Wcast-align -Winline $(PROFILE)
341
-		LDFLAGS+=-g -Wl,-E $(PROFILE)
382
+ifeq		($(ARCH), sparc64)
383
+			CFLAGS+= -mcpu=ultrasparc 
384
+endif
385
+ifeq		($(LDTYPE), solaris)
386
+			#solaris ld
387
+			LDFLAGS+=-g $(PROFILE)
388
+			MOD_LDFLAGS=-G $(LDFLAGS)
389
+else
390
+			#gnu or other ld type
391
+			LDFLAGS+=-g -Wl,-E $(PROFILE)
392
+			MOD_LDFLAGS=-shared $(LDFLAGS)
393
+endif
342 394
 endif
343 395
 ifeq	($(CC_NAME), icc)
344 396
 		CFLAGS=-g  $(PROFILE)
345 397
 		LDFLAGS+=-g -Wl,-E $(PROFILE)
398
+		MOD_LDFLAGS=-shared $(LDFLAGS)
346 399
 endif
347 400
 ifeq	($(CC_NAME), suncc)
348 401
 		CFLAGS= -g $(PROFILE)
349 402
 		LDFLAGS+=-g $(PROFILE)
403
+		MOD_LDFLAGS=-G $(LDFLAGS)
350 404
 endif
351 405
 
352 406
 endif #mode=release
... ...
@@ -355,15 +409,12 @@ endif #mode=release
355 409
 #*FLAGS used for compiling the modules
356 410
 ifeq	($(CC_NAME), gcc)
357 411
 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
358
-MOD_LDFLAGS=-shared $(LDFLAGS)
359 412
 endif
360 413
 ifeq	($(CC_NAME), icc)
361 414
 MOD_CFLAGS=-Kpic $(CFLAGS)
362
-MOD_LDFLAGS=-shared $(LDFLAGS)
363 415
 endif
364 416
 ifeq	($(CC_NAME), suncc)
365 417
 MOD_CFLAGS=-Kpic  $(CFLAGS)
366
-MOD_LDFLAGS=-G $(LDFLAGS)
367 418
 endif
368 419
 
369 420
 LEX=flex
... ...
@@ -394,7 +445,7 @@ ifeq  ($(OS), SunOS)
394 445
 ifeq ($(CC_NAME), suncc)
395 446
 	LIBS=-lfast
396 447
 endif
397
-	LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lxnet -lrt
448
+	LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lxnet -lrt -lnsl
398 449
 	# -lrt needed for sched_yield
399 450
 endif
400 451