acinclude.m4

changeset 10245
81654bee87e8
parent 8992
1c8d314b2390
child 10253
1e1ff9d1d32b
equal deleted inserted replaced
10244:8e714ed463db 10245:81654bee87e8
784 $3 784 $3
785 fi 785 fi
786 else 786 else
787 AC_MSG_WARN(could not find perl) 787 AC_MSG_WARN(could not find perl)
788 fi])dnl 788 fi])dnl
789
790
791 dnl This file scares me...
792 # Check for binary relocation support
793 # Hongli Lai
794 # http://autopackage.org/
795
796 AC_DEFUN([AM_BINRELOC],
797 [
798 AC_ARG_ENABLE(binreloc,
799 [ --enable-binreloc compile with binary relocation support
800 (default=enable when available)],
801 enable_binreloc=$enableval,enable_binreloc=auto)
802
803 AC_ARG_ENABLE(binreloc-threads,
804 [ --enable-binreloc-threads compile binary relocation with threads support
805 (default=yes)],
806 enable_binreloc_threads=$enableval,enable_binreloc_threads=yes)
807
808 BINRELOC_CFLAGS=
809 BINRELOC_LIBS=
810 if test "x$enable_binreloc" = "xauto"; then
811 AC_CHECK_FILE([/proc/self/maps])
812 AC_CACHE_CHECK([whether everything is installed to the same prefix],
813 [br_cv_valid_prefixes], [
814 if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
815 "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
816 "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
817 then
818 br_cv_valid_prefixes=yes
819 else
820 br_cv_valid_prefixes=no
821 fi
822 ])
823 fi
824 AC_CACHE_CHECK([whether binary relocation support should be enabled],
825 [br_cv_binreloc],
826 [if test "x$enable_binreloc" = "xyes"; then
827 br_cv_binreloc=yes
828 elif test "x$enable_binreloc" = "xauto"; then
829 if test "x$br_cv_valid_prefixes" = "xyes" -a \
830 "x$ac_cv_file__proc_self_maps" = "xyes"; then
831 br_cv_binreloc=yes
832 else
833 br_cv_binreloc=no
834 fi
835 else
836 br_cv_binreloc=no
837 fi])
838
839 if test "x$br_cv_binreloc" = "xyes"; then
840 BINRELOC_CFLAGS="-DENABLE_BINRELOC"
841 AC_DEFINE(ENABLE_BINRELOC,,[Use binary relocation?])
842 if test "x$enable_binreloc_threads" = "xyes"; then
843 AC_CHECK_LIB([pthread], [pthread_getspecific])
844 fi
845
846 AC_CACHE_CHECK([whether binary relocation should use threads],
847 [br_cv_binreloc_threads],
848 [if test "x$enable_binreloc_threads" = "xyes"; then
849 if test "x$ac_cv_lib_pthread_pthread_getspecific" = "xyes"; then
850 br_cv_binreloc_threads=yes
851 else
852 br_cv_binreloc_threads=no
853 fi
854 else
855 br_cv_binreloc_threads=no
856 fi])
857
858 if test "x$br_cv_binreloc_threads" = "xyes"; then
859 BINRELOC_LIBS="-lpthread"
860 AC_DEFINE(BR_PTHREAD,1,[Include pthread support for binary relocation?])
861 else
862 BINRELOC_CFLAGS="$BINRELOC_CFLAGS -DBR_PTHREAD=0"
863 AC_DEFINE(BR_PTHREAD,0,[Include pthread support for binary relocation?])
864 fi
865 fi
866 AC_SUBST(BINRELOC_CFLAGS)
867 AC_SUBST(BINRELOC_LIBS)
868 ])

mercurial