# Extra functions for configure.in # Run a *-config script and pull out the cflags and libs settings AC_DEFUN([LIB_CONFIG],[ AC_PATH_PROG([$1], [$2]) CONFIG_PATH=${$1} if test "x$CONFIG_PATH" = "x"; then AC_MSG_ERROR([Could not find $2 in PATH; is $3 installed?]) fi $4="$($CONFIG_PATH --cflags) ${$4}" $5="$($CONFIG_PATH --libs) ${$5}" ]) # Basically like LIB_CONFIG, but for pkg-config stuff #AC_DEFUN([PKG_CONFIG],[ # AC_PATH_PROG(pkg_config, pkg-config) # CONFIG_PATH=${pkg_config} # if test "x$CONFIG_PATH" = "x"; then # AC_MSG_ERROR([Could not find pkg-config in PATH; is it installed?]) # fi # # $2="$($CONFIG_PATH $1 --cflags) ${$2}" # $3="$($CONFIG_PATH $1 --libs) ${$3cx}" #]) # Check for a function; if it doesn't exist, puke AC_DEFUN(REQUIRE_FUNC, [ AC_CHECK_FUNCS($1) if test $ac_cv_func_$1 = no; then AC_MSG_ERROR([Cutlass needs the function $1(), but it cannot be found]); fi ]) AC_DEFUN(CHECK_PTHREADS, [ case "$target" in *-*-freebsd* | *-*-openbsd*) pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" pthread_lib="-pthread" ;; *) pthread_cflags="-D_REENTRANT" pthread_lib="-lpthread" ;; esac LIBS="$pthread_lib $LIBS" CFLAGS="$pthread_cflags $CFLAGS" CXXFLAGS="$pthread_cflags $CXXFLAGS" AC_MSG_CHECKING(for POSIX threads) use_pthreads=no AC_TRY_LINK([#include ], [ pthread_mutex_t mutex; pthread_mutex_init(&mutex, NULL); ], [use_pthreads=yes], [AC_MSG_ERROR("Cutlass requires POSIX threads")] ); AC_MSG_RESULT($pthread_cflags $pthread_lib) ])