cf: Run AFS_LT_INIT after setting CC 85/14585/3
authorCheyenne Wills <cwills@sinenomine.net>
Wed, 7 Apr 2021 16:51:58 +0000 (10:51 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 9 Apr 2021 15:36:19 +0000 (11:36 -0400)
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>

configure.ac
src/cf/osconf.m4

index 10b038d..4a3a795 100644 (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])
index 42cddb5..21cc385 100644 (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
 #