Subversion Repositories tiedf

Rev

Rev 29 | Blame | Compare with Previous | Last modification | View Log | RSS feed

dnl Process this file with autoconf to produce a configure script.

# Init.
AC_PREREQ(2.57)
AC_INIT(tiedf, 0.90, [team@emgbox.org])

AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE

AC_PREFIX_DEFAULT(/opt/emg/usr/local)

# Files to configure
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([autoheader.h])
AC_CONFIG_FILES([
  Makefile
  man/Makefile
  misc/Makefile
  misc/tiedf
  misc/tiedf.sh
  src/Makefile
])

dnl AC_SUBST(VERSION)
dnl ISODATE=`date +%Y-%m-%d`
dnl AC_SUBST(ISODATE)

# Setup libtool
#AC_PROG_LIBTOOL
#AC_LIBTOOL_WIN32_DLL
#AC_DISABLE_STATIC
#AC_CANONICAL_HOST

dnl Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl Checks for header files.
AC_HEADER_MAJOR
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h time.h string.h memory.h fcntl.h alloca.h locale.h)
AC_CHECK_HEADERS(sys/types.h signal.h fcntl.h unistd.h errno.h)
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_HEADERS(termios.h sys/ioctl.h)
AC_CHECK_HEADERS(libxml/parser.h libxml/tree.h)

# Check for functions
AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_CLOSEDIR_VOID
AC_CHECK_FUNCS(fork pause signal fcntl)

# Check for types
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_TM

dnl Checks for typedefs, structures, and compiler characteristics.
#AC_CHECK_MEMBERS(struct stat.st_blksize)

dnl Checks for library functions.
AC_SEARCH_LIBS(xmlDocGetRootElement, xml2, [], 
[AC_MSG_ERROR([unable to find the xmlDocGetRootElement() function in libxml2])])

dnl Pass xml2 paths
CFLAGS="$CFLAGS `xml2-config --cflags`"
AC_SUBST(CFLAGS)
LDFLAGS="$LDFLAGS `xml2-config --libs`"
AC_SUBST(LDFLAGS)

dnl Check for pkg modules
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

dnl Platform specific tests.
dnl AC_CANONICAL_HOST
        case "$host" in
        *-*-mingw*) ARCH="-D__WIN32__ -D__MINGW32__" ;;
        *-*-cygwin) ARCH="-D__WIN32__ -D__CYGWIN__ -mno-cygwin" ;;
        arm*-*-linux-*) ARCH="-D__ARM__ -D__LINUX__" ;;
        i[[3456]]86-*-linux-*) ARCH="-D__I386__ -D__LINUX__" ;;
        *) ARCH="-D__LINUX__" ;;
esac
CFLAGS="$CFLAGS $ARCH"

# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
# gcc2 uses "-fnative-struct".
case $host_os in
        *mingw*|*cygwin*)
                if test x$GCC = xyes; then
                        msnative_struct=''
                        AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
                        if test -z "$ac_cv_prog_CC"; then
                                our_gcc="$CC"
                        else
                                our_gcc="$ac_cv_prog_CC"
                        fi      
                        case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
                        2.)
                                if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
                                        msnative_struct='-fnative-struct'
                                fi
                        ;;
                        *)
                                if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
                                        msnative_struct='-mms-bitfields'
                                fi
                        ;;
                        esac
                        if test x"$msnative_struct" = x ; then
                                AC_MSG_RESULT([no way])
                                AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
                        else
                                CFLAGS="$CFLAGS $msnative_struct"
                                AC_MSG_RESULT([${msnative_struct}])
                        fi
                fi
        ;;
        esac

AM_CONDITIONAL(OS_WIN32, test "$msnative_struct")

AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)

AC_OUTPUT()

echo "Now, you can type 'make' and 'make install'."

Generated by GNU Enscript 1.6.5.90.