|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76044 'date: illegal option -- -' in ./configure on FreeBSD
Submitted: 2018-03-02 14:40 UTC Modified: -
From: mgorny at gentoo dot org Assigned:
Status: Closed Package: *Compile Issues
PHP Version: master-Git-2018-03-02 (Git) OS: Gentoo/FreeBSD 11.1
Private report: No CVE-ID: None
 [2018-03-02 14:40 UTC] mgorny at gentoo dot org
When running the configure script, I see the following error message from underlying tools:

Configuring TSRM
checking for stdarg.h... (cached) yes
checking for sigprocmask... (cached) yes
checking how many arguments gethostbyname_r() takes... (cached) six
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

Apparently, the following code uses GNU-specific 'date' tool syntax that does not work on *BSD (FWICS, it also won't work on MacOS X):

PHP_BUILD_DATE=`date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y-%m-%d`

The *BSD version of 'date' does not support long options at all. The following would work for the current date:

PHP_BUILD_DATE=`date -u +%Y-%m-%d`

However, I don't know of any portable replacement for --date. FWICS, the *BSD version has '-r' option that takes UNIX epoch timestamp but the GNU version uses '-r' for something else.

One possible option would be to replace SOURCE_DATE_EPOCH with verbatim Y-m-d date, and use e.g.:

PHP_BUILD_DATE=${SOURCE_DATE:-$(date -u +%Y-%m-%d)}


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-05 21:39 UTC]
Automatic comment on behalf of ab
Log: Fixed bug #76044 'date: illegal option -- -' in ./configure on FreeBSD
 [2018-03-05 21:39 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue May 30 02:03:44 2023 UTC