xref: /aosp_15_r20/external/libcups/config-scripts/cups-sharedlibs.m4 (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1*5e7646d2SAndroid Build Coastguard Workerdnl
2*5e7646d2SAndroid Build Coastguard Workerdnl Shared library support for CUPS.
3*5e7646d2SAndroid Build Coastguard Workerdnl
4*5e7646d2SAndroid Build Coastguard Workerdnl Copyright © 2007-2018 by Apple Inc.
5*5e7646d2SAndroid Build Coastguard Workerdnl Copyright © 1997-2005 by Easy Software Products, all rights reserved.
6*5e7646d2SAndroid Build Coastguard Workerdnl
7*5e7646d2SAndroid Build Coastguard Workerdnl Licensed under Apache License v2.0.  See the file "LICENSE" for more
8*5e7646d2SAndroid Build Coastguard Workerdnl information.
9*5e7646d2SAndroid Build Coastguard Workerdnl
10*5e7646d2SAndroid Build Coastguard Worker
11*5e7646d2SAndroid Build Coastguard WorkerPICFLAG=1
12*5e7646d2SAndroid Build Coastguard WorkerDSOFLAGS="${DSOFLAGS:=}"
13*5e7646d2SAndroid Build Coastguard Worker
14*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(shared, [  --disable-shared        do not create shared libraries])
15*5e7646d2SAndroid Build Coastguard Worker
16*5e7646d2SAndroid Build Coastguard Workercupsbase="cups"
17*5e7646d2SAndroid Build Coastguard WorkerLIBCUPSBASE="lib$cupsbase"
18*5e7646d2SAndroid Build Coastguard WorkerLIBCUPSIMAGE=""
19*5e7646d2SAndroid Build Coastguard WorkerLIBCUPSSTATIC="lib$cupsbase.a"
20*5e7646d2SAndroid Build Coastguard Worker
21*5e7646d2SAndroid Build Coastguard Workerif test x$enable_shared != xno; then
22*5e7646d2SAndroid Build Coastguard Worker	case "$host_os_name" in
23*5e7646d2SAndroid Build Coastguard Worker		sunos*)
24*5e7646d2SAndroid Build Coastguard Worker			LIBCUPS="lib$cupsbase.so.2"
25*5e7646d2SAndroid Build Coastguard Worker			if test "x$cupsimagebase" != x; then
26*5e7646d2SAndroid Build Coastguard Worker				LIBCUPSIMAGE="lib$cupsimagebase.so.2"
27*5e7646d2SAndroid Build Coastguard Worker			fi
28*5e7646d2SAndroid Build Coastguard Worker			DSO="\$(CC)"
29*5e7646d2SAndroid Build Coastguard Worker			DSOXX="\$(CXX)"
30*5e7646d2SAndroid Build Coastguard Worker			DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
31*5e7646d2SAndroid Build Coastguard Worker			;;
32*5e7646d2SAndroid Build Coastguard Worker		linux* | gnu* | *bsd*)
33*5e7646d2SAndroid Build Coastguard Worker			LIBCUPS="lib$cupsbase.so.2"
34*5e7646d2SAndroid Build Coastguard Worker			if test "x$cupsimagebase" != x; then
35*5e7646d2SAndroid Build Coastguard Worker				LIBCUPSIMAGE="lib$cupsimagebase.so.2"
36*5e7646d2SAndroid Build Coastguard Worker			fi
37*5e7646d2SAndroid Build Coastguard Worker			DSO="\$(CC)"
38*5e7646d2SAndroid Build Coastguard Worker			DSOXX="\$(CXX)"
39*5e7646d2SAndroid Build Coastguard Worker			DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
40*5e7646d2SAndroid Build Coastguard Worker			;;
41*5e7646d2SAndroid Build Coastguard Worker		darwin*)
42*5e7646d2SAndroid Build Coastguard Worker			LIBCUPS="lib$cupsbase.2.dylib"
43*5e7646d2SAndroid Build Coastguard Worker			if test "x$cupsimagebase" != x; then
44*5e7646d2SAndroid Build Coastguard Worker				LIBCUPSIMAGE="lib$cupsimagebase.2.dylib"
45*5e7646d2SAndroid Build Coastguard Worker			fi
46*5e7646d2SAndroid Build Coastguard Worker			DSO="\$(CC)"
47*5e7646d2SAndroid Build Coastguard Worker			DSOXX="\$(CXX)"
48*5e7646d2SAndroid Build Coastguard Worker			DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
49*5e7646d2SAndroid Build Coastguard Worker			;;
50*5e7646d2SAndroid Build Coastguard Worker		*)
51*5e7646d2SAndroid Build Coastguard Worker			echo "Warning: shared libraries may not be supported.  Trying -shared"
52*5e7646d2SAndroid Build Coastguard Worker			echo "         option with compiler."
53*5e7646d2SAndroid Build Coastguard Worker			LIBCUPS="lib$cupsbase.so.2"
54*5e7646d2SAndroid Build Coastguard Worker			if test "x$cupsimagebase" != x; then
55*5e7646d2SAndroid Build Coastguard Worker				LIBCUPSIMAGE="lib$cupsimagebase.so.2"
56*5e7646d2SAndroid Build Coastguard Worker			fi
57*5e7646d2SAndroid Build Coastguard Worker			DSO="\$(CC)"
58*5e7646d2SAndroid Build Coastguard Worker			DSOXX="\$(CXX)"
59*5e7646d2SAndroid Build Coastguard Worker			DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
60*5e7646d2SAndroid Build Coastguard Worker			;;
61*5e7646d2SAndroid Build Coastguard Worker	esac
62*5e7646d2SAndroid Build Coastguard Workerelse
63*5e7646d2SAndroid Build Coastguard Worker	PICFLAG=0
64*5e7646d2SAndroid Build Coastguard Worker	LIBCUPS="lib$cupsbase.a"
65*5e7646d2SAndroid Build Coastguard Worker	if test "x$cupsimagebase" != x; then
66*5e7646d2SAndroid Build Coastguard Worker		LIBCUPSIMAGE="lib$cupsimagebase.a"
67*5e7646d2SAndroid Build Coastguard Worker	fi
68*5e7646d2SAndroid Build Coastguard Worker	DSO=":"
69*5e7646d2SAndroid Build Coastguard Worker	DSOXX=":"
70*5e7646d2SAndroid Build Coastguard Workerfi
71*5e7646d2SAndroid Build Coastguard Worker
72*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(DSO)
73*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(DSOXX)
74*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(DSOFLAGS)
75*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBCUPS)
76*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBCUPSBASE)
77*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBCUPSIMAGE)
78*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBCUPSSTATIC)
79*5e7646d2SAndroid Build Coastguard Worker
80*5e7646d2SAndroid Build Coastguard Workerif test x$enable_shared = xno; then
81*5e7646d2SAndroid Build Coastguard Worker	LINKCUPS="../cups/lib$cupsbase.a \$(LIBS)"
82*5e7646d2SAndroid Build Coastguard Worker	EXTLINKCUPS="-lcups \$LIBS"
83*5e7646d2SAndroid Build Coastguard Workerelse
84*5e7646d2SAndroid Build Coastguard Worker	LINKCUPS="-L../cups -l${cupsbase}"
85*5e7646d2SAndroid Build Coastguard Worker	EXTLINKCUPS="-lcups"
86*5e7646d2SAndroid Build Coastguard Workerfi
87*5e7646d2SAndroid Build Coastguard Worker
88*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(EXTLINKCUPS)
89*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LINKCUPS)
90*5e7646d2SAndroid Build Coastguard Worker
91*5e7646d2SAndroid Build Coastguard Workerdnl Update libraries for DSOs...
92*5e7646d2SAndroid Build Coastguard WorkerEXPORT_LDFLAGS=""
93*5e7646d2SAndroid Build Coastguard Worker
94*5e7646d2SAndroid Build Coastguard Workerif test "$DSO" != ":"; then
95*5e7646d2SAndroid Build Coastguard Worker	# Tell the run-time linkers where to find a DSO.  Some platforms
96*5e7646d2SAndroid Build Coastguard Worker	# need this option, even when the library is installed in a
97*5e7646d2SAndroid Build Coastguard Worker	# standard location...
98*5e7646d2SAndroid Build Coastguard Worker	case $host_os_name in
99*5e7646d2SAndroid Build Coastguard Worker                sunos*)
100*5e7646d2SAndroid Build Coastguard Worker                	# Solaris...
101*5e7646d2SAndroid Build Coastguard Worker			if test $exec_prefix != /usr; then
102*5e7646d2SAndroid Build Coastguard Worker				DSOFLAGS="-R$libdir $DSOFLAGS"
103*5e7646d2SAndroid Build Coastguard Worker				LDFLAGS="$LDFLAGS -R$libdir"
104*5e7646d2SAndroid Build Coastguard Worker				EXPORT_LDFLAGS="-R$libdir"
105*5e7646d2SAndroid Build Coastguard Worker			fi
106*5e7646d2SAndroid Build Coastguard Worker			;;
107*5e7646d2SAndroid Build Coastguard Worker                *bsd*)
108*5e7646d2SAndroid Build Coastguard Worker                        # *BSD...
109*5e7646d2SAndroid Build Coastguard Worker			if test $exec_prefix != /usr; then
110*5e7646d2SAndroid Build Coastguard Worker				DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
111*5e7646d2SAndroid Build Coastguard Worker				LDFLAGS="$LDFLAGS -Wl,-R$libdir"
112*5e7646d2SAndroid Build Coastguard Worker				EXPORT_LDFLAGS="-Wl,-R$libdir"
113*5e7646d2SAndroid Build Coastguard Worker			fi
114*5e7646d2SAndroid Build Coastguard Worker			;;
115*5e7646d2SAndroid Build Coastguard Worker                linux* | gnu*)
116*5e7646d2SAndroid Build Coastguard Worker                        # Linux, and HURD...
117*5e7646d2SAndroid Build Coastguard Worker			if test $exec_prefix != /usr; then
118*5e7646d2SAndroid Build Coastguard Worker				DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
119*5e7646d2SAndroid Build Coastguard Worker				LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
120*5e7646d2SAndroid Build Coastguard Worker				EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
121*5e7646d2SAndroid Build Coastguard Worker			fi
122*5e7646d2SAndroid Build Coastguard Worker			;;
123*5e7646d2SAndroid Build Coastguard Worker	esac
124*5e7646d2SAndroid Build Coastguard Workerfi
125*5e7646d2SAndroid Build Coastguard Worker
126*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(EXPORT_LDFLAGS)
127