Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modification to configure.ac: set darwin_ver correctly in configure #64

Open
thisisgk opened this issue Feb 7, 2022 · 0 comments
Open

Comments

@thisisgk
Copy link

thisisgk commented Feb 7, 2022

Hi,
I tried to build libcaca from git master on macOS. When I ran ./bootstrap then ./configure, I noticed this output:

./configure: line 19422: [: : integer expression expected

This is because darwin_ver is not set. Lines 19421-19422 in generated configure:

    darwin_ver="$(echo "${target_os}" | sed -ne 's/^0-9*\(0-9\+\).*/\1/p')"
    if [ "$darwin_ver" -lt "13" ]; then

from configure.ac:

libcaca/configure.ac

Lines 299 to 300 in f42aa68

darwin_ver="$(echo "${target_os}" | sed -ne 's/[^0-9]*\([0-9]\+\).*/\1/p')"
if [[ "$darwin_ver" -lt "13" ]]; then

As can be seen, brackets are removed from sed command. And, actually, \+ does nothing in macOS sed (came from BSD sed). [0-9]\+ should be written as [0-9][0-9]*.
Further, since test command is mainly used in configure.ac, I think it would be better to write if test here too.

So, I'd like to propose this modification to configure.ac:

--- a/configure.ac
+++ b/configure.ac
@@ -296,8 +296,8 @@ if test "${enable_cocoa}" != "no"; then
     esac
     CC="${CC:-gcc-${GCC_VERSION}}"
     CXX="${CXX:-g++-${GCC_VERSION}}"
-    darwin_ver="$(echo "${target_os}" | sed -ne 's/[^0-9]*\([0-9]\+\).*/\1/p')"
-    if [[ "$darwin_ver" -lt "13" ]]; then
+    darwin_ver="$(echo "${target_os}" | sed -ne 's/[[^0-9]]*\([[0-9]][[0-9]]*\).*/\1/p')"
+    if test "$darwin_ver" -lt "13"; then
       MACOSX_SDK_FRAMEWORKS="${MACOSX_SDK_FRAMEWORKS:--F${MACOSX_SDK}/System/Library/Frameworks}"
       CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
       CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -mmacosx-version-min=10.5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant