dnl
dnl Shared library support for CUPS.
dnl
+dnl Copyright © 2021 by OpenPrinting.
dnl Copyright © 2007-2018 by Apple Inc.
dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl information.
dnl
-PICFLAG=1
+PICFLAG="1"
DSOFLAGS="${DSOFLAGS:=}"
-AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
+AC_ARG_ENABLE([shared], AS_HELP_STRING([--disable-shared], [do not create shared libraries]))
cupsbase="cups"
LIBCUPSBASE="lib$cupsbase"
LIBCUPSIMAGE=""
LIBCUPSSTATIC="lib$cupsbase.a"
-if test x$enable_shared != xno; then
- case "$host_os_name" in
- sunos*)
- LIBCUPS="lib$cupsbase.so.2"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.so.2"
- fi
- DSO="\$(CC)"
- DSOXX="\$(CXX)"
- DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
- ;;
- linux* | gnu* | *bsd*)
- LIBCUPS="lib$cupsbase.so.2"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.so.2"
- fi
- DSO="\$(CC)"
- DSOXX="\$(CXX)"
- DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
- ;;
- darwin*)
- LIBCUPS="lib$cupsbase.2.dylib"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.2.dylib"
- fi
- DSO="\$(CC)"
- DSOXX="\$(CXX)"
- DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
- ;;
- *)
- echo "Warning: shared libraries may not be supported. Trying -shared"
- echo " option with compiler."
- LIBCUPS="lib$cupsbase.so.2"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.so.2"
- fi
- DSO="\$(CC)"
- DSOXX="\$(CXX)"
- DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
- ;;
- esac
-else
- PICFLAG=0
- LIBCUPS="lib$cupsbase.a"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.a"
- fi
- DSO=":"
- DSOXX=":"
-fi
+AS_IF([test x$enable_shared != xno], [
+ AS_CASE(["$host_os_name"], [sunos*], [
+ LIBCUPS="lib$cupsbase.so.2"
+ AS_IF([test "x$cupsimagebase" != x], [
+ LIBCUPSIMAGE="lib$cupsimagebase.so.2"
+ ])
+ DSO="\$(CC)"
+ DSOXX="\$(CXX)"
+ DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
+ ], [linux* | gnu* | *bsd*], [
+ LIBCUPS="lib$cupsbase.so.2"
+ AS_IF([test "x$cupsimagebase" != x], [
+ LIBCUPSIMAGE="lib$cupsimagebase.so.2"
+ ])
+ DSO="\$(CC)"
+ DSOXX="\$(CXX)"
+ DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
+ ], [darwin*], [
+ LIBCUPS="lib$cupsbase.2.dylib"
+ AS_IF([test "x$cupsimagebase" != x], [
+ LIBCUPSIMAGE="lib$cupsimagebase.2.dylib"
+ ])
+ DSO="\$(CC)"
+ DSOXX="\$(CXX)"
+ DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
+ ], [*], [
+ AC_MSG_NOTICE([Warning: Shared libraries may not work, trying -shared option.])
+ LIBCUPS="lib$cupsbase.so.2"
+ AS_IF([test "x$cupsimagebase" != x], [
+ LIBCUPSIMAGE="lib$cupsimagebase.so.2"
+ ])
+ DSO="\$(CC)"
+ DSOXX="\$(CXX)"
+ DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
+ ])
+], [
+ PICFLAG=0
+ LIBCUPS="lib$cupsbase.a"
+ AS_IF([test "x$cupsimagebase" != x], [
+ LIBCUPSIMAGE="lib$cupsimagebase.a"
+ ])
+ DSO=":"
+ DSOXX=":"
+])
-AC_SUBST(DSO)
-AC_SUBST(DSOXX)
-AC_SUBST(DSOFLAGS)
-AC_SUBST(LIBCUPS)
-AC_SUBST(LIBCUPSBASE)
-AC_SUBST(LIBCUPSIMAGE)
-AC_SUBST(LIBCUPSSTATIC)
+AC_SUBST([DSO])
+AC_SUBST([DSOXX])
+AC_SUBST([DSOFLAGS])
+AC_SUBST([LIBCUPS])
+AC_SUBST([LIBCUPSBASE])
+AC_SUBST([LIBCUPSIMAGE])
+AC_SUBST([LIBCUPSSTATIC])
-if test x$enable_shared = xno; then
- LINKCUPS="../cups/lib$cupsbase.a \$(LIBS)"
- EXTLINKCUPS="-lcups \$LIBS"
-else
- LINKCUPS="-L../cups -l${cupsbase}"
- EXTLINKCUPS="-lcups"
-fi
+AS_IF([test x$enable_shared = xno], [
+ LINKCUPS="../cups/lib$cupsbase.a \$(LIBS)"
+ EXTLINKCUPS="-lcups \$LIBS"
+], [
+ LINKCUPS="-L../cups -l${cupsbase}"
+ EXTLINKCUPS="-lcups"
+])
-AC_SUBST(EXTLINKCUPS)
-AC_SUBST(LINKCUPS)
+AC_SUBST([EXTLINKCUPS])
+AC_SUBST([LINKCUPS])
dnl Update libraries for DSOs...
EXPORT_LDFLAGS=""
-if test "$DSO" != ":"; then
- # Tell the run-time linkers where to find a DSO. Some platforms
- # need this option, even when the library is installed in a
- # standard location...
- case $host_os_name in
- sunos*)
- # Solaris...
- if test $exec_prefix != /usr; then
- DSOFLAGS="-R$libdir $DSOFLAGS"
- LDFLAGS="$LDFLAGS -R$libdir"
- EXPORT_LDFLAGS="-R$libdir"
- fi
- ;;
- *bsd*)
- # *BSD...
- if test $exec_prefix != /usr; then
- DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-R$libdir"
- EXPORT_LDFLAGS="-Wl,-R$libdir"
- fi
- ;;
- linux* | gnu*)
- # Linux, and HURD...
- if test $exec_prefix != /usr; then
- DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
- EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
- fi
- ;;
- esac
-fi
+AS_IF([test "$DSO" != ":"], [
+ # Tell the run-time linkers where to find a DSO. Some platforms
+ # need this option, even when the library is installed in a
+ # standard location...
+ AS_CASE([$host_os_name], [sunos*], [
+ # Solaris...
+ AS_IF([test $exec_prefix != /usr], [
+ DSOFLAGS="-R$libdir $DSOFLAGS"
+ LDFLAGS="$LDFLAGS -R$libdir"
+ EXPORT_LDFLAGS="-R$libdir"
+ ])
+ ], [*bsd*], [
+ # *BSD...
+ AS_IF([test $exec_prefix != /usr], [
+ DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,-R$libdir"
+ EXPORT_LDFLAGS="-Wl,-R$libdir"
+ ])
+ ], [linux* | gnu*], [
+ # Linux, and HURD...
+ AS_IF([test $exec_prefix != /usr], [
+ DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
+ EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
+ ])
+ ])
+])
-AC_SUBST(EXPORT_LDFLAGS)
+AC_SUBST([EXPORT_LDFLAGS])
fi
-PICFLAG=1
+PICFLAG="1"
DSOFLAGS="${DSOFLAGS:=}"
# Check whether --enable-shared was given.
LIBCUPSIMAGE=""
LIBCUPSSTATIC="lib$cupsbase.a"
-if test x$enable_shared != xno; then
- case "$host_os_name" in
- sunos*)
- LIBCUPS="lib$cupsbase.so.2"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.so.2"
- fi
- DSO="\$(CC)"
- DSOXX="\$(CXX)"
- DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
- ;;
- linux* | gnu* | *bsd*)
- LIBCUPS="lib$cupsbase.so.2"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.so.2"
- fi
- DSO="\$(CC)"
- DSOXX="\$(CXX)"
- DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
- ;;
- darwin*)
- LIBCUPS="lib$cupsbase.2.dylib"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.2.dylib"
- fi
- DSO="\$(CC)"
- DSOXX="\$(CXX)"
- DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
- ;;
- *)
- echo "Warning: shared libraries may not be supported. Trying -shared"
- echo " option with compiler."
- LIBCUPS="lib$cupsbase.so.2"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.so.2"
- fi
- DSO="\$(CC)"
- DSOXX="\$(CXX)"
- DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
- ;;
- esac
-else
- PICFLAG=0
- LIBCUPS="lib$cupsbase.a"
- if test "x$cupsimagebase" != x; then
- LIBCUPSIMAGE="lib$cupsimagebase.a"
- fi
- DSO=":"
- DSOXX=":"
+if test x$enable_shared != xno
+then :
+
+ case "$host_os_name" in #(
+ sunos*) :
+
+ LIBCUPS="lib$cupsbase.so.2"
+ if test "x$cupsimagebase" != x
+then :
+
+ LIBCUPSIMAGE="lib$cupsimagebase.so.2"
+
+fi
+ DSO="\$(CC)"
+ DSOXX="\$(CXX)"
+ DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
+ ;; #(
+ linux* | gnu* | *bsd*) :
+
+ LIBCUPS="lib$cupsbase.so.2"
+ if test "x$cupsimagebase" != x
+then :
+
+ LIBCUPSIMAGE="lib$cupsimagebase.so.2"
+
fi
+ DSO="\$(CC)"
+ DSOXX="\$(CXX)"
+ DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
+ ;; #(
+ darwin*) :
+
+ LIBCUPS="lib$cupsbase.2.dylib"
+ if test "x$cupsimagebase" != x
+then :
+
+ LIBCUPSIMAGE="lib$cupsimagebase.2.dylib"
+fi
+ DSO="\$(CC)"
+ DSOXX="\$(CXX)"
+ DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
+ ;; #(
+ *) :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Warning: Shared libraries may not work, trying -shared option." >&5
+printf "%s\n" "$as_me: Warning: Shared libraries may not work, trying -shared option." >&6;}
+ LIBCUPS="lib$cupsbase.so.2"
+ if test "x$cupsimagebase" != x
+then :
+ LIBCUPSIMAGE="lib$cupsimagebase.so.2"
+fi
+ DSO="\$(CC)"
+ DSOXX="\$(CXX)"
+ DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
+ ;; #(
+ *) :
+ ;;
+esac
+else $as_nop
+ PICFLAG=0
+ LIBCUPS="lib$cupsbase.a"
+ if test "x$cupsimagebase" != x
+then :
+ LIBCUPSIMAGE="lib$cupsimagebase.a"
+fi
+ DSO=":"
+ DSOXX=":"
+
+fi
+
+
+
+
+
+
+
+
+
+if test x$enable_shared = xno
+then :
+
+ LINKCUPS="../cups/lib$cupsbase.a \$(LIBS)"
+ EXTLINKCUPS="-lcups \$LIBS"
+
+else $as_nop
+
+ LINKCUPS="-L../cups -l${cupsbase}"
+ EXTLINKCUPS="-lcups"
-if test x$enable_shared = xno; then
- LINKCUPS="../cups/lib$cupsbase.a \$(LIBS)"
- EXTLINKCUPS="-lcups \$LIBS"
-else
- LINKCUPS="-L../cups -l${cupsbase}"
- EXTLINKCUPS="-lcups"
fi
EXPORT_LDFLAGS=""
-if test "$DSO" != ":"; then
- # Tell the run-time linkers where to find a DSO. Some platforms
- # need this option, even when the library is installed in a
- # standard location...
- case $host_os_name in
- sunos*)
- # Solaris...
- if test $exec_prefix != /usr; then
- DSOFLAGS="-R$libdir $DSOFLAGS"
- LDFLAGS="$LDFLAGS -R$libdir"
- EXPORT_LDFLAGS="-R$libdir"
- fi
- ;;
- *bsd*)
- # *BSD...
- if test $exec_prefix != /usr; then
- DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-R$libdir"
- EXPORT_LDFLAGS="-Wl,-R$libdir"
- fi
- ;;
- linux* | gnu*)
- # Linux, and HURD...
- if test $exec_prefix != /usr; then
- DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
- EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
- fi
- ;;
- esac
+if test "$DSO" != ":"
+then :
+
+ # Tell the run-time linkers where to find a DSO. Some platforms
+ # need this option, even when the library is installed in a
+ # standard location...
+ case $host_os_name in #(
+ sunos*) :
+
+ # Solaris...
+ if test $exec_prefix != /usr
+then :
+
+ DSOFLAGS="-R$libdir $DSOFLAGS"
+ LDFLAGS="$LDFLAGS -R$libdir"
+ EXPORT_LDFLAGS="-R$libdir"
+
+fi
+ ;; #(
+ *bsd*) :
+
+ # *BSD...
+ if test $exec_prefix != /usr
+then :
+
+ DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,-R$libdir"
+ EXPORT_LDFLAGS="-Wl,-R$libdir"
+
+fi
+ ;; #(
+ linux* | gnu*) :
+
+ # Linux, and HURD...
+ if test $exec_prefix != /usr
+then :
+
+ DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
+ EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
+
+fi
+ ;; #(
+ *) :
+ ;;
+esac
+
fi