]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-sharedlibs.m4
6e6b582392602ead3dff7bdfe8f7eea31b5f3d5b
[thirdparty/cups.git] / config-scripts / cups-sharedlibs.m4
1 dnl
2 dnl Shared library support for CUPS.
3 dnl
4 dnl Copyright 2007-2017 by Apple Inc.
5 dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
6 dnl
7 dnl These coded instructions, statements, and computer programs are the
8 dnl property of Apple Inc. and are protected by Federal copyright
9 dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 dnl which should have been included with this file. If this file is
11 dnl missing or damaged, see the license at "http://www.cups.org/".
12 dnl
13
14 PICFLAG=1
15 DSOFLAGS="${DSOFLAGS:=}"
16
17 AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
18
19 cupsbase="cups"
20 LIBCUPSBASE="lib$cupsbase"
21 LIBCUPSSTATIC="lib$cupsbase.a"
22
23 if test x$enable_shared != xno; then
24 case "$host_os_name" in
25 sunos*)
26 LIBCUPS="lib$cupsbase.so.2"
27 LIBCUPSCGI="libcupscgi.so.1"
28 LIBCUPSIMAGE="libcupsimage.so.2"
29 LIBCUPSMIME="libcupsmime.so.1"
30 LIBCUPSPPDC="libcupsppdc.so.1"
31 DSO="\$(CC)"
32 DSOXX="\$(CXX)"
33 DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G \$(OPTIM)"
34 ;;
35 linux* | gnu* | *bsd*)
36 LIBCUPS="lib$cupsbase.so.2"
37 LIBCUPSCGI="libcupscgi.so.1"
38 LIBCUPSIMAGE="libcupsimage.so.2"
39 LIBCUPSMIME="libcupsmime.so.1"
40 LIBCUPSPPDC="libcupsppdc.so.1"
41 DSO="\$(CC)"
42 DSOXX="\$(CXX)"
43 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
44 ;;
45 darwin*)
46 LIBCUPS="lib$cupsbase.2.dylib"
47 LIBCUPSCGI="libcupscgi.1.dylib"
48 LIBCUPSIMAGE="libcupsimage.2.dylib"
49 LIBCUPSMIME="libcupsmime.1.dylib"
50 LIBCUPSPPDC="libcupsppdc.1.dylib"
51 DSO="\$(CC)"
52 DSOXX="\$(CXX)"
53 DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
54 ;;
55 *)
56 echo "Warning: shared libraries may not be supported. Trying -shared"
57 echo " option with compiler."
58 LIBCUPS="lib$cupsbase.so.2"
59 LIBCUPSCGI="libcupscgi.so.1"
60 LIBCUPSIMAGE="libcupsimage.so.2"
61 LIBCUPSMIME="libcupsmime.so.1"
62 LIBCUPSPPDC="libcupsppdc.so.1"
63 DSO="\$(CC)"
64 DSOXX="\$(CXX)"
65 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
66 ;;
67 esac
68 else
69 PICFLAG=0
70 LIBCUPS="lib$cupsbase.a"
71 LIBCUPSCGI="libcupscgi.a"
72 LIBCUPSIMAGE="libcupsimage.a"
73 LIBCUPSMIME="libcupsmime.a"
74 LIBCUPSPPDC="libcupsppdc.a"
75 DSO=":"
76 DSOXX=":"
77 fi
78
79 AC_SUBST(DSO)
80 AC_SUBST(DSOXX)
81 AC_SUBST(DSOFLAGS)
82 AC_SUBST(LIBCUPS)
83 AC_SUBST(LIBCUPSBASE)
84 AC_SUBST(LIBCUPSCGI)
85 AC_SUBST(LIBCUPSIMAGE)
86 AC_SUBST(LIBCUPSMIME)
87 AC_SUBST(LIBCUPSPPDC)
88 AC_SUBST(LIBCUPSSTATIC)
89
90 if test x$enable_shared = xno; then
91 LINKCUPS="../cups/lib$cupsbase.a"
92 LINKCUPSIMAGE="../filter/libcupsimage.a"
93
94 EXTLINKCUPS="-lcups"
95 EXTLINKCUPSIMAGE="-lcupsimage"
96 else
97 LINKCUPS="-l${cupsbase}"
98 LINKCUPSIMAGE="-lcupsimage"
99
100 EXTLINKCUPS="-lcups"
101 EXTLINKCUPSIMAGE="-lcupsimage"
102 fi
103
104 AC_SUBST(EXTLINKCUPS)
105 AC_SUBST(EXTLINKCUPSIMAGE)
106 AC_SUBST(LINKCUPS)
107 AC_SUBST(LINKCUPSIMAGE)
108
109 dnl Update libraries for DSOs...
110 EXPORT_LDFLAGS=""
111
112 if test "$DSO" != ":"; then
113 # When using DSOs the image libraries are linked to libcupsimage.so
114 # rather than to the executables. This makes things smaller if you
115 # are using any static libraries, and it also allows us to distribute
116 # a single DSO rather than a bunch...
117 DSOLIBS="\$(LIBZ)"
118 IMGLIBS=""
119
120 # Tell the run-time linkers where to find a DSO. Some platforms
121 # need this option, even when the library is installed in a
122 # standard location...
123 case $host_os_name in
124 sunos*)
125 # Solaris...
126 if test $exec_prefix != /usr; then
127 DSOFLAGS="-R$libdir $DSOFLAGS"
128 LDFLAGS="$LDFLAGS -R$libdir"
129 EXPORT_LDFLAGS="-R$libdir"
130 fi
131 ;;
132 *bsd*)
133 # *BSD...
134 if test $exec_prefix != /usr; then
135 DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
136 LDFLAGS="$LDFLAGS -Wl,-R$libdir"
137 EXPORT_LDFLAGS="-Wl,-R$libdir"
138 fi
139 ;;
140 linux* | gnu*)
141 # Linux, and HURD...
142 if test $exec_prefix != /usr; then
143 DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
144 LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
145 EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
146 fi
147 ;;
148 esac
149 else
150 DSOLIBS=""
151 IMGLIBS="\$(LIBZ)"
152 fi
153
154 AC_SUBST(DSOLIBS)
155 AC_SUBST(IMGLIBS)
156 AC_SUBST(EXPORT_LDFLAGS)