summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2014-04-16 18:42:36 -0500
committerNicolas Williams <nico@cryptonector.com>2014-04-16 18:42:36 -0500
commitd056668f4f4e0c2286354329b30d73d208d65c5e (patch)
tree432c8c839d9db6e90ed8828df69c11e2bfca900d /config
parent917334d18ab0a5e6dc3c3d8af1bb8edb3623ca0d (diff)
Add autoconf checks for pthreads; fix #340
Diffstat (limited to 'config')
-rw-r--r--config/m4/find-func-no-libs.m48
-rw-r--r--config/m4/find-func-no-libs2.m462
-rw-r--r--config/m4/find-func.m49
-rw-r--r--config/m4/misc.m43
4 files changed, 82 insertions, 0 deletions
diff --git a/config/m4/find-func-no-libs.m4 b/config/m4/find-func-no-libs.m4
new file mode 100644
index 00000000..f47cd6e6
--- /dev/null
+++ b/config/m4/find-func-no-libs.m4
@@ -0,0 +1,8 @@
+dnl Shamelessly stolen from Heimdal
+dnl
+dnl Look for function in any of the specified libraries
+dnl
+
+dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
+AC_DEFUN([AC_FIND_FUNC_NO_LIBS], [
+AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
diff --git a/config/m4/find-func-no-libs2.m4 b/config/m4/find-func-no-libs2.m4
new file mode 100644
index 00000000..ecb61400
--- /dev/null
+++ b/config/m4/find-func-no-libs2.m4
@@ -0,0 +1,62 @@
+dnl Shamelessly stolen from Heimdal
+dnl
+dnl Look for function in any of the specified libraries
+dnl
+
+dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
+AC_DEFUN([AC_FIND_FUNC_NO_LIBS2], [
+
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(ac_cv_funclib_$1,
+[
+if eval "test \"\$ac_cv_func_$1\" != yes" ; then
+ ac_save_LIBS="$LIBS"
+ for ac_lib in $2; do
+ case "$ac_lib" in
+ "") ;;
+ yes) ac_lib="" ;;
+ no) continue ;;
+ -l*) ;;
+ *) ac_lib="-l$ac_lib" ;;
+ esac
+ LIBS="$6 $ac_lib $5 $ac_save_LIBS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$1($4)]])],[eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break])
+ done
+ eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
+ LIBS="$ac_save_LIBS"
+fi
+])
+
+eval "ac_res=\$ac_cv_funclib_$1"
+
+if false; then
+ AC_CHECK_FUNCS($1)
+dnl AC_CHECK_LIBS($2, foo)
+fi
+# $1
+eval "ac_tr_func=HAVE_[]upcase($1)"
+eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
+eval "LIB_$1=$ac_res"
+
+case "$ac_res" in
+ yes)
+ eval "ac_cv_func_$1=yes"
+ eval "LIB_$1="
+ AC_DEFINE_UNQUOTED($ac_tr_func)
+ AC_MSG_RESULT([yes])
+ ;;
+ no)
+ eval "ac_cv_func_$1=no"
+ eval "LIB_$1="
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ eval "ac_cv_func_$1=yes"
+ eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
+ AC_DEFINE_UNQUOTED($ac_tr_func)
+ AC_DEFINE_UNQUOTED($ac_tr_lib)
+ AC_MSG_RESULT([yes, in $ac_res])
+ ;;
+esac
+AC_SUBST(LIB_$1)
+])
diff --git a/config/m4/find-func.m4 b/config/m4/find-func.m4
new file mode 100644
index 00000000..a4b0290f
--- /dev/null
+++ b/config/m4/find-func.m4
@@ -0,0 +1,9 @@
+dnl Shamelessly stolen from Heimdal
+dnl
+dnl AC_FIND_FUNC(func, libraries, includes, arguments)
+AC_DEFUN([AC_FIND_FUNC], [
+AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
+if test -n "$LIB_$1"; then
+ LIBS="$LIB_$1 $LIBS"
+fi
+])
diff --git a/config/m4/misc.m4 b/config/m4/misc.m4
new file mode 100644
index 00000000..3dd16bd9
--- /dev/null
+++ b/config/m4/misc.m4
@@ -0,0 +1,3 @@
+
+dnl Shamelessly stolen from Heimdal
+AC_DEFUN([upcase],[`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`])dnl