aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-05-06 17:49:37 +0000
committerkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-05-06 17:49:37 +0000
commit9824eda6b558cd88c63064017593521ecad2029f (patch)
tree51283c7de8f20ac7f54331296c8743fd5ab62b8c /configure.ac
parent42c81e1a764d565823c203e9e07376379639ffa7 (diff)
downloadprotobuf-9824eda6b558cd88c63064017593521ecad2029f.tar.gz
protobuf-9824eda6b558cd88c63064017593521ecad2029f.tar.bz2
protobuf-9824eda6b558cd88c63064017593521ecad2029f.zip
enable cross-compiling
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac24
1 files changed, 24 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7f068c31..b10473e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,11 @@ AC_ARG_WITH([zlib],
[include classes for streaming compressed data in and out @<:@default=check@:>@])],
[],[with_zlib=check])
+AC_ARG_WITH([protoc],
+ [AS_HELP_STRING([--with-protoc=COMMAND],
+ [use the given protoc command instead of building a new one when building tests (useful for cross-compiling)])],
+ [],[with_protoc=no])
+
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
@@ -90,6 +95,25 @@ AS_IF([test "$with_zlib" != no],
fi])])
AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1])
+AS_IF([test "$with_protoc" != "no"], [
+ PROTOC=$with_protoc
+ AS_IF([test "$with_protoc" == "yes"], [
+ # No argument given. Use system protoc.
+ PROTOC=protoc
+ ])
+ AS_IF([echo "$PROTOC" | grep -q '^@<:@^/@:>@.*/'], [
+ # Does not start with a slash, but contains a slash. So, it's a relative
+ # path (as opposed to an absolute path or an executable in $PATH).
+ # Since it will actually be executed from the src directory, prefix with
+ # the current directory. We also insert $ac_top_build_prefix in case this
+ # is a nested package and --with-protoc was actually given on the outer
+ # package's configure script.
+ PROTOC=`pwd`/${ac_top_build_prefix}$PROTOC
+ ])
+ AC_SUBST([PROTOC])
+])
+AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"])
+
ACX_PTHREAD
AC_CXX_STL_HASH