| 1 | AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) |
|---|
| 2 | |
|---|
| 3 | # Check for binary relocation support. |
|---|
| 4 | # Written by Hongli Lai |
|---|
| 5 | # http://autopackage.org/ |
|---|
| 6 | |
|---|
| 7 | AC_DEFUN([AM_BINRELOC], |
|---|
| 8 | [ |
|---|
| 9 | AC_ARG_ENABLE(binreloc, |
|---|
| 10 | [ --enable-binreloc compile with binary relocation support |
|---|
| 11 | (default=enable when available)], |
|---|
| 12 | enable_binreloc=$enableval,enable_binreloc=auto) |
|---|
| 13 | |
|---|
| 14 | AC_ARG_ENABLE(binreloc-threads, |
|---|
| 15 | [ --enable-binreloc-threads compile binary relocation with threads support |
|---|
| 16 | (default=yes)], |
|---|
| 17 | enable_binreloc_threads=$enableval,enable_binreloc_threads=yes) |
|---|
| 18 | |
|---|
| 19 | BINRELOC_CFLAGS= |
|---|
| 20 | BINRELOC_LIBS= |
|---|
| 21 | if test "x$enable_binreloc" = "xauto"; then |
|---|
| 22 | AC_CHECK_FILE([/proc/self/maps]) |
|---|
| 23 | AC_CACHE_CHECK([whether everything is installed to the same prefix], |
|---|
| 24 | [br_cv_valid_prefixes], [ |
|---|
| 25 | if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \ |
|---|
| 26 | "$datarootdir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \ |
|---|
| 27 | "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc' |
|---|
| 28 | then |
|---|
| 29 | br_cv_valid_prefixes=yes |
|---|
| 30 | else |
|---|
| 31 | br_cv_valid_prefixes=no |
|---|
| 32 | fi |
|---|
| 33 | ]) |
|---|
| 34 | fi |
|---|
| 35 | AC_CACHE_CHECK([whether binary relocation support should be enabled], |
|---|
| 36 | [br_cv_binreloc], |
|---|
| 37 | [if test "x$enable_binreloc" = "xyes"; then |
|---|
| 38 | br_cv_binreloc=yes |
|---|
| 39 | elif test "x$enable_binreloc" = "xauto"; then |
|---|
| 40 | if test "x$br_cv_valid_prefixes" = "xyes" -a \ |
|---|
| 41 | "x$ac_cv_file__proc_self_maps" = "xyes"; then |
|---|
| 42 | br_cv_binreloc=yes |
|---|
| 43 | else |
|---|
| 44 | br_cv_binreloc=no |
|---|
| 45 | fi |
|---|
| 46 | else |
|---|
| 47 | br_cv_binreloc=no |
|---|
| 48 | fi]) |
|---|
| 49 | |
|---|
| 50 | if test "x$br_cv_binreloc" = "xyes"; then |
|---|
| 51 | BINRELOC_CFLAGS="-DENABLE_BINRELOC" |
|---|
| 52 | AC_DEFINE(ENABLE_BINRELOC,,[Use binary relocation?]) |
|---|
| 53 | if test "x$enable_binreloc_threads" = "xyes"; then |
|---|
| 54 | AC_CHECK_LIB([pthread], [pthread_getspecific]) |
|---|
| 55 | fi |
|---|
| 56 | |
|---|
| 57 | AC_CACHE_CHECK([whether binary relocation should use threads], |
|---|
| 58 | [br_cv_binreloc_threads], |
|---|
| 59 | [if test "x$enable_binreloc_threads" = "xyes"; then |
|---|
| 60 | if test "x$ac_cv_lib_pthread_pthread_getspecific" = "xyes"; then |
|---|
| 61 | br_cv_binreloc_threads=yes |
|---|
| 62 | else |
|---|
| 63 | br_cv_binreloc_threads=no |
|---|
| 64 | fi |
|---|
| 65 | else |
|---|
| 66 | br_cv_binreloc_threads=no |
|---|
| 67 | fi]) |
|---|
| 68 | |
|---|
| 69 | if test "x$br_cv_binreloc_threads" = "xyes"; then |
|---|
| 70 | BINRELOC_LIBS="-lpthread" |
|---|
| 71 | AC_DEFINE(BR_PTHREAD,1,[Include pthread support for binary relocation?]) |
|---|
| 72 | else |
|---|
| 73 | BINRELOC_CFLAGS="$BINRELOC_CFLAGS -DBR_PTHREADS=0" |
|---|
| 74 | AC_DEFINE(BR_PTHREAD,0,[Include pthread support for binary relocation?]) |
|---|
| 75 | fi |
|---|
| 76 | fi |
|---|
| 77 | AC_SUBST(BINRELOC_CFLAGS) |
|---|
| 78 | AC_SUBST(BINRELOC_LIBS) |
|---|
| 79 | ]) |
|---|