cf: Run AFS_LT_INIT after setting CC

Since libtool support was introduced for 1.8.x in commit 69f26ece (Add
libtool support), we've run LT_INIT or AFS_LT_INIT early on in
configure.ac.

If CC isn't set, AFS_LT_INIT defaults to using gcc when it's available.
On Solaris, we set CC and CFLAGS ourselves later (in osconf.m4) to use
the Solaris Studio compiler, but this doesn't change the compiler that
AFS_LT_INIT already chose. As a result, on Solaris if no value for CC is
given during configure and gcc is available, some libtool commands will
try to use gcc with CFLAGS intended for the Solaris Studio compiler,
which will fail.

  /bin/sh ../../libtool --quiet --mode=link --tag=CC ... -mt ...
  gcc: error: unrecognized command line option '-mt'; did you mean '-t'?

To fix this, move AFS_LT_INIT into osconf.m4 after our platform-specific
macros have had a chance to set CC. Also move our checks for AR, AS,
etc. to after AFS_LT_INIT, since AFS_LT_INIT sets those.

Note.  Without GCC installed on a Solaris system, libtool will find the
Solaris Studio compiler (assuming that PATH is set up correctly) and the
build will proceed successfully. Just installing the GCC package is
sufficient to break the build.

This commit fixes a regression from 1.6.x where having the GCC package
installed on the system would not break the build.

Change-Id: I6458739fa5050eb98e6980e8d7b0ebfcc62d493f
Reviewed-on: https://gerrit.openafs.org/14585
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Cheyenne Wills 2021-04-07 10:51:58 -06:00 committed by Benjamin Kaduk
parent a1c2c4253b
commit 0a58d21881
2 changed files with 14 additions and 14 deletions

View File

@ -14,8 +14,6 @@ AS_IF([test -z "$CFLAGS"], [CFLAGS=" "])
AC_USE_SYSTEM_EXTENSIONS
AFS_LT_INIT
AC_PROG_CC
AC_PATH_PROGS([PATH_CPP], [cpp], [${CC-cc} -E], [$PATH:/lib:/usr/ccs/lib])

View File

@ -32,18 +32,6 @@ AC_CHECK_TOOL(LD, ld, [false])
AC_CHECK_PROGS(CP, cp, [false])
AC_CHECK_PROGS(GENCAT, gencat, [false])
dnl if ar is not present, libtool.m4 (provided by libtool) sets AR to false
dnl if strip is not present, libtool.m4 (provided by libtool) sets STRIP to :
AS_IF([test "x$AR" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ar'])])
AS_IF([test "x$AS" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'as'])])
AS_IF([test "x$MV" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'mv'])])
AS_IF([test "x$RM" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'rm'])])
AS_IF([test "x$LD" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ld'])])
AS_IF([test "x$CP" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'cp'])])
AS_IF([test "x$GENCAT" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'gencat'])])
dnl TODO - need to disable STRIP if we are doing debugging in any user space code
case $AFS_SYSNAME in
alpha_linux_22 | alpha_linux_24 | alpha_linux_26)
CCOBJ="\$(CC) -fPIC"
@ -544,6 +532,20 @@ esac
MT_CFLAGS="${MT_CFLAGS} -DAFS_PTHREAD_ENV"
AFS_LT_INIT
dnl if ar is not present, libtool.m4 (provided by libtool) sets AR to false
dnl if strip is not present, libtool.m4 (provided by libtool) sets STRIP to :
AS_IF([test "x$AR" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ar'])])
AS_IF([test "x$AS" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'as'])])
AS_IF([test "x$MV" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'mv'])])
AS_IF([test "x$RM" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'rm'])])
AS_IF([test "x$LD" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ld'])])
AS_IF([test "x$CP" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'cp'])])
AS_IF([test "x$GENCAT" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'gencat'])])
dnl TODO - need to disable STRIP if we are doing debugging in any user space code
#
# Defaults for --enable-optimize-kernel
#