2 dnl Shared library support for CUPS.
4 dnl Copyright 2007-2017 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 information.
11 DSOFLAGS="${DSOFLAGS:=}"
13 AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
16 LIBCUPSBASE="lib$cupsbase"
17 LIBCUPSSTATIC="lib$cupsbase.a"
19 if test x$enable_shared != xno; then
20 case "$host_os_name" in
22 LIBCUPS="lib$cupsbase.so.2"
23 LIBCUPSCGI="libcupscgi.so.1"
24 LIBCUPSIMAGE="libcupsimage.so.2"
25 LIBCUPSMIME="libcupsmime.so.1"
26 LIBCUPSPPDC="libcupsppdc.so.1"
29 DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G \$(OPTIM)"
31 linux* | gnu* | *bsd*)
32 LIBCUPS="lib$cupsbase.so.2"
33 LIBCUPSCGI="libcupscgi.so.1"
34 LIBCUPSIMAGE="libcupsimage.so.2"
35 LIBCUPSMIME="libcupsmime.so.1"
36 LIBCUPSPPDC="libcupsppdc.so.1"
39 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
42 LIBCUPS="lib$cupsbase.2.dylib"
43 LIBCUPSCGI="libcupscgi.1.dylib"
44 LIBCUPSIMAGE="libcupsimage.2.dylib"
45 LIBCUPSMIME="libcupsmime.1.dylib"
46 LIBCUPSPPDC="libcupsppdc.1.dylib"
49 DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
52 echo "Warning: shared libraries may not be supported. Trying -shared"
53 echo " option with compiler."
54 LIBCUPS="lib$cupsbase.so.2"
55 LIBCUPSCGI="libcupscgi.so.1"
56 LIBCUPSIMAGE="libcupsimage.so.2"
57 LIBCUPSMIME="libcupsmime.so.1"
58 LIBCUPSPPDC="libcupsppdc.so.1"
61 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
66 LIBCUPS="lib$cupsbase.a"
67 LIBCUPSCGI="libcupscgi.a"
68 LIBCUPSIMAGE="libcupsimage.a"
69 LIBCUPSMIME="libcupsmime.a"
70 LIBCUPSPPDC="libcupsppdc.a"
81 AC_SUBST(LIBCUPSIMAGE)
84 AC_SUBST(LIBCUPSSTATIC)
86 if test x$enable_shared = xno; then
87 LINKCUPS="../cups/lib$cupsbase.a"
88 LINKCUPSIMAGE="../filter/libcupsimage.a"
91 EXTLINKCUPSIMAGE="-lcupsimage"
93 LINKCUPS="-l${cupsbase}"
94 LINKCUPSIMAGE="-lcupsimage"
97 EXTLINKCUPSIMAGE="-lcupsimage"
100 AC_SUBST(EXTLINKCUPS)
101 AC_SUBST(EXTLINKCUPSIMAGE)
103 AC_SUBST(LINKCUPSIMAGE)
105 dnl Update libraries for DSOs...
108 if test "$DSO" != ":"; then
109 # When using DSOs the image libraries are linked to libcupsimage.so
110 # rather than to the executables. This makes things smaller if you
111 # are using any static libraries, and it also allows us to distribute
112 # a single DSO rather than a bunch...
116 # Tell the run-time linkers where to find a DSO. Some platforms
117 # need this option, even when the library is installed in a
118 # standard location...
119 case $host_os_name in
122 if test $exec_prefix != /usr; then
123 DSOFLAGS="-R$libdir $DSOFLAGS"
124 LDFLAGS="$LDFLAGS -R$libdir"
125 EXPORT_LDFLAGS="-R$libdir"
130 if test $exec_prefix != /usr; then
131 DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
132 LDFLAGS="$LDFLAGS -Wl,-R$libdir"
133 EXPORT_LDFLAGS="-Wl,-R$libdir"
138 if test $exec_prefix != /usr; then
139 DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
140 LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
141 EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
152 AC_SUBST(EXPORT_LDFLAGS)