Source

dateutils / configure.ac

dnl -------------------------------------------------------------------------
dnl Autoconf startup.
dnl -------------------------------------------------------------------------

AC_PREREQ([2.63])
m4_define([GIT_VERSION_GEN], [dnl
pushdef([version], [m4_esyscmd([./git-version-gen])])[]dnl
ifelse([]version[], [], [0.1.10], []version[])[]dnl
popdef([version])[]dnl
])
AC_INIT([dateutils], [GIT_VERSION_GEN], [https://github.com/hroptatyr/dateutils])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/])

dnl -------------------------------------------------------------------------
dnl Local copyright notices.
dnl -------------------------------------------------------------------------

AC_COPYRIGHT(
[#### Configuration script for uschi and friends.
#### Copyright (C) 2011-2012 Sebastian Freundt

### Don't edit this script!
### This script was automatically generated by the `autoconf' program
### from the file `./configure.ac'.
### To rebuild it, execute the command
###     autoreconf
])

AM_INIT_AUTOMAKE([foreign dist-xz color-tests parallel-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

## the build chain
AC_PROG_CC([icc gcc tcc cc])
SXE_CHECK_CC([gnu11 c11 gnu1x c1x gnu99 c99])
AC_C_BIGENDIAN
SXE_CHECK_CFLAGS

## check for byteorder utils
AC_CHECK_HEADERS([endian.h sys/endian.h byteorder.h arpa/inet.h netinet/in.h])

## check for strptime
AC_CHECK_FUNCS([strptime])
have_strptime="${ac_cv_func_strptime}"
AM_CONDITIONAL([HAVE_STRPTIME], [test "${have_strptime}" = "yes"])

## check for working c1x features
SXE_CHECK_ANON_STRUCTS([
	AC_DEFINE([__C1X], [1], [Whether c1x work])
	], [
	AC_MSG_WARN([C compiler unusable

dateutils make extensive use of c11 anonymous structs/unions but your
compiler does not fully support them.
Change either the CFLAGS or the compiler.
Good day.
])
])

AM_MISSING_PROG([HELP2MAN], [help2man], ["${missing_dir}"])

AM_PROG_LEX
AC_PROG_YACC

AC_ARG_ENABLE([fast-arith],
	[AS_HELP_STRING([--enable-fast-arith], [
Whether to enable fast date handling and arithmetic routines at the cost
of strictness.  For instance the leap year rule used is incorrect for
years before 1901 and after 2100, or every month can have a 31st to
denote the last day of the month.])
AS_HELP_STRING([], [Default: disabled])],
	[enable_fast_arith="${enableval}"], [enable_fast_arith="no"])

## checks
if test "${enable_fast_arith}" = "yes"; then
	AC_DEFINE([WITH_FAST_ARITH], [1],
		[whether to use fast but incorrect date routines])
fi

## trivial, no special stuff needed
dapps="dadd dconv ddiff dgrep dseq dtest"
tapps="tadd tconv tdiff tgrep tseq ttest"
dtapps="dtconv"
if test "${have_strptime}" = "yes"; then
	miscapps="strptime"
fi

AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([info/Makefile])
AC_CONFIG_FILES([test/Makefile])
AC_CONFIG_FILES([libdudcore.pc])
AC_CONFIG_FILES([libdutcore.pc])
AC_CONFIG_FILES([libdudtcore.pc])
AC_OUTPUT

cat <<EOF


Build summary
=============
Build date apps:	${dapps}
Build time apps:	${tapps}
Build date/time apps:	${dtapps}
Build misc apps:	${miscapps}

EOF

dnl configure.ac ends here