Commit 46e07705 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

autoconf: support mac os

parent 61c0fe2a
......@@ -30,16 +30,20 @@ AC_TRY_COMPILE([],[],
AC_MSG_RESULT(no)
CFLAGS="$old_CFLAGS")
AC_CACHE_CHECK([for lsb_release supporting -d -s], [ac_cv_path_LSB_RELEASE_CMD],
[AC_PATH_PROGS_FEATURE_CHECK([LSB_RELEASE_CMD], [lsb_release],
[[$ac_path_LSB_RELEASE_CMD -d -s > /dev/null && ac_cv_path_LSB_RELEASE_CMD=$ac_path_LSB_RELEASE_CMD]],
[AC_MSG_ERROR([could not find acceptable lsb_release])])])
AC_CACHE_CHECK([for operating system], [ac_cv_OPERATING_SYSTEM],
[os="$($ac_cv_path_LSB_RELEASE_CMD -d -s)"
os="${os%\"}"
ac_cv_OPERATING_SYSTEM="${os#\"}"])
AC_PATH_PROG([UNAME], [uname], [false])
AC_PATH_PROG([LSB_RELEASE], [lsb_release], [false])
AC_PATH_PROG([SW_VERS], [sw_vers], [false])
AC_DEFINE_UNQUOTED([OPERATING_SYSTEM], ["$ac_cv_OPERATING_SYSTEM"], [The operating system of the build system])
AC_CACHE_CHECK([for operating system], [ac_cv_OS], [AS_CASE([`${UNAME} -s`],
[Linux], [AS_IF(["${LSB_RELEASE}" -d -s 2>/dev/null >/dev/null],
[os=`"${LSB_RELEASE}" -d -s`; os="${os%\"}"; ac_cv_OS="${os#\"}"],
[AC_MSG_ERROR([lsb_release is required])])],
[Darwin], [AS_IF(["${SW_VERS}" 2>/dev/null >/dev/null],
[ac_cv_OS="`${SW_VERS} -productName` `${SW_VERS} -productVersion`"],
[AC_MSG_ERROR([sw_vers is required])])],
[ac_cv_OS="unknown"])])
AC_DEFINE_UNQUOTED([OPERATING_SYSTEM], ["$ac_cv_OS"], [The operating system of the build system])
AC_DEFINE_UNQUOTED([HOSTNAME], ["${HOSTNAME:-unknown}"], [The hostname of the build system])
AC_DEFINE_UNQUOTED([USERNAME], ["${USERNAME:-${LOGNAME:-${USER:-unknown}}}"], [The username of the person compiling saftlib])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment