mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
Configure tests if main can be linked to from getentropy compat.
git-svn-id: file:///svn/unbound/trunk@3191 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
19aaa6c9e5
commit
8d392a3cfb
7 changed files with 13911 additions and 3550 deletions
|
|
@ -72,7 +72,9 @@
|
||||||
|
|
||||||
int getentropy(void *buf, size_t len);
|
int getentropy(void *buf, size_t len);
|
||||||
|
|
||||||
|
#ifdef CAN_REFERENCE_MAIN
|
||||||
extern int main(int, char *argv[]);
|
extern int main(int, char *argv[]);
|
||||||
|
#endif
|
||||||
static int gotdata(char *buf, size_t len);
|
static int gotdata(char *buf, size_t len);
|
||||||
static int getentropy_urandom(void *buf, size_t len);
|
static int getentropy_urandom(void *buf, size_t len);
|
||||||
#ifdef CTL_MAXNAME
|
#ifdef CTL_MAXNAME
|
||||||
|
|
@ -345,7 +347,9 @@ getentropy_fallback(void *buf, size_t len)
|
||||||
HX(sigprocmask(SIG_BLOCK, NULL, &sigset) == -1,
|
HX(sigprocmask(SIG_BLOCK, NULL, &sigset) == -1,
|
||||||
sigset);
|
sigset);
|
||||||
|
|
||||||
|
#ifdef CAN_REFERENCE_MAIN
|
||||||
HF(main); /* an addr in program */
|
HF(main); /* an addr in program */
|
||||||
|
#endif
|
||||||
HF(getentropy); /* an addr in this library */
|
HF(getentropy); /* an addr in this library */
|
||||||
HF(printf); /* an addr in libc */
|
HF(printf); /* an addr in libc */
|
||||||
p = (char *)&p;
|
p = (char *)&p;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
@ -74,7 +75,9 @@
|
||||||
|
|
||||||
int getentropy(void *buf, size_t len);
|
int getentropy(void *buf, size_t len);
|
||||||
|
|
||||||
|
#ifdef CAN_REFERENCE_MAIN
|
||||||
extern int main(int, char *argv[]);
|
extern int main(int, char *argv[]);
|
||||||
|
#endif
|
||||||
static int gotdata(char *buf, size_t len);
|
static int gotdata(char *buf, size_t len);
|
||||||
static int getentropy_urandom(void *buf, size_t len);
|
static int getentropy_urandom(void *buf, size_t len);
|
||||||
static int getentropy_fallback(void *buf, size_t len);
|
static int getentropy_fallback(void *buf, size_t len);
|
||||||
|
|
@ -292,7 +295,9 @@ getentropy_fallback(void *buf, size_t len)
|
||||||
HX(sigprocmask(SIG_BLOCK, NULL, &sigset) == -1,
|
HX(sigprocmask(SIG_BLOCK, NULL, &sigset) == -1,
|
||||||
sigset);
|
sigset);
|
||||||
|
|
||||||
|
#ifdef CAN_REFERENCE_MAIN
|
||||||
HF(main); /* an addr in program */
|
HF(main); /* an addr in program */
|
||||||
|
#endif
|
||||||
HF(getentropy); /* an addr in this library */
|
HF(getentropy); /* an addr in this library */
|
||||||
HF(printf); /* an addr in libc */
|
HF(printf); /* an addr in libc */
|
||||||
p = (char *)&p;
|
p = (char *)&p;
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,9 @@
|
||||||
|
|
||||||
int getentropy(void *buf, size_t len);
|
int getentropy(void *buf, size_t len);
|
||||||
|
|
||||||
/* referencing functions in other link modules is not portable with sun-cc */
|
#ifdef CAN_REFERENCE_MAIN
|
||||||
/* extern int main(int, char *argv[]); */
|
extern int main(int, char *argv[]);
|
||||||
|
#endif
|
||||||
static int gotdata(char *buf, size_t len);
|
static int gotdata(char *buf, size_t len);
|
||||||
static int getentropy_urandom(void *buf, size_t len, const char *path,
|
static int getentropy_urandom(void *buf, size_t len, const char *path,
|
||||||
int devfscheck);
|
int devfscheck);
|
||||||
|
|
@ -299,8 +300,9 @@ getentropy_fallback(void *buf, size_t len)
|
||||||
HX(sigprocmask(SIG_BLOCK, NULL, &sigset) == -1,
|
HX(sigprocmask(SIG_BLOCK, NULL, &sigset) == -1,
|
||||||
sigset);
|
sigset);
|
||||||
|
|
||||||
/* replaced main with log_info */
|
#ifdef CAN_REFERENCE_MAIN
|
||||||
/*HF(main);*/ /* an addr in program */
|
HF(main); /* an addr in program */
|
||||||
|
#endif
|
||||||
HF(getentropy); /* an addr in this library */
|
HF(getentropy); /* an addr in this library */
|
||||||
HF(printf); /* an addr in libc */
|
HF(printf); /* an addr in libc */
|
||||||
p = (char *)&p;
|
p = (char *)&p;
|
||||||
|
|
|
||||||
13
config.h.in
13
config.h.in
|
|
@ -1,5 +1,8 @@
|
||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
/* define if a library can reference the 'main' symbol */
|
||||||
|
#undef CAN_REFERENCE_MAIN
|
||||||
|
|
||||||
/* Directory to chroot to */
|
/* Directory to chroot to */
|
||||||
#undef CHROOT_DIR
|
#undef CHROOT_DIR
|
||||||
|
|
||||||
|
|
@ -341,7 +344,7 @@
|
||||||
/* Define to 1 if you have the `strptime' function. */
|
/* Define to 1 if you have the `strptime' function. */
|
||||||
#undef HAVE_STRPTIME
|
#undef HAVE_STRPTIME
|
||||||
|
|
||||||
/* Define to 1 if `ipi_spec_dst' is a member of `struct in_pktinfo'. */
|
/* Define to 1 if `ipi_spec_dst' is member of `struct in_pktinfo'. */
|
||||||
#undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST
|
#undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST
|
||||||
|
|
||||||
/* Define if you have Swig libraries and header files. */
|
/* Define if you have Swig libraries and header files. */
|
||||||
|
|
@ -475,9 +478,6 @@
|
||||||
/* Define to the one symbol short name of this package. */
|
/* Define to the one symbol short name of this package. */
|
||||||
#undef PACKAGE_TARNAME
|
#undef PACKAGE_TARNAME
|
||||||
|
|
||||||
/* Define to the home page for this package. */
|
|
||||||
#undef PACKAGE_URL
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#undef PACKAGE_VERSION
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
|
|
@ -586,11 +586,6 @@
|
||||||
`char[]'. */
|
`char[]'. */
|
||||||
#undef YYTEXT_POINTER
|
#undef YYTEXT_POINTER
|
||||||
|
|
||||||
/* Enable large inode numbers on Mac OS X 10.5. */
|
|
||||||
#ifndef _DARWIN_USE_64_BIT_INODE
|
|
||||||
# define _DARWIN_USE_64_BIT_INODE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||||
#undef _FILE_OFFSET_BITS
|
#undef _FILE_OFFSET_BITS
|
||||||
|
|
||||||
|
|
|
||||||
33
configure.ac
33
configure.ac
|
|
@ -1021,6 +1021,39 @@ if test "$USE_NSS" = "no"; then
|
||||||
AC_SEARCH_LIBS([clock_gettime], [rt])
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
# generate libtool to test if linking main
|
||||||
|
# from a dynamic library works.
|
||||||
|
LT_OUTPUT
|
||||||
|
AC_MSG_CHECKING([if dynamic lib can refer to main])
|
||||||
|
cat >tmp.$$.def <<EOF
|
||||||
|
myfunc
|
||||||
|
EOF
|
||||||
|
cat >tmp.$$.c <<EOF
|
||||||
|
int myfunc(void);
|
||||||
|
extern int main(int, char *argv[]);
|
||||||
|
int myfunc(void)
|
||||||
|
{
|
||||||
|
return ((int)main) + 1;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
mylibtool=./libtool
|
||||||
|
mylibdir=/usr/local/lib
|
||||||
|
myok=yes
|
||||||
|
$mylibtool --quiet --tag=CC --mode=compile $CC $CFLAGS -o tmp.$$.lo -c tmp.$$.c >/dev/null 2>&1
|
||||||
|
if test $? = 0; then myok=yes; else myok=no; fi
|
||||||
|
if test "$myok" = "yes"; then
|
||||||
|
$mylibtool --quiet --tag=CC --mode=link $CC $CFLAGS -version-info 1:0:0 -no-undefined -export-symbols tmp.$$.def -o libtmp$$.la tmp.$$.lo $LDFLAGS -rpath $mylibdir $LIBS >/dev/null 2>&1
|
||||||
|
if test $? = 0; then myok=yes; else myok=no; fi
|
||||||
|
fi
|
||||||
|
if test "$myok" = "yes"; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(CAN_REFERENCE_MAIN, [1], [define if a library can reference the 'main' symbol])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
$mylibtool --quiet --mode=clean rm -rf libtmp$$.la tmp.$$.lo
|
||||||
|
rm -f tmp.$$.def tmp.$$.c libtmp$$.la tmp.$$.lo tmp.$$.o
|
||||||
|
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
13 July 2014: Wouter
|
||||||
|
- Configure tests if main can be linked to from getentropy compat.
|
||||||
|
|
||||||
12 July 2014: Wouter
|
12 July 2014: Wouter
|
||||||
- Fix getentropy compat code, function refs were not portable.
|
- Fix getentropy compat code, function refs were not portable.
|
||||||
- Fix to check openssl version number only for OpenSSL.
|
- Fix to check openssl version number only for OpenSSL.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue