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"
18 LIBCUPSSTATIC="lib$cupsbase.a"
20 if test x$enable_shared != xno; then
21 case "$host_os_name" in
23 LIBCUPS="lib$cupsbase.so.2"
24 LIBCUPSIMAGE="libcupsimage.so.2"
27 DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G \$(OPTIM)"
29 linux* | gnu* | *bsd*)
30 LIBCUPS="lib$cupsbase.so.2"
31 LIBCUPSIMAGE="libcupsimage.so.2"
34 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
37 LIBCUPS="lib$cupsbase.2.dylib"
38 LIBCUPSIMAGE="libcupsimage.2.dylib"
41 DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
44 echo "Warning: shared libraries may not be supported. Trying -shared"
45 echo " option with compiler."
46 LIBCUPS="lib$cupsbase.so.2"
47 LIBCUPSIMAGE="libcupsimage.so.2"
50 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
55 LIBCUPS="lib$cupsbase.a"
56 LIBCUPSIMAGE="libcupsimage.a"
66 AC_SUBST(LIBCUPSIMAGE)
67 AC_SUBST(LIBCUPSSTATIC)
69 if test x$enable_shared = xno; then
70 LINKCUPS="../cups/lib$cupsbase.a"
71 LINKCUPSIMAGE="../cups/libcupsimage.a"
74 EXTLINKCUPSIMAGE="-lcupsimage"
76 LINKCUPS="-l${cupsbase}"
77 LINKCUPSIMAGE="-lcupsimage"
80 EXTLINKCUPSIMAGE="-lcupsimage"
84 AC_SUBST(EXTLINKCUPSIMAGE)
86 AC_SUBST(LINKCUPSIMAGE)
88 dnl Update libraries for DSOs...
91 if test "$DSO" != ":"; then
92 # When using DSOs the image libraries are linked to libcupsimage.so
93 # rather than to the executables. This makes things smaller if you
94 # are using any static libraries, and it also allows us to distribute
95 # a single DSO rather than a bunch...
99 # Tell the run-time linkers where to find a DSO. Some platforms
100 # need this option, even when the library is installed in a
101 # standard location...
102 case $host_os_name in
105 if test $exec_prefix != /usr; then
106 DSOFLAGS="-R$libdir $DSOFLAGS"
107 LDFLAGS="$LDFLAGS -R$libdir"
108 EXPORT_LDFLAGS="-R$libdir"
113 if test $exec_prefix != /usr; then
114 DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
115 LDFLAGS="$LDFLAGS -Wl,-R$libdir"
116 EXPORT_LDFLAGS="-Wl,-R$libdir"
121 if test $exec_prefix != /usr; then
122 DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
123 LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
124 EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
135 AC_SUBST(EXPORT_LDFLAGS)