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 \$(LIBS)"
82 EXTLINKCUPS="-lcups \$LIBS"
84 LINKCUPS="-L../cups -l${cupsbase}"
91 dnl Update libraries for DSOs...
94 if test "$DSO" != ":"; then
95 # Tell the run-time linkers where to find a DSO. Some platforms
96 # need this option, even when the library is installed in a
97 # standard location...
101 if test $exec_prefix != /usr; then
102 DSOFLAGS="-R$libdir $DSOFLAGS"
103 LDFLAGS="$LDFLAGS -R$libdir"
104 EXPORT_LDFLAGS="-R$libdir"
109 if test $exec_prefix != /usr; then
110 DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
111 LDFLAGS="$LDFLAGS -Wl,-R$libdir"
112 EXPORT_LDFLAGS="-Wl,-R$libdir"
117 if test $exec_prefix != /usr; then
118 DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
119 LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
120 EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
126 AC_SUBST(EXPORT_LDFLAGS)