Skip to content

Commit 1867c9f

Browse files
committed
build: use AM_PROG_AR for ar detection; remove existing workarounds
1 parent 8dc73b8 commit 1867c9f

File tree

1 file changed

+6
-57
lines changed

1 file changed

+6
-57
lines changed

configure.ac

+6-57
Original file line numberDiff line numberDiff line change
@@ -27,67 +27,16 @@ case $host in
2727
esac
2828
AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" == "xyes"])
2929

30-
AM_INIT_AUTOMAKE([foreign subdir-objects])
31-
saved_cflags="$CFLAGS"
32-
LT_INIT([disable-static])
33-
CFLAGS="$saved_cflags"
30+
# Require Automake 1.11.2 for AM_PROG_AR
31+
AM_INIT_AUTOMAKE([1.11.2 foreign subdir-objects])
3432

3533
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
3634

3735
AC_PROG_CC
38-
39-
# Prefer the compilers native ar/ranlib if available
40-
# We have to manually loop to test these as autoconf inexplicably does
41-
# not provide an AC_PATH_TOOLS macro for this purpose.
42-
candidate_ars="ar"
43-
candidate_ranlibs="ranlib"
44-
case $CC in
45-
*gcc*)
46-
candidate_ars="gcc-ar ar"
47-
candidate_ranlibs="gcc-ranlib ranlib"
48-
;;
49-
*clang*)
50-
ver=$($CC --version | head -n 1 | cut -d' ' -f3 | cut -d'.' -f1)
51-
candidate_ars="llvm-ar-$ver llvm-ar ar"
52-
candidate_ranlibs="llvm-ranlib-$ver llvm-ranlib ranlib"
53-
;;
54-
esac
55-
56-
if test "x$is_osx" == "xyes"; then
57-
candidate_ars="libtool $candidate_ars"
58-
CCDIR=`dirname $CC`
59-
if test x"$CCDIR" != x"."; then
60-
if test -x $CCDIR/libtool; then
61-
# Use libtool from the same directory as our clang
62-
AR=$CCDIR/libtool
63-
candidate_ars=""
64-
fi
65-
fi
66-
fi
67-
68-
if test -n "$candidate_ars"; then
69-
for candidate in $candidate_ars; do
70-
AC_PATH_TOOL(AR, $candidate)
71-
if test "x$HAVE_AR" == "xyes"; then
72-
break
73-
fi
74-
done
75-
fi
76-
case $AR in
77-
*libtool)
78-
ARFLAGS="-static -o"
79-
AR_FLAGS="-static -o"
80-
AC_SUBST([ARFLAGS])
81-
AC_SUBST([AR_FLAGS])
82-
;;
83-
esac
84-
85-
for candidate in $candidate_ranlibs; do
86-
AC_PATH_TOOL(RANLIB, $candidate)
87-
if test "x$HAVE_RANLIB" == "xyes"; then
88-
break
89-
fi
90-
done
36+
AM_PROG_AR
37+
#saved_cflags="$CFLAGS"
38+
LT_INIT([disable-static])
39+
#CFLAGS="$saved_cflags"
9140

9241
AC_SUBST([AR])
9342
AC_SUBST([RANLIB])

0 commit comments

Comments
 (0)