]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-sharedlibs.m4
Fix an issue with `PreserveJobHistory` and time values (Issue #5538)
[thirdparty/cups.git] / config-scripts / cups-sharedlibs.m4
1 dnl
2 dnl Shared library support for CUPS.
3 dnl
4 dnl Copyright © 2007-2018 by Apple Inc.
5 dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved.
6 dnl
7 dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
8 dnl information.
9 dnl
10
11 PICFLAG=1
12 DSOFLAGS="${DSOFLAGS:=}"
13
14 AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
15
16 cupsbase="cups"
17 LIBCUPSBASE="lib$cupsbase"
18 LIBCUPSIMAGE=""
19 LIBCUPSSTATIC="lib$cupsbase.a"
20
21 if test x$enable_shared != xno; then
22 case "$host_os_name" in
23 sunos*)
24 LIBCUPS="lib$cupsbase.so.2"
25 if test "x$cupsimagebase" != x; then
26 LIBCUPSIMAGE="lib$cupsimagebase.so.2"
27 fi
28 DSO="\$(CC)"
29 DSOXX="\$(CXX)"
30 DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
31 ;;
32 linux* | gnu* | *bsd*)
33 LIBCUPS="lib$cupsbase.so.2"
34 if test "x$cupsimagebase" != x; then
35 LIBCUPSIMAGE="lib$cupsimagebase.so.2"
36 fi
37 DSO="\$(CC)"
38 DSOXX="\$(CXX)"
39 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
40 ;;
41 darwin*)
42 LIBCUPS="lib$cupsbase.2.dylib"
43 if test "x$cupsimagebase" != x; then
44 LIBCUPSIMAGE="lib$cupsimagebase.2.dylib"
45 fi
46 DSO="\$(CC)"
47 DSOXX="\$(CXX)"
48 DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
49 ;;
50 *)
51 echo "Warning: shared libraries may not be supported. Trying -shared"
52 echo " option with compiler."
53 LIBCUPS="lib$cupsbase.so.2"
54 if test "x$cupsimagebase" != x; then
55 LIBCUPSIMAGE="lib$cupsimagebase.so.2"
56 fi
57 DSO="\$(CC)"
58 DSOXX="\$(CXX)"
59 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
60 ;;
61 esac
62 else
63 PICFLAG=0
64 LIBCUPS="lib$cupsbase.a"
65 if test "x$cupsimagebase" != x; then
66 LIBCUPSIMAGE="lib$cupsimagebase.a"
67 fi
68 DSO=":"
69 DSOXX=":"
70 fi
71
72 AC_SUBST(DSO)
73 AC_SUBST(DSOXX)
74 AC_SUBST(DSOFLAGS)
75 AC_SUBST(LIBCUPS)
76 AC_SUBST(LIBCUPSBASE)
77 AC_SUBST(LIBCUPSIMAGE)
78 AC_SUBST(LIBCUPSSTATIC)
79
80 if test x$enable_shared = xno; then
81 LINKCUPS="../cups/lib$cupsbase.a"
82 EXTLINKCUPS="-lcups"
83
84 if test "x$cupsimagebase" != x; then
85 LINKCUPSIMAGE="../cups/lib$cupsimagebase.a"
86 EXTLINKCUPSIMAGE="-l$cupsimagebase"
87 else
88 LINKCUPSIMAGE=""
89 EXTLINKCUPSIMAGE=""
90 fi
91 else
92 LINKCUPS="-l${cupsbase}"
93 EXTLINKCUPS="-lcups"
94
95 if test "x$cupsimagebase" != x; then
96 LINKCUPSIMAGE="-l$cupsimagebase"
97 EXTLINKCUPSIMAGE="-l$cupsimagebase"
98 else
99 LINKCUPSIMAGE=""
100 EXTLINKCUPSIMAGE=""
101 fi
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)