]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Modernize cups-shared.m4.
authorMichael R Sweet <msweet@msweet.org>
Sat, 6 Mar 2021 23:43:21 +0000 (18:43 -0500)
committerMichael R Sweet <msweet@msweet.org>
Sat, 6 Mar 2021 23:43:21 +0000 (18:43 -0500)
config-scripts/cups-sharedlibs.m4
configure

index 6070f211e3188711e614d3d37dd4fb2f261c4153..4ff926888428faad5f5e92a7f56581cdd78c66fc 100644 (file)
@@ -1,6 +1,7 @@
 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
@@ -8,119 +9,109 @@ dnl Licensed under Apache License v2.0.  See the file "LICENSE" for more
 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])
index 171755d82ba0100f1d796b2a4d2d77330c537ee3..0197480b0f935857595cc439bbcb48257b324839 100755 (executable)
--- a/configure
+++ b/configure
@@ -7588,7 +7588,7 @@ esac
 fi
 
 
-PICFLAG=1
+PICFLAG="1"
 DSOFLAGS="${DSOFLAGS:=}"
 
 # Check whether --enable-shared was given.
@@ -7603,71 +7603,102 @@ 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=":"
+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
 
 
@@ -7675,36 +7706,53 @@ 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