1dnl 2dnl Shared library support for CUPS. 3dnl 4dnl Copyright © 2007-2018 by Apple Inc. 5dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. 6dnl 7dnl Licensed under Apache License v2.0. See the file "LICENSE" for more 8dnl information. 9dnl 10 11PICFLAG=1 12DSOFLAGS="${DSOFLAGS:=}" 13 14AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries]) 15 16cupsbase="cups" 17LIBCUPSBASE="lib$cupsbase" 18LIBCUPSIMAGE="" 19LIBCUPSSTATIC="lib$cupsbase.a" 20 21if test x$enable_shared != xno; then 22 case "$host_os_name" in 23 sunos*) 24 LIBCUPS="lib$cupsbase.so.2" 25 if test "x$cupsimagebase" != x; then 26 LIBCUPSIMAGE="lib$cupsimagebase.so.2" 27 fi 28 DSO="\$(CC)" 29 DSOXX="\$(CXX)" 30 DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G" 31 ;; 32 linux* | gnu* | *bsd*) 33 LIBCUPS="lib$cupsbase.so.2" 34 if test "x$cupsimagebase" != x; then 35 LIBCUPSIMAGE="lib$cupsimagebase.so.2" 36 fi 37 DSO="\$(CC)" 38 DSOXX="\$(CXX)" 39 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared" 40 ;; 41 darwin*) 42 LIBCUPS="lib$cupsbase.2.dylib" 43 if test "x$cupsimagebase" != x; then 44 LIBCUPSIMAGE="lib$cupsimagebase.2.dylib" 45 fi 46 DSO="\$(CC)" 47 DSOXX="\$(CXX)" 48 DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc" 49 ;; 50 *) 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" 56 fi 57 DSO="\$(CC)" 58 DSOXX="\$(CXX)" 59 DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared" 60 ;; 61 esac 62else 63 PICFLAG=0 64 LIBCUPS="lib$cupsbase.a" 65 if test "x$cupsimagebase" != x; then 66 LIBCUPSIMAGE="lib$cupsimagebase.a" 67 fi 68 DSO=":" 69 DSOXX=":" 70fi 71 72AC_SUBST(DSO) 73AC_SUBST(DSOXX) 74AC_SUBST(DSOFLAGS) 75AC_SUBST(LIBCUPS) 76AC_SUBST(LIBCUPSBASE) 77AC_SUBST(LIBCUPSIMAGE) 78AC_SUBST(LIBCUPSSTATIC) 79 80if test x$enable_shared = xno; then 81 LINKCUPS="../cups/lib$cupsbase.a \$(LIBS)" 82 EXTLINKCUPS="-lcups \$LIBS" 83else 84 LINKCUPS="-L../cups -l${cupsbase}" 85 EXTLINKCUPS="-lcups" 86fi 87 88AC_SUBST(EXTLINKCUPS) 89AC_SUBST(LINKCUPS) 90 91dnl Update libraries for DSOs... 92EXPORT_LDFLAGS="" 93 94if 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... 98 case $host_os_name in 99 sunos*) 100 # Solaris... 101 if test $exec_prefix != /usr; then 102 DSOFLAGS="-R$libdir $DSOFLAGS" 103 LDFLAGS="$LDFLAGS -R$libdir" 104 EXPORT_LDFLAGS="-R$libdir" 105 fi 106 ;; 107 *bsd*) 108 # *BSD... 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" 113 fi 114 ;; 115 linux* | gnu*) 116 # Linux, and HURD... 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" 121 fi 122 ;; 123 esac 124fi 125 126AC_SUBST(EXPORT_LDFLAGS) 127