Skip to content

Hardcoded freetype and X11 locations #562

Open

Description

@ryandesign

The code makes some assumptions about where freetype and X11 are installed:

$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -I/usr/include/freetype2 -I/opt/X11/include/freetype2 -o drawstring3d.o drawstring3d.cc; \

unicon/src/iconc/ccomp.c

Lines 260 to 263 in 1c0d0de

#ifdef MacOS
buf = growcat(buf, &buflen, 1,
" -I/usr/X11/include -I/usr/X11 -I/usr/X11/include/freetype2 -L/usr/X11/lib");
#endif

unicon/configure.ac

Lines 679 to 686 in 1c0d0de

*solaris*)
XLIBS = -L/usr/X11R6/lib/64 -R/usr/X11R6/lib/64 -lXpm -lX11 ;;
*aix*)
;;
*bsd*)
;;
*macos*)
XLIBS="-L/opt/X11/lib -L/usr/X11R6/lib -L/usr/local/lib -lXpm -lX11"

Short of patching the code, there isn't a good way for me to tell it that freetype and X11 are actually somewhere else.

Activity

  1. ryandesign commented on Mar 31, 2026

    @ryandesign
    ContributorAuthor

    Ideally, the locations of X11 and freetype should be determined by the configure script, and I should be able to override them with configure flags or environment variables.

    Asking pkg-config is typically a good way to find where things are installed, except that macOS doesn't come with pkg-config or .pc files so it's no good for finding things included with macOS.

    X11 and freetype are not included with macOS. They were available as an optional install in macOS in the distant past, back when it was called Mac OS X, but these days it has to be installed from another source. The popular pre-compiled X11 (including freetype) for macOS is XQuartz. It installs to /opt/X11 but although it does install .pc files it does not install pkg-config. It does install freetype-config.

    A user might also install X11 and freetype using a package manager like MacPorts or Homebrew. These would provide both the .pc files and pkg-config. So asking pkg-config is still a good thing to attempt first, just be prepared to fall back to freetype-config and hardcoded locations if it fails.

  2. ryandesign commented on Mar 31, 2026

    @ryandesign
    ContributorAuthor

    Ideally, the locations of X11 and freetype should be determined by the configure script, and I should be able to override them with configure flags or environment variables.

    And you already do look for X11 and freetype in configure:

    unicon/configure.ac

    Lines 632 to 636 in 1c0d0de

    CHECK_XLIB()
    # if we have X11 or if we are running on MS Windows check for graphics libs
    if test "x$cv_libX11" = xyes -o "ms$unicon_os" = "mswindows" ; then
    CHECK_FREETYPE()

    And it does find them:

    checking if xlib is wanted... yes
    checking for X11/Xlib.h... yes
    checking for X11/Xos.h... yes
    checking for X11/Xutil.h... yes
    checking for X11/Xatom.h... yes
    checking for X11/Xlib.h... (cached) yes
    checking for X11/Xos.h... (cached) yes
    checking for X11/Xutil.h... (cached) yes
    checking for X11/Xatom.h... (cached) yes
    checking for library containing XAllocColorCells... -lX11
    checking if freetype is wanted... yes
    checking for freetype/fttypes.h... yes
    checking for library containing FT_Open_Face... -lfreetype
    

    It might just be a matter of replacing the hardcoded paths in Makefile and ccomp.c with the paths that were found at configure time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions