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 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/".
15 DSOFLAGS="${DSOFLAGS:=}"
17 AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
20 LIBCUPSBASE="lib$cupsbase"
21 LIBCUPSSTATIC="lib$cupsbase.a"
23 if test x$enable_shared != xno; then
24 case "$host_os_name" in
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"
33 DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G \$(OPTIM)"
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"
43 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
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"
53 DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
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"
65 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
70 LIBCUPS="lib$cupsbase.a"
71 LIBCUPSCGI="libcupscgi.a"
72 LIBCUPSIMAGE="libcupsimage.a"
73 LIBCUPSMIME="libcupsmime.a"
74 LIBCUPSPPDC="libcupsppdc.a"
85 AC_SUBST(LIBCUPSIMAGE)
88 AC_SUBST(LIBCUPSSTATIC)
90 if test x$enable_shared = xno; then
91 LINKCUPS="../cups/lib$cupsbase.a"
92 LINKCUPSIMAGE="../filter/libcupsimage.a"
95 EXTLINKCUPSIMAGE="-lcupsimage"
97 LINKCUPS="-l${cupsbase}"
98 LINKCUPSIMAGE="-lcupsimage"
101 EXTLINKCUPSIMAGE="-lcupsimage"
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)