[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unable to set AR and ARFLAGS for operating systems like OS X

From: Jeffrey Walton
Subject: Unable to set AR and ARFLAGS for operating systems like OS X
Date: Sat, 4 Nov 2017 12:30:22 -0400

It looks like Autotools is not equipped to handle changes to AR and
ARFLAGS. There is no AC_PROG_AR macro to find the correct AR and
ARFLAGS for the platform and compiler.

Trying to hack AR configuration information in configure.ac produces a
non-working configuration due to hard-coding ARFLAGS like "cru":

  IS_APPLE=`echo $build | $EGREP -i -c 'apple'`
  if test "$IS_APPLE" -ne "0"; then
     AC_SUBST([AR], ["/usr/bin/libtool"])
     AC_SUBST([ARFLAGS], ["-static -o"])
     AC_SUBST([ac_ct_AR], ["/usr/bin/libtool"])

OS X needs the following flags, otherwise building fat libraries and
some cross-compiles fail.

  AR = /usr/bin/libtool
  ARFLAGS = -static -o

Usage of AR and ARFLAGS on OS X must be:

  $(AR) $(ARFLAGS) <library name> ...

Similar problems are encountered on Solaris with SunCC. We need the
following on the platform when SunCC is the compiler.

  AR = $(CXX)
  ARFLAGS = -xar -o
  RANLIB = true

The limitations are not documented in the Autoconf or Automake
manuals, so problems are reported against individual projects. Users
don't understand why they can't build fat libraries and why some
builds fail. The don't realize its an Autotools problem, and not a
project problem.

The issue also runs afoul of GNU's "user choice" philosophy. Users
should be able to select the appropriate tool for the platform and

reply via email to

[Prev in Thread] Current Thread [Next in Thread]