2 dnl Shared library support for CUPS.
4 dnl Copyright © 2007-2018 by Apple Inc.
5 dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved.
7 dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
12 DSOFLAGS="${DSOFLAGS:=}"
14 AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
17 LIBCUPSBASE="lib$cupsbase"
19 LIBCUPSSTATIC="lib$cupsbase.a"
21 if test x$enable_shared != xno; then
22 case "$host_os_name" in
24 LIBCUPS="lib$cupsbase.so.2"
25 if test "x$cupsimagebase" != x; then
26 LIBCUPSIMAGE="lib$cupsimagebase.so.2"
30 DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
32 linux* | gnu* | *bsd*)
33 LIBCUPS="lib$cupsbase.so.2"
34 if test "x$cupsimagebase" != x; then
35 LIBCUPSIMAGE="lib$cupsimagebase.so.2"
39 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
42 LIBCUPS="lib$cupsbase.2.dylib"
43 if test "x$cupsimagebase" != x; then
44 LIBCUPSIMAGE="lib$cupsimagebase.2.dylib"
48 DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
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"
59 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
64 LIBCUPS="lib$cupsbase.a"
65 if test "x$cupsimagebase" != x; then
66 LIBCUPSIMAGE="lib$cupsimagebase.a"
77 AC_SUBST(LIBCUPSIMAGE)
78 AC_SUBST(LIBCUPSSTATIC)
80 if test x$enable_shared = xno; then
81 LINKCUPS="../cups/lib$cupsbase.a"
84 if test "x$cupsimagebase" != x; then
85 LINKCUPSIMAGE="../cups/lib$cupsimagebase.a"
86 EXTLINKCUPSIMAGE="-l$cupsimagebase"
92 LINKCUPS="-l${cupsbase}"
95 if test "x$cupsimagebase" != x; then
96 LINKCUPSIMAGE="-l$cupsimagebase"
97 EXTLINKCUPSIMAGE="-l$cupsimagebase"
104 AC_SUBST(EXTLINKCUPS)
105 AC_SUBST(EXTLINKCUPSIMAGE)
107 AC_SUBST(LINKCUPSIMAGE)
109 dnl Update libraries for DSOs...
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...
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
126 if test $exec_prefix != /usr; then
127 DSOFLAGS="-R$libdir $DSOFLAGS"
128 LDFLAGS="$LDFLAGS -R$libdir"
129 EXPORT_LDFLAGS="-R$libdir"
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"
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"
156 AC_SUBST(EXPORT_LDFLAGS)