Skip to content
Snippets Groups Projects
configure.ac 80.6 KiB
Newer Older
# Process this file with autoconf to produce a configure script.
#
# Make sure we use autoconf 2.60 to generate the "configure" script,
# in case we want to commit it. Other than that, version 2.59 is
# perfectly fine for our purposes, so people who want to modify
# this file just have to remember to set the AC_PREREQ argument
# to something that suits their needs.
AC_INIT([asterisk], [trunk], [https://issues.asterisk.org])

# cross-compile macros
AC_CANONICAL_BUILD
AC_CANONICAL_HOST

# check existence of the package
AC_CONFIG_SRCDIR([main/asterisk.c])
AC_CONFIG_AUX_DIR(`pwd`)

AC_COPYRIGHT("Asterisk")
AC_REVISION($Revision$)

# preserve any CFLAGS or LDFLAGS that may be set
# NOTE: This must be done before calling any macros that end up
# calling AC_PROG_CC or the like, since they will set a default
# set of CFLAGS ("-g -O2") if the user did not supply any, and
# we don't want those default flags to be carried over into the
# rest of the build system since we have other means of controlling
# debugging symbol generation and optimization.
CONFIG_CFLAGS="${CFLAGS}"
CONFIG_LDFLAGS="${LDFLAGS}"
AC_SUBST(CONFIG_CFLAGS)
AC_SUBST(CONFIG_LDFLAGS)

# specify output header file
AC_CONFIG_HEADER(include/asterisk/autoconfig.h)

# Note: AC_PROG_CC *must* be specified before AC_USE_SYSTEM_EXTENSIONS or any
# other macro that uses the C compiler, or the default order will be used.
AC_PROG_CC([gcc cc])
AC_USE_SYSTEM_EXTENSIONS	dnl note- does not work on FreeBSD

# System default paths
AC_SUBST([astsbindir],        ['${sbindir}'])dnl
AC_SUBST([astetcdir],         ['${sysconfdir}/asterisk'])dnl
AC_SUBST([astheaderdir],      ['${includedir}/asterisk'])dnl
AC_SUBST([astlibdir],         ['${libdir}'])dnl
AC_SUBST([astmoddir],         ['${libdir}/asterisk/modules'])dnl
AC_SUBST([astmandir],         ['${mandir}'])dnl
AC_SUBST([astvarlibdir],      ['${localstatedir}/lib/asterisk'])dnl
AC_SUBST([astdatadir],        ['${astvarlibdir}'])dnl
AC_SUBST([astdbdir],          ['${astvarlibdir}'])dnl
AC_SUBST([astkeydir],         ['${astvarlibdir}'])dnl
AC_SUBST([astspooldir],       ['${localstatedir}/spool/asterisk'])dnl
AC_SUBST([astlogdir],         ['${localstatedir}/log/asterisk'])dnl
AC_SUBST([astvarrundir],      ['${localstatedir}/run/asterisk'])dnl

case "${host_os}" in
     *bsd*)
     if test ${prefix} = 'NONE'; then
        astvarlibdir='${prefix}/share/asterisk'
        astdbdir='${localstatedir}/db/asterisk'
     fi
     ;;
     darwin*)
     if test ${prefix} = 'NONE'; then
        astvarrundir='/Library/Application Support/Asterisk/Run'
     fi
     ;;
esac
     ac_default_prefix=/usr/local
     CPPFLAGS=-I/usr/local/include
     LDFLAGS=-L/usr/local/lib
     ac_default_prefix=/usr/local
     if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
        if test ${sysconfdir} = '${prefix}/etc'; then
           astetcdir=/etc/asterisk
        fi
        if test ${mandir} = '${prefix}/man'; then
           astmandir=/usr/share/man
        fi
     fi
     CPPFLAGS=-I/usr/local/include
     LDFLAGS=-L/usr/local/lib
     ;;
     ac_default_prefix=/usr/local
     if test ${prefix} = 'NONE'; then
        astmoddir='/Library/Application Support/Asterisk/Modules'
        astvarlibdir='/Library/Application Support/Asterisk'
        astlogdir=/Library/Logs/Asterisk
        astvarrundir='/Library/Application Support/Asterisk/Run'
     AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.])
     AC_DEFINE([_DARWIN_UNLIMITED_SELECT], 1, [Define to 1 if running on Darwin.])
     solaris*)
     if test ${prefix} = 'NONE'; then
        astetcdir=/var/etc/asterisk
        astsbindir=/opt/asterisk/sbin
        astlibdir=/opt/asterisk/lib
        astheaderdir=/opt/asterisk/include
        astmandir=/opt/asterisk/man
        astvarlibdir=/var/opt/asterisk
        astspooldir=/var/spool/asterisk
        astlogdir=/var/log/asterisk
        astvarrundir=/var/run/asterisk
     fi
     ;;
     ac_default_prefix=/usr
     if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
        if test ${sysconfdir} = '${prefix}/etc'; then
           sysconfdir=/etc
        fi
        if test ${mandir} = '${prefix}/man'; then
           mandir=/usr/share/man
        fi
if test ${prefix} = ${ac_default_prefix} || test ${prefix} = 'NONE'; then
     if test ${localstatedir} = '${prefix}/var'; then
        localstatedir=/var
     fi
BUILD_PLATFORM=${build}
BUILD_CPU=${build_cpu}
BUILD_VENDOR=${build_vendor}
BUILD_OS=${build_os}

AC_SUBST(BUILD_PLATFORM)
AC_SUBST(BUILD_CPU)
AC_SUBST(BUILD_VENDOR)
AC_SUBST(BUILD_OS)

HOST_PLATFORM=${host}
HOST_CPU=${host_cpu}
HOST_VENDOR=${host_vendor}
HOST_OS=${host_os}

AC_SUBST(HOST_PLATFORM)
AC_SUBST(HOST_CPU)
AC_SUBST(HOST_VENDOR)
AC_SUBST(HOST_OS)
     netbsd*)
     OSARCH=NetBSD
     ;;
Jason Parker's avatar
Jason Parker committed
     openbsd*)
     OSARCH=OpenBSD
     ;;
     solaris*)
     OSARCH=SunOS
     ;;
     linux-gnueabi* |  linux-gnuspe)
Tzafrir Cohen's avatar
Tzafrir Cohen committed
     kfreebsd*-gnu)
     OSARCH=kfreebsd-gnu
     ;;
     OSARCH=${host_os}
#  check for uname
AC_PATH_TOOL([UNAME], [uname], No)
if test ! x"${UNAME}" = xNo; then
   PBX_OSREV=$(${UNAME} -r)
fi
AC_SUBST(PBX_OSREV)
Loading
Loading full blame...