1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
|
dnl -------------------------------------------------------------------------
dnl Autoconf startup.
dnl -------------------------------------------------------------------------
AC_PREREQ([2.63])
AC_INIT([dateutils], [0.4.11], [https://github.com/hroptatyr/dateutils/issues])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/])
dnl -------------------------------------------------------------------------
dnl Local copyright notices.
dnl -------------------------------------------------------------------------
AC_COPYRIGHT([dnl
#### Configuration script for dateutils and friends.
#### Copyright (C) 2011-2024 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 subdir-objects])
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/generate version files
AX_YUCK_SCMVER([version.mk])
AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
## check for clitosis helper
AX_CHECK_CLITOSIS
## check for byteorder utils
AC_CHECK_HEADERS([endian.h sys/endian.h machine/endian.h byteorder.h])
AC_CHECK_HEADERS([byteswap.h])
AC_CHECK_HEADERS([sys/param.h])
AC_CHECK_HEADERS([sys/types.h])
## to make lintian happy
AC_SYS_LARGEFILE
## check for mmap and friends
SXE_CHECK_MMAP
## for getline()/fgetln() code (e.g. tzmap.c)
AC_CHECK_FUNCS([getline])
AC_CHECK_FUNCS([fgetln])
## AIX' take on stdint
AC_CHECK_HEADERS([sys/stdint.h])
## check for tzfile.h
AX_ZONEINFO([right])
AM_CONDITIONAL([ZONEINFO_UTC_RIGHT], [test -n "${ax_cv_zoneinfo_utc_right}"])
## 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_DECL
SXE_CHECK_ANON_STRUCTS_INIT
SXE_CHECK_SLOPPY_STRUCTS_INIT
if test "${sxe_cv_have_anon_structs_decl}" != "yes"; then
AC_MSG_ERROR([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.
])
fi
AM_PROG_LEX
AC_PROG_YACC
AC_PATH_PROG([GPERF], [gperf])
if test -z "${GPERF}"; then
GPERF="gperf"
fi
AC_ARG_VAR([GPERF], [full path to the gperf tool])
## check if we've got curl, necessary to d/l the tzmaps
AC_PATH_PROG([CURL], [curl])
AC_ARG_VAR([CURL], [full path to the curl tool])
AM_CONDITIONAL([HAVE_CURL], [test -n "${CURL}"])
AC_ARG_ENABLE([tzmap-fetch], [
AS_HELP_STRING([--enable-tzmap-fetch], [Fetch tzmaps from github, default: no.])],
[dnl
enable_tzmap_fetch="${enableval}"
if test -z "${CURL}"; then
enable_tzmap_fetch="no"
fi
], [enable_tzmap_fetch="no"])
AM_CONDITIONAL([FETCH_TZMAPS], [test "${enable_tzmap_fetch}" = "yes"])
AM_CONDITIONAL([HAVE_TZMAPS],
[test `find "${srcdir}/lib" -name '*.tzmap' -print | wc -l` -gt 0])
AC_PATH_PROG([GDATE], [date])
AC_ARG_VAR([GDATE], [full path to the date tool])
if test -n "${GDATE}"; then
## try and use -d
AC_MSG_CHECKING([if date is of GNU flavour])
if "${GDATE}" -d "2012-01-01" >/dev/null 2>/dev/null; then
have_gdate="yes"
else
have_gdate="no"
fi
AC_MSG_RESULT([${have_gdate}])
fi
if test -n "${GDATE}" -a "${have_gdate}" = "yes"; then
## try and use -d with a big year
AC_MSG_CHECKING([if date is immune to year 2038 problem])
if "${GDATE}" -d "4095-01-01" >/dev/null 2>/dev/null; then
have_gdate_2039="yes"
else
have_gdate_2039="no"
fi
AC_MSG_RESULT([${have_gdate_2039}])
fi
AC_ARG_VAR([have_gdate], [yes if GDATE is of GNU flavour])
AC_ARG_VAR([have_gdate_2039], [yes if GDATE can handle years beyond 2038])
AM_CONDITIONAL([HAVE_GDATE], [test "${have_gdate}" = "yes"])
AM_CONDITIONAL([HAVE_GDATE_2039], [test "${have_gdate_2039}" = "yes"])
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"])
AC_ARG_ENABLE([contrib], [
AS_HELP_STRING([--enable-contrib], [Build contribs, default: no.])],
[enable_contrib="${enableval}"], [enable_contrib="no"])
AM_CONDITIONAL([WITH_CONTRIB], [test "${enable_contrib}" != "no"])
AC_ARG_WITH([old-names], [
AS_HELP_STRING([--with-old-names], [Install old binary names only, default: no.])],
[with_old_names="${withval}"], [with_old_names="no"])
AM_CONDITIONAL([WITH_OLD_NAMES], [test "${with_old_names}" != "no"])
AC_ARG_WITH([old-links], [
AS_HELP_STRING([--with-old-links], [Install compatibility symlinks, default: yes.])],
[with_old_links="${withval}"], [with_old_links="yes"])
AM_CONDITIONAL([WITH_OLD_LINKS], [test "${with_old_links}" != "no"])
## checks
if test "${enable_fast_arith}" = "yes"; then
AC_DEFINE([WITH_FAST_ARITH], [1],
[whether to use fast but incorrect date routines])
fi
## always define this one for now
AC_DEFINE([WITH_LEAP_SECONDS], [1], [Whether to use leap-second aware routines])
AM_CONDITIONAL([WITH_LEAP_SECONDS], [test "1" = "1"])
## trivial conditional so that the dexpr scanner and parser are built
AM_CONDITIONAL([BUILD_DEXPR], [test "0" = "1"])
AM_CONDITIONAL([BUILD_LTRCC], [test ! -f "${srcdir}/lib/leapseconds.def"])
## check for contrib stuff
if test "${enable_contrib}" != "no"; then
## check for matlab, then octave
SXE_CHECK_MATLAB
SXE_CHECK_OCTAVE
fi
AM_CONDITIONAL([BUILD_MEXCLI], [test "${sxe_cv_matlab_mex_h}" = "yes" -a -n "${MATLABPATH}"])
AM_CONDITIONAL([BUILD_OCTCLI], [test "${sxe_cv_octave_mex_h}" = "yes" -a -n "${OCTAVEPATH}"])
## prepare the summary page
if test "${with_old_names}" = "no"; then
dut_apps="dateadd dateconv datediff dategrep dateround dateseq datesort datetest datezone"
else
dut_apps="dadd dconv ddiff dgrep dround dseq dsort dtest dzone"
fi
if test "${have_strptime}" = "yes"; then
misc_apps="strptime"
else
misc_apps="none"
fi
if test "${enable_contrib}" != "no"; then
if test "${sxe_cv_matlab_mex_h}" = "yes"; then
cntrb_apps="${cntrb_apps}${cntrb_apps:+ }tzconv.m(atlab)"
fi
if test "${sxe_cv_octave_mex_h}" = "yes"; then
cntrb_apps="${cntrb_apps}${cntrb_apps:+ }tzconv.m(octave)"
fi
else
cntrb_apps="none"
fi
AX_CHECK_YUCK([yes])
dnl must come after all AC_LINK_IFELSE clauses
## check for the ldflags
SXE_CHECK_LDFLAGS
LT_INIT
SXE_CHECK_LIBTOOL
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([build-aux/Makefile])
AC_CONFIG_FILES([data/Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([info/Makefile])
AC_CONFIG_FILES([test/Makefile])
AC_CONFIG_FILES([contrib/Makefile])
AC_OUTPUT
cat <<EOF
Build summary
=============
Build date/time apps: ${dut_apps}
Build misc apps: ${misc_apps}
Build contrib apps: ${cntrb_apps}
EOF
if test "${with_old_names}" = "no"; then
cat <<EOF
New binary names will be used (compatibility symlinks: $with_old_links).
See configure options --with-old-names and --with-old-links.
EOF
else
echo "Old binary names will be used."
fi
dnl configure.ac ends here
|