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

configure prefers system install of ncurses over available pkg-config on macOS #113565

Closed
ronaldoussoren opened this issue Dec 29, 2023 · 1 comment · Fixed by #119816
Closed
Labels
build The build process and cross-build type-feature A feature request or enhancement

Comments

@ronaldoussoren
Copy link
Contributor

ronaldoussoren commented Dec 29, 2023

Feature or enhancement

Proposal:

I have ncurses 6.4 installed locally with corresponding pkg-config files. I'd expect that configure will pick up that installation, but it seems to prefer the system installation.

I ended up running configure with explicit overrides for the CURSES and PANEL CFLAGS and LIBS variables:

 ../configure  ... CURSES_CFLAGS="$(pkg-config --cflags ncursesw)" CURSES_LIBS="$(pkg-config --libs ncursesw)" PANEL_CFLAGS="$(pkg-config --cflags panelw)" PANEL_LIBS="$(pkg-config --libs panelw)"

configure does pick up other local installs (sqlite, bz2, ...)

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@ronaldoussoren ronaldoussoren added type-feature A feature request or enhancement build The build process and cross-build labels Dec 29, 2023
@erlend-aasland
Copy link
Contributor

erlend-aasland commented May 28, 2024

It seems to me our configure checks are suboptimal in many cases when it comes to ncurses[w] and panel[w]. Some observations:

  1. It does not make sense to not check for ncursesw or npanelw on macOS; we should remove the existing guards
  2. HAVE_NCURSESW is automatically defined on macOS if have_curses != no; I'm not sure if we should keep this
  3. A lot of curses feature checks do not use the pkg-config discovered CFLAGS/LIBS

I think we should rework it to first do the ncursesw and panelw checks; if not found, try ncurses and panel. Then, do the feature checks with discovered CFLAGS/LIBS applied.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue May 31, 2024
erlend-aasland added a commit that referenced this issue Jul 1, 2024
1. Use pkg-config to check for ncursesw/panelw. If that fails, use 
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're 
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 1, 2024
…ythonGH-119816)

1. Use pkg-config to check for ncursesw/panelw. If that fails, use
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.
(cherry picked from commit f80376b)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
erlend-aasland added a commit that referenced this issue Jul 1, 2024
…GH-119816) (#121202)

1. Use pkg-config to check for ncursesw/panelw. If that fails, use
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.
(cherry picked from commit f80376b)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Akasurde pushed a commit to Akasurde/cpython that referenced this issue Jul 3, 2024
…ython#119816)

1. Use pkg-config to check for ncursesw/panelw. If that fails, use 
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're 
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
…ython#119816)

1. Use pkg-config to check for ncursesw/panelw. If that fails, use 
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're 
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
…ython#119816)

1. Use pkg-config to check for ncursesw/panelw. If that fails, use 
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're 
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants