open-src/util/util-macros/Makefile
changeset 1256 e56a6662414b
parent 1179 4ad971e180c3
child 1265 0b5cc5c013e4
--- a/open-src/util/util-macros/Makefile	Mon Mar 12 13:08:34 2012 -0700
+++ b/open-src/util/util-macros/Makefile	Mon Mar 12 14:39:48 2012 -0700
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -65,6 +65,11 @@
 # Libtool versions before 2.2.2 fail to work with LD=cc in 64 bit builds, 
 # so install fixed libtool m4 macros here as well, so that modules that
 # run autoreconf get the fixed sources
+#
+# S11U1 now has libtool 2.4.2, but not everyone has updated yet to a build
+# with the new version, so for now, we check the version number before trying
+# to apply the patch, to avoid failures on versions with the bug already fixed.
+# This will be removed in the future, once everyone has had a chance to upgrade.
 install_libtool_fix: $(TOOLS_ACLOCAL_DIR)/libtool.m4
 
 $(TOOLS_ACLOCAL_DIR)/libtool.m4: $(TOOLS_ACLOCAL_DIR) libtool-64.patch
@@ -72,7 +77,14 @@
 	SYSTEM_ACLOCAL_DIR=$$($(ACLOCAL_PATH) --print-ac-dir) ; \
 	cp $${SYSTEM_ACLOCAL_DIR}/libtool.m4 \
 		$(TOOLS_ACLOCAL_DIR)/libtool.m4
-	gpatch -d $(TOOLS_ACLOCAL_DIR) < libtool-64.patch
+	@libtool_version=$$(libtool --version | \
+				awk '/^libtool / {print $$NF ; exit}') ; \
+	if [[ $${libtool_version%%.[0-9.]*} -lt 2 ]] ; then \
+		$(START_CMD_ECHO) ; \
+		gpatch -d $(TOOLS_ACLOCAL_DIR) < libtool-64.patch ; \
+	else \
+		print 'libtool version 2 in use, skipping libtool-64.patch' ; \
+	fi
 
 # autoreconf fails if the aclocal include directories don't exist yet
 $(AUTOCONF_TARGET): $(TOOLS_ACLOCAL_DIR) $(PROTODIR)$(X11_ACLOCAL_DIR)