Diff

Differences From Artifact [9a1977c3cc]:

To Artifact [53dc5eee75]:


   256    256   			AC_MSG_RESULT([found])
   257    257   			AC_DEFINE(HAVE_ACCEPTABLE_DLADDR, [1], [Define to 1 if you have an acceptable dladdr implementation with dli_fname])
   258    258   		], [
   259    259   			AC_MSG_RESULT([not found])
   260    260   		]
   261    261   	)
   262    262   ])
          263  +
          264  +dnl Usage:
          265  +dnl    DC_TEST_SHOBJFLAGS(shobjflags, shobjldflags, action-if-not-found)
          266  +dnl
          267  +AC_DEFUN(DC_TEST_SHOBJFLAGS, [
          268  +  AC_SUBST(SHOBJFLAGS)
          269  +  AC_SUBST(SHOBJLDFLAGS)
          270  +
          271  +  OLD_LDFLAGS="$LDFLAGS"
          272  +  SHOBJFLAGS=""
          273  +
          274  +  LDFLAGS="$OLD_LDFLAGS $1 $2"
          275  +
          276  +  AC_TRY_LINK([#include <stdio.h>
          277  +int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="$1"; SHOBJLDFLAGS="$2" ], [
          278  +  LDFLAGS="$OLD_LDFLAGS"
          279  +  $3
          280  +])
          281  +
          282  +  LDFLAGS="$OLD_LDFLAGS"
          283  +])
          284  +
          285  +AC_DEFUN(DC_GET_SHOBJFLAGS, [
          286  +  AC_SUBST(SHOBJFLAGS)
          287  +  AC_SUBST(SHOBJLDFLAGS)
          288  +
          289  +  AC_MSG_CHECKING(how to create shared objects)
          290  +
          291  +  if test -z "$SHOBJFLAGS" -a -z "$SHOBJLDFLAGS"; then
          292  +    DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic], [
          293  +      DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared], [
          294  +        DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -mimpure-text], [
          295  +          DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -mimpure-text], [
          296  +            DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -Wl,-G,-z,textoff], [
          297  +              DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -Wl,-G,-z,textoff], [
          298  +                DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [
          299  +                  DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [
          300  +                    DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [
          301  +                      DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress], [
          302  +                        DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib], [
          303  +                          AC_MSG_RESULT(cant)
          304  +                          AC_MSG_ERROR([We are unable to make shared objects.])
          305  +                        ])
          306  +                      ])
          307  +                    ])
          308  +                  ])
          309  +                ])
          310  +              ])
          311  +            ])
          312  +          ])
          313  +        ])
          314  +      ])
          315  +    ])
          316  +  fi
          317  +
          318  +  AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS)
          319  +])
          320  +
          321  +AC_DEFUN(DC_CHK_OS_INFO, [
          322  +	AC_CANONICAL_HOST
          323  +	AC_SUBST(SHOBJEXT)
          324  +	AC_SUBST(AREXT)
          325  +        AC_SUBST(SHOBJFLAGS)
          326  +        AC_SUBST(SHOBJLDFLAGS)
          327  +
          328  +        AC_MSG_CHECKING(host operating system)
          329  +        AC_MSG_RESULT($host_os)
          330  +
          331  +	SHOBJEXT="so"
          332  +	AREXT="a"
          333  +
          334  +        case $host_os in
          335  +                darwin*)
          336  +			SHOBJEXT="dylib"
          337  +                        ;;
          338  +		hpux*)
          339  +			SHOBJEXT="sl"
          340  +			;;
          341  +		mingw*)
          342  +			SHOBJEXT="dll"
          343  +			SHOBJFLAGS="-mno-cygwin -mms-bitfields -DPIC"
          344  +			SHOBJLDFLAGS='-shared -Wl,--dll -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a -Wl,--export-all-symbols -Wl,--add-stdcall-alias'
          345  +			;;
          346  +	esac
          347  +])
          348  +
          349  +AC_DEFUN(DC_TEST_WHOLE_ARCHIVE_SHARED_LIB, [
          350  +
          351  +	SAVE_LIBS="${LIBS}"
          352  +
          353  +	LIBS="${WHOLEARCHIVE} $1 ${NOWHOLEARCHIVE} ${SAVE_LIBS}"
          354  +	AC_LINK_IFELSE(
          355  +		AC_LANG_PROGRAM([[
          356  +			]], [[
          357  +			]]
          358  +		),
          359  +		[
          360  +			LIBS="${SAVE_LIBS}"
          361  +
          362  +			$2
          363  +		], [
          364  +			LIBS="${SAVE_LIBS}"
          365  +
          366  +			$3
          367  +		]
          368  +	)
          369  +])
          370  +
          371  +AC_DEFUN(DC_CHECK_FOR_WHOLE_ARCHIVE, [
          372  +	AC_MSG_CHECKING([for how to link whole archive])
          373  +
          374  +	SAVE_CFLAGS="${CFLAGS}"
          375  +
          376  +	wholearchive=""
          377  +
          378  +	for check in "-Wl,--whole-archive -Wl,--no-whole-archive" "-Wl,-z,allextract -Wl,-z,defaultextract"; do
          379  +		CFLAGS="${SAVE_CFLAGS} ${check}"
          380  +
          381  +		AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
          382  +			[
          383  +				wholearchive="${check}"
          384  +
          385  +				break
          386  +			]
          387  +		)
          388  +
          389  +	done
          390  +
          391  +	CFLAGS="${SAVE_CFLAGS}"
          392  +
          393  +	if test -z "${wholearchive}"; then
          394  +		AC_MSG_RESULT([not found])
          395  +	else
          396  +		AC_MSG_RESULT([${wholearchive}])
          397  +
          398  +		WHOLEARCHIVE=`echo "${wholearchive}" | cut -f 1 -d ' '`
          399  +		NOWHOLEARCHIVE=`echo "${wholearchive}" | cut -f 2 -d ' '`
          400  +	fi
          401  +
          402  +	AC_SUBST(WHOLEARCHIVE)
          403  +	AC_SUBST(NOWHOLEARCHIVE)
          404  +])