summaryrefslogtreecommitdiff
path: root/source3/lib/replace/libreplace_ld.m4
blob: d3d3f9464fc98024ef3dd306ed66dbc0c597c4f0 (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
AC_DEFUN([AC_LD_EXPORT_DYNAMIC],
[
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
AC_LINK_IFELSE([ int main() { return 0; } ],
[ LD_EXPORT_DYNAMIC=-Wl,--export-dynamic  ],
[ LD_EXPORT_DYNAMIC= ])
AC_SUBST(LD_EXPORT_DYNAMIC)
LDFLAGS="$saved_LDFLAGS"
])

AC_DEFUN([AC_LD_PICFLAG],
[
case "$host_os" in
	*linux*) 
		PICFLAG="-fPIC" 
		;;
	*solaris*)
		if test "${GCC}" = "yes"; then
			PICFLAG="-fPIC"
		else
			PICFLAG="-KPIC"
		fi
		;;
	*sunos*)
		PICFLAG="-KPIC"   # Is this correct for SunOS
		;;
	*netbsd* | *freebsd* | *dragonfly* )  
		PICFLAG="-fPIC -DPIC"
		;;
	*openbsd*)
		PICFLAG="-fPIC"
		;;
	*irix*)
		if test "${GCC}" = "yes"; then
			PICFLAG="-fPIC"
		else 
			PICFLAG="-KPIC"
		fi
		;;
	*aix*)
		# as AIX code is always position independent...
		PICFLAG="-O2"
		;;
	*hpux*)
		if test $ac_cv_prog_cc_Ae = yes; then
			PICFLAG="+z +ESnolit"
		elif test "${GCC}" = "yes"; then
			PICFLAG="-fPIC"
		fi
		if test "$host_cpu" = "ia64"; then
			PICFLAG="+z"
		fi
		;;
	*osf*)
		PICFLAG="-fPIC"
		;;
	*unixware*)
		PICFLAG="-KPIC"
		;;
	*darwin*)
		;;
esac
AC_SUBST(PICFLAG)
])