-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathconfigure.ac
88 lines (75 loc) · 2.62 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT(gitsh, 0.14, hello@thoughtbot.com)
AM_INIT_AUTOMAKE([subdir-objects])
AC_ARG_VAR([RUBY],[The path of the Ruby binary to use])
AC_ARG_VAR(
[READLINE_LIB],
[The name of the readline library on your system, e.g. ereadline on OpenBSD]
)
AC_ARG_VAR(
[READLINE_ARCH],
[The architecture of the readline library on your system, e.g. x86_64]
)
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AC_PATH_PROGS([RUBY], [ruby ruby23 ruby24 ruby25 ruby26], [], $(getconf PATH))
AC_PATH_PROGS([RUBY], [ruby ruby23 ruby24 ruby25 ruby26])
if test -n $RUBY; then
case $RUBY in $HOME/*)
AC_MSG_WARN([Using a non-system Ruby. Disable rvm, rbenv, etc. or set \$RUBY])
esac
fi
AX_PROG_RUBY_VERSION(
[2.3.0],
[],
AC_MSG_ERROR(Ruby 2.3.0 or later is required to install gitsh)
)
RUBY_CFLAGS=$($RUBY ./configure.rb '-I$(rubyarchhdrdir) -I$(rubyhdrdir)')
RUBY_LIBS=$($RUBY ./configure.rb '-L$($(libdirname)) $(LIBRUBYARG) $(LIBS)')
RUBY_LDADD=$($RUBY ./configure.rb '$($(libdirname))/$(LIBRUBY)')
AC_SUBST([RUBY_CFLAGS])
AC_SUBST([RUBY_LIBS])
AC_SUBST([RUBY_LDADD])
VENDOR_DIRECTORY="vendor/gems"
test -d $VENDOR_DIRECTORY || mkdir -p $VENDOR_DIRECTORY
newer=$(ls -t $srcdir/Gemfile.lock $VENDOR_DIRECTORY/setup.rb 2>/dev/null | (read n; echo $n))
if test "$newer" == "$srcdir/Gemfile.lock"; then
rm -rf $VENDOR_DIRECTORY
$srcdir/vendor/vendorize $VENDOR_DIRECTORY || AC_MSG_ERROR([Vendorizing gems failed])
fi
AS_IF([test "x$READLINE_LIB" = x], [READLINE_LIB="readline"])
AS_IF(
[test "x$READLINE_ARCH" = x],
[readline_arch_arg=""],
[readline_arch_arg="--with-arch-flag=\"-arch $READLINE_ARCH\""]
)
current_dir="$PWD"
cd "$srcdir/ext/gitsh"
AS_IF(
[$RUBY extconf.rb --with-ldflags="$LDFLAGS" --with-cppflags="$CPPFLAGS" \
--with-readlinelib="$READLINE_LIB" "$readline_arch_arg"],
[],
AC_MSG_ERROR(Failed to configure Ruby extension)
)
cd "$current_dir"
rubydir=$datadir/$PACKAGE/ruby
rubylibdir=$rubydir/lib
pkgrubylibdir=$rubylibdir/gitsh
pkgsysconfdir=$sysconfdir/gitsh
libfiles="$(echo $(find "$srcdir/lib/gitsh" -name \*.rb))"
vendorfiles="$(echo $(find "$srcdir/vendor/gems" -type f))"
testfiles="$(echo $(find "$srcdir/spec/integration" "$srcdir/spec/units" -type f -name \*rb))"
gemsetuppath=$datadir/$PACKAGE/vendor/gems/setup.rb
AC_SUBST([RUBY])
AC_SUBST([rubydir])
AC_SUBST([rubylibdir])
AC_SUBST([pkgrubylibdir])
AC_SUBST([pkgsysconfdir])
AC_SUBST([libfiles])
AC_SUBST([vendorfiles])
AC_SUBST([testfiles])
AC_SUBST([gemsetuppath])
AC_CONFIG_FILES([Makefile INSTALL])
AC_OUTPUT