-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1314 lines (1091 loc) · 47.3 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Generated with autoscan, then modified appropriately.
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([mesos], [0.22.0])
# Have autoconf setup some variables related to the system.
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_CANONICAL_TARGET
AC_LANG([C++])
AC_CONFIG_MACRO_DIR([m4])
# Initialize automake.
# -Wno-portability, since we require GNU Make for % patterns
# Removal of -Werror due warnings introduced by automake 1.14.
AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign])
# This is required for linking non-POSIX libs.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# Initialize libtool (LT_OUTPUT builds ./libtool immediately, needed
# if we want to do tests with libtool during configuration).
LT_PREREQ([2.2])
LT_INIT
LT_LANG([C++])
LT_OUTPUT
# Save the configure arguments so we can pass them to any third-party
# libraries that we might run configure on (see 3rdparty/Makefile.am).
# One downside of our strategy for shipping and building third-party
# libraries is that we can't expose options from nested third-party
# configure scripts.
CONFIGURE_ARGS="$ac_configure_args"
AC_SUBST(CONFIGURE_ARGS)
# Force configured third-party libraries (currently only libprocess)
# to only build a static library with position independent code so
# that we can produce a final shared library which includes everything
# necessary (and only install that).
ac_configure_args_pre="$ac_configure_args"
ac_configure_args_post="$ac_configure_args --enable-shared=no --with-pic"
ac_configure_args="$ac_configure_args_post"
# Make sure config.status doesn't get the changed configure arguments,
# so it can rerun configure in the root directory correctly. This is
# necessary for Makefile rules which would regenerate files (e.g.,
# 'Makefile') after configure.ac was updated.
AC_CONFIG_COMMANDS_PRE([ac_configure_args="$ac_configure_args_pre"])
AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args_post"])
AC_CONFIG_SUBDIRS([3rdparty/libprocess])
AC_CONFIG_FILES([Makefile mesos.pc])
AC_CONFIG_FILES([ec2/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([3rdparty/Makefile])
AC_CONFIG_FILES([bin/mesos.sh], [chmod +x bin/mesos.sh])
AC_CONFIG_FILES([bin/mesos-local.sh], [chmod +x bin/mesos-local.sh])
AC_CONFIG_FILES([bin/mesos-master.sh], [chmod +x bin/mesos-master.sh])
AC_CONFIG_FILES([bin/mesos-slave.sh], [chmod +x bin/mesos-slave.sh])
AC_CONFIG_FILES([bin/mesos-tests.sh], [chmod +x bin/mesos-tests.sh])
AC_CONFIG_FILES([bin/mesos-local-flags.sh])
AC_CONFIG_FILES([bin/mesos-master-flags.sh])
AC_CONFIG_FILES([bin/mesos-slave-flags.sh])
AC_CONFIG_FILES([bin/mesos-tests-flags.sh])
AC_CONFIG_FILES([bin/gdb-mesos-local.sh], [chmod +x bin/gdb-mesos-local.sh])
AC_CONFIG_FILES([bin/gdb-mesos-master.sh], [chmod +x bin/gdb-mesos-master.sh])
AC_CONFIG_FILES([bin/gdb-mesos-slave.sh], [chmod +x bin/gdb-mesos-slave.sh])
AC_CONFIG_FILES([bin/gdb-mesos-tests.sh], [chmod +x bin/gdb-mesos-tests.sh])
AC_CONFIG_FILES([bin/lldb-mesos-local.sh], [chmod +x bin/lldb-mesos-local.sh])
AC_CONFIG_FILES([bin/lldb-mesos-master.sh],
[chmod +x bin/lldb-mesos-master.sh])
AC_CONFIG_FILES([bin/lldb-mesos-slave.sh], [chmod +x bin/lldb-mesos-slave.sh])
AC_CONFIG_FILES([bin/lldb-mesos-tests.sh], [chmod +x bin/lldb-mesos-tests.sh])
AC_CONFIG_FILES([bin/valgrind-mesos-local.sh],
[chmod +x bin/valgrind-mesos-local.sh])
AC_CONFIG_FILES([bin/valgrind-mesos-slave.sh],
[chmod +x bin/valgrind-mesos-slave.sh])
AC_CONFIG_FILES([bin/valgrind-mesos-master.sh],
[chmod +x bin/valgrind-mesos-master.sh])
AC_CONFIG_FILES([bin/valgrind-mesos-tests.sh],
[chmod +x bin/valgrind-mesos-tests.sh])
AC_CONFIG_FILES([src/deploy/mesos-daemon.sh])
AC_CONFIG_FILES([src/deploy/mesos-start-cluster.sh])
AC_CONFIG_FILES([src/deploy/mesos-start-masters.sh])
AC_CONFIG_FILES([src/deploy/mesos-start-slaves.sh])
AC_CONFIG_FILES([src/deploy/mesos-stop-cluster.sh])
AC_CONFIG_FILES([src/deploy/mesos-stop-masters.sh])
AC_CONFIG_FILES([src/deploy/mesos-stop-slaves.sh])
AC_CONFIG_FILES([include/mesos/version.hpp])
AC_CONFIG_FILES([src/java/generated/org/apache/mesos/MesosNativeLibrary.java])
AC_CONFIG_FILES([mpi/mpiexec-mesos], [chmod +x mpi/mpiexec-mesos])
AC_ARG_ENABLE([java],
AS_HELP_STRING([--disable-java],
[don't build Java bindings]),
[], [enable_java=yes])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--disable-python],
[don't build Python bindings]),
[], [enable_python=yes])
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],
[enable debugging. If CFLAGS/CXXFLAGS are set, this
option won't change them default: no]),
[enable_debug=yes], [])
AC_ARG_ENABLE([optimize],
AS_HELP_STRING([--enable-optimize],
[enable optimizations. If CFLAGS/CXXFLAGS are set,
this option won't change them default: no]),
[enable_optimize=yes], [])
AC_ARG_ENABLE([bundled],
AS_HELP_STRING([--disable-bundled],
[build against preinstalled dependencies instead
of bundled libraries]),
[enable_bundled=no], [enable_bundled=yes])
AC_ARG_WITH([zookeeper],
AS_HELP_STRING([--with-zookeeper@<:@=DIR@:>@],
[excludes building and using the bundled ZooKeeper
package in lieu of an installed version at a
location prefixed by the given path]),
[without_bundled_zookeeper=yes], [])
AC_ARG_WITH([leveldb],
AS_HELP_STRING([--with-leveldb@<:@=DIR@:>@],
[excludes building and using the bundled LevelDB
package in lieu of an installed version at a
location prefixed by the given path]),
[without_bundled_leveldb=yes], [])
AC_ARG_WITH([glog],
AS_HELP_STRING([--with-glog@<:@=DIR@:>@],
[excludes building and using the bundled glog
package in lieu of an installed version at a
location prefixed by the given path]),
[without_bundled_glog=yes], [])
AC_ARG_WITH([protobuf],
AS_HELP_STRING([--with-protobuf@<:@=DIR@:>@],
[excludes building and using the bundled protobuf
package in lieu of an installed version at a
location prefixed by the given path]),
[without_bundled_protobuf=yes], [])
AC_ARG_WITH([gmock],
AS_HELP_STRING([--with-gmock@<:@=DIR@:>@],
[excludes building and using the bundled gmock
package in lieu of an installed version at a
location prefixed by the given path]),
[without_bundled_gmock=yes], [])
AC_ARG_WITH([curl],
AS_HELP_STRING([--with-curl=@<:@=DIR@:>@],
[specify where to locate the curl library]),
[], [])
AC_ARG_WITH([sasl],
AS_HELP_STRING([--with-sasl=@<:@=DIR@:>@],
[specify where to locate the sasl2 library]),
[], [])
AC_ARG_WITH([zlib],
AS_HELP_STRING([--with-zlib=@<:@=DIR@:>@],
[specify where to locate the zlib library]),
[], [])
AC_ARG_WITH([apr],
AS_HELP_STRING([--with-apr=@<:@=DIR@:>@],
[specify where to locate the apr-1 library]),
[], [])
AC_ARG_WITH([svn],
AS_HELP_STRING([--with-svn=@<:@=DIR@:>@],
[specify where to locate the svn-1 library]),
[], [])
AC_ARG_ENABLE([bundled-distribute],
AS_HELP_STRING([--disable-bundled-distribute],
[excludes building and using the bundled distribute
package in lieu of an installed version in
PYTHONPATH]),
[without_bundled_distribute=yes], [])
AC_ARG_ENABLE([bundled-pip],
AS_HELP_STRING([--disable-bundled-pip],
[excludes building and using the bundled pip
package in lieu of an installed version in
PYTHONPATH]),
[without_bundled_pip=yes], [])
AC_ARG_ENABLE([bundled-wheel],
AS_HELP_STRING([--disable-bundled-wheel],
[excludes building and using the bundled wheel
package in lieu of an installed version in
PYTHONPATH]),
[without_bundled_wheel=yes], [])
# This is used to make distcheck and python install work together. For more
# information, see the comment above AM_DISTCHECK_CONFIGURE_FLAGS in
# Makefile.am.
AC_ARG_ENABLE([python-dependency-install],
AS_HELP_STRING([--disable-python-dependency-install],
[when the python packages are installed during
make install, no external dependencies are
downloaded or installed]),
[without_python_deps=yes], [])
AC_ARG_WITH([network-isolator],
AS_HELP_STRING([--with-network-isolator],
[builds the network isolator]),
[], [with_network_isolator=no])
AC_ARG_VAR([JAVA_HOME], [location of Java Development Kit (JDK)])
AC_ARG_VAR([JAVA_CPPFLAGS], [preprocessor flags for JNI])
AC_ARG_VAR([JAVA_JVM_LIBRARY], [full path to libjvm.so])
AC_ARG_VAR([MAVEN_HOME], [looks for mvn at MAVEN_HOME/bin/mvn])
AC_ARG_VAR([PROTOBUF_JAR], [full path to protobuf jar on prefixed builds])
AC_ARG_VAR([PYTHON], [which Python interpreter to use])
AC_MSG_NOTICE([Setting up build environment for ${target_cpu} ${target_os}])
# Determine the current OS (TODO(benh): Does autotools do this for us?).
case "${target_os}" in
linux*)
OS_NAME=linux
LIBS="$LIBS -lrt"
;;
darwin*)
OS_NAME=darwin
;;
*)
AC_MSG_ERROR("Mesos is currently unsupported on your platform.")
esac
# Used for conditionally including source files.
AM_CONDITIONAL([OS_LINUX], [test "x$OS_NAME" = "xlinux"])
# Default to gcc toolchain (we rely on some atomic builtins for now,
# that are also present with clang).
AC_PROG_CXX([g++])
AC_PROG_CC([gcc])
# Check if we should enable debugging, optimization. Note we only
# update CFLAGS and CXXFLAGS if none are provided.
AM_CONDITIONAL([DEBUG], [test x"$enable_debug" = "xyes"])
AM_CONDITIONAL([OPTIMIZE], [test x"$enable_optimize" = "xyes"])
debug_flags="-g1"
if test "x$enable_debug" = "xyes"; then
debug_flags="-g"
elif test "x$enable_optimize" = "xyes"; then
debug_flags=""
fi
if test "x$enable_optimize" = "xyes"; then
optimize_flags="-O2"
else
optimize_flags="-O0"
fi
AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
[CFLAGS="$debug_flags $optimize_flags"])
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
[CXXFLAGS="$debug_flags $optimize_flags"])
# Attempt to use preinstalled dependencies instead of the bundled
# versions in cases where the user specified their location
# (--with-XXX=DIR) or asked us to attempt to detect them
# (--disable-bundled).
# Check if LevelDB prefix path was supplied and if so, add it to
# CPPFLAGS while extending it by /include and to LDFLAGS while
# extending it by /lib.
if test -n "`echo $with_leveldb`"; then
CPPFLAGS="$CPPFLAGS -I${with_leveldb}/include"
LDFLAGS="$LDFLAGS -L${with_leveldb}/lib"
fi
# Check if protobuf prefix path was supplied and if so, add it to
# CPPFLAGS while extending it by /include and to LDFLAGS while
# extending it by /lib.
if test -n "`echo $with_protobuf`"; then
CPPFLAGS="$CPPFLAGS -I${with_protobuf}/include"
LDFLAGS="$LDFLAGS -L${with_protobuf}/lib"
fi
# Check if ZooKeeper prefix path was supplied and if so, add it to
# CPPFLAGS while extending it by /include/zookeeper and to LDFLAGS
# while extending it by /lib.
# NOTE: The reason we append /include/zookeeper is because in mesos,
# we include <zookeeper.h> rather than <zookeeper/zookeeper.h>.
if test -n "`echo $with_zookeeper`"; then
CPPFLAGS="$CPPFLAGS -I${with_zookeeper}/include/zookeeper"
LDFLAGS="$LDFLAGS -L${with_zookeeper}/lib"
elif test "x$enable_bundled" = "xno"; then
CPPFLAGS="$CPPFLAGS -I/usr/include/zookeeper"
fi
# Check if glog prefix path was supplied and if so, add it to CPPFLAGS
# while extending it by /include and to LDFLAGS while extending it by
# /lib.
if test -n "`echo $with_glog`"; then
CPPFLAGS="$CPPFLAGS -I${with_glog}/include"
LDFLAGS="$LDFLAGS -L${with_glog}/lib"
fi
# Check if user has asked us to use a preinstalled LevelDB, or if they
# asked us to ignore all bundled libraries while compiling and
# linking.
if test "x$without_bundled_leveldb" = "xyes" || \
test "x$enable_bundled" != "xyes"; then
# Check if headers and library were located.
AC_CHECK_HEADERS([leveldb/db.h],
[AC_CHECK_LIB([leveldb],
[leveldb_open],
[found_leveldb=yes])])
if test "x$found_leveldb" = "xyes"; then
with_bundled_leveldb=no
else
AC_MSG_ERROR([cannot find LevelDB
-------------------------------------------------------------------
You have requested the use of a non-bundled LevelDB but no suitable
LevelDB could be found.
You may want specify the location of LevelDB by providing a prefix
path via --with-leveldb=DIR, or check that the path you provided is
correct if you're already doing this.
-------------------------------------------------------------------
])
fi
else
with_bundled_leveldb=yes
fi
AM_CONDITIONAL([WITH_BUNDLED_LEVELDB],
[test "x$with_bundled_leveldb" = "xyes"])
# Check if user has asked us to use a preinstalled glog, or if they
# asked us to ignore all bundled libraries while compiling and
# linking.
if test "x$without_bundled_glog" = "xyes" || \
test "x$enable_bundled" != "xyes"; then
# Check if headers and library were located.
AC_CHECK_HEADERS([glog/logging.h],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <glog/logging.h>], [])],
[TEST_LIBS="$TEST_LIBS -lglog"] [found_glog=yes],
[AC_MSG_WARN([glog is not installed.])])])
if test "x$found_glog" = "xyes"; then
with_bundled_glog=no
else
AC_MSG_ERROR([cannot find glog
-------------------------------------------------------------------
You have requested the use of a non-bundled glog but no suitable
glog could be found.
You may want specify the location of glog by providing a prefix
path via --with-glog=DIR, or check that the path you provided is
correct if you're already doing this.
-------------------------------------------------------------------
])
fi
else
with_bundled_glog=yes
fi
AM_CONDITIONAL([WITH_BUNDLED_GLOG],
[test "x$with_bundled_glog" = "xyes"])
# Check if user has asked us to use a preinstalled ZooKeeper or if
# they asked us to ignore all bundled libraries while compiling and
# linking.
if test "x$without_bundled_zookeeper" = "xyes" || \
test "x$enable_bundled" != "xyes"; then
# Check if headers and library were located.
AC_CHECK_HEADERS([zookeeper.h],
[AC_CHECK_LIB([zookeeper_mt],
[zookeeper_init],
[found_zookeeper=yes])])
if test "x$found_zookeeper" = "xyes"; then
with_bundled_zookeeper=no
else
AC_MSG_ERROR([cannot find ZooKeeper
-------------------------------------------------------------------
You have requested the use of a non-bundled ZooKeeper but no suitable
ZooKeeper could be found.
You may want specify the location of ZooKeeper by providing a prefix
path via --with-zookeeper=DIR, or check that the path you provided is
correct if you're already doing this
-------------------------------------------------------------------
])
fi
else
with_bundled_zookeeper=yes
fi
AM_CONDITIONAL([WITH_BUNDLED_ZOOKEEPER],
[test "x$with_bundled_zookeeper" = "xyes"])
# Check if user has asked us to use a preinstalled protobuf, or if
# they asked us to ignore all bundled libraries while compiling and
# linking.
if test "x$without_bundled_protobuf" = "xyes" || \
test "x$enable_bundled" != "xyes"; then
# Use the system default prefix if not specified.
if test -n "`echo $with_protobuf`"; then
PROTOBUFPREFIX="${with_protobuf}"
elif test "x$enable_bundled" != "xyes"; then
PROTOBUFPREFIX="/usr"
fi
# Check for protobuf.
# TODO(jieyu): Symbol _init is not available for libs on OS X.
# Consider checking lib using AX_CXX_CHECK_LIB.
AC_CHECK_HEADERS([google/protobuf/message.h],
[AC_CHECK_LIB([protobuf],
[_init],
[found_protobuf=yes])])
if test "x$found_protobuf" = "xyes"; then
with_bundled_protobuf=no
if test -z "`echo $PROTOBUF_JAR`"; then
PROTOBUF_JAR="${PROTOBUFPREFIX}/share/java/protobuf.jar"
fi
AC_CHECK_FILE([$PROTOBUF_JAR],
[],
[AC_MSG_ERROR([cannot find PROTOBUF_JAR=$PROTOBUF_JAR])])
AC_CHECK_TOOL([PROTOCOMPILER_TEST], [protoc], [], [$PROTOBUFPREFIX/bin])
if test -z "`echo $PROTOCOMPILER_TEST`"; then
AC_MSG_ERROR([protoc not found in PATH])
fi
PROTOCOMPILER="$PROTOBUFPREFIX/bin/protoc"
if test "x$enable_python" = "xyes"; then
AC_PYTHON_MODULE([google.protobuf], [yes])
fi
else
AC_MSG_ERROR([cannot find protobuf
-------------------------------------------------------------------
You have requested the use of a non-bundled protobuf but no suitable
protobuf could be found.
You may want specify the location of protobuf by providing a prefix
path via --with-protobuf=DIR, or check that the path you provided is
correct if youre already doing this.
-------------------------------------------------------------------
])
fi
else
with_bundled_protobuf=yes
PROTOBUF_JAR="\${MESOS_BUILD_DIR}/src/java/target/protobuf-java-2.5.0.jar"
fi
AM_CONDITIONAL([WITH_BUNDLED_PROTOBUF],
[test "x$with_bundled_protobuf" = "xyes"])
AC_SUBST([PROTOBUF_JAR])
AC_SUBST([PROTOCOMPILER])
# Check if we're using clang.
AC_MSG_CHECKING([if compiling with clang])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[CLANG=yes], [CLANG=no])
AC_LANG_POP([C++])
AC_MSG_RESULT([$CLANG])
AC_SUBST([CLANG])
if test "x$CLANG" = "xno"; then
# Check the version of gcc and add any flags as appropriate. Note
# that '-dumpversion' works for clang as well but as of clang 3.3 it
# reports version 4.2.1 (for gcc backwards compatibility).
GCC_VERSION="`${CC} -dumpversion`"
AC_MSG_NOTICE([GCC version: $GCC_VERSION])
test $? = 0 || AC_MSG_ERROR([failed to determine version of gcc])
# Check for GCC version 4.4.
AX_COMPARE_VERSION([$GCC_VERSION], [eq2], [4.4],
[is_gxx44=yes], [is_gxx44=no])
if test "x$is_gxx44" = "xyes"; then
AC_MSG_NOTICE([Setting up CXXFLAGS for g++-4.4])
# We fail to build some protobuf generated code with gcc 4.4
# without setting -fno-strict-aliasing.
CFLAGS="$CFLAGS -fno-strict-aliasing"
CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
fi
# Check for GCC version >= 4.8.
AX_COMPARE_VERSION([$GCC_VERSION], [ge], [4.8],
[is_ge_gxx48=yes], [is_ge_gxx48=no])
if test "x$is_ge_gxx48" = "xyes"; then
AC_MSG_NOTICE([Setting up CXXFLAGS for g++ version >= 4.8])
# Boost 1.53.0 fails to compile with GCC 4.8 without
# -Wno-unused-local-typedefs, and automake does not recognize the
# flag.
# TODO(brenden): Remove this when Boost has a resolution.
CFLAGS="${CFLAGS} -Wno-unused-local-typedefs"
CXXFLAGS="${CXXFLAGS} -Wno-unused-local-typedefs"
fi
# Check for GCC version == 4.7 and fail. Starting with 4.7 the '#if
# __cplusplus >= 201103L' will evaluate to true which means the
# C++11 code paths will be compiled but certain C++11 features that
# we use are not supported by 4.7. Since we're requiring C++11 going
# forward we can't support this compiler.
AX_COMPARE_VERSION([$GCC_VERSION], [eq2], [4.7],
[is_gxx47=yes], [is_gxx47=no])
if test "x$is_gxx47" = "xyes"; then
AC_MSG_ERROR([Unable to build with g++-4.7 due to missing C++11 features])
fi
fi
# Ensure we can build the C++11 features we expect, and set the std
# CXXFLAG as appropriate.
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
case "$host_os" in
darwin* )
# If we're using clang, we need to pass -stdlib=libc++ too.
if test "x$CLANG" = "xyes"; then
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
fi
# GTEST on OSX needs its own tr1 tuple.
# TODO(dhamon): Update to gmock 1.7 and pass GTEST_LANG_CXX11 when
# in C++11 mode.
CXXFLAGS="$CXXFLAGS -DGTEST_USE_OWN_TR1_TUPLE=1"
;;
esac
# Also pass the flags to 3rdparty libraries.
CONFIGURE_ARGS="$CONFIGURE_ARGS CXXFLAGS='$CXXFLAGS'"
# Check for pthreads (uses m4/acx_pthread.m4).
ACX_PTHREAD([], [AC_MSG_ERROR([failed to find pthreads])])
# Check for libunwind, and link it in if present.
AC_CHECK_LIB(unwind, backtrace, LIBS="$LIBS -lunwind")
# Check if zlib prefix path was provided, and if so, add it to
# the CPPFLAGS and LDFLAGS with respective /include and /lib path
# suffixes.
if test -n "`echo $with_zlib`" ; then
CPPFLAGS="-I${with_zlib}/include $CPPFLAGS"
LDFLAGS="-L${with_zlib}/lib $LDFLAGS"
fi
AC_CHECK_LIB([z], [gzread], [],
[AC_MSG_ERROR([cannot find libz
-------------------------------------------------------------------
libz is required for mesos to build.
-------------------------------------------------------------------
])])
# Check if Libcurl prefix path was provided, and if so, add it to
# the CPPFLAGS and LDFLAGS with respective /include and /lib path
# suffixes.
if test -n "`echo $with_curl`" ; then
CPPFLAGS="-I${with_curl}/include $CPPFLAGS"
LDFLAGS="-L${with_curl}/lib $LDFLAGS"
fi
AC_CHECK_LIB([curl], [curl_global_init], [],
[AC_MSG_ERROR([cannot find libcurl
-------------------------------------------------------------------
libcurl is required for mesos to build.
-------------------------------------------------------------------
])])
# Check if libapr-1 prefix path was provided, and if so, add it to
# the CPPFLAGS and LDFLAGS with respective /include/apr-1 and /lib path
# suffixes. We include /include/apr-1 because we include <apr*>
# headers directly.
if test -n "`echo $with_apr`" ; then
CPPFLAGS="-I${with_apr}/include/apr-1 -I${with_apr}/include/apr-1.0 $CPPFLAGS"
LDFLAGS="-L${with_apr}/lib $LDFLAGS"
else
CPPFLAGS="-I/usr/include/apr-1 -I/usr/include/apr-1.0 $CPPFLAGS"
fi
AC_CHECK_HEADERS([apr_pools.h],
[AC_CHECK_LIB([apr-1], [apr_initialize], [],
[AC_MSG_ERROR([cannot find libapr-1
-------------------------------------------------------------------
libapr-1 is required for mesos to build.
-------------------------------------------------------------------
])])], [AC_MSG_ERROR([cannot find libapr-1 headers
-------------------------------------------------------------------
libapr-1 is required for mesos to build.
-------------------------------------------------------------------
])])
# Check if libsvn-1 prefix path was provided, and if so, add it to
# the CPPFLAGS and LDFLAGS with respective /include and /lib path
# suffixes. We include /include/subversion-1 because we include
# <svn_*> directly.
if test -n "`echo $with_svn`" ; then
CPPFLAGS="-I${with_svn}/include/subversion-1 $CPPFLAGS"
LDFLAGS="-L${with_svn}/lib $LDFLAGS"
else
CPPFLAGS="-I/usr/include/subversion-1 $CPPFLAGS"
fi
AC_CHECK_HEADERS([svn_version.h],
[AC_CHECK_LIB([svn_subr-1], [svn_stringbuf_create_ensure], [],
[AC_MSG_ERROR([cannot find libsvn_subr-1
-------------------------------------------------------------------
libsubversion-1 is required for mesos to build.
-------------------------------------------------------------------
])])], [AC_MSG_ERROR([cannot find libsvn_subr-1 headers
-------------------------------------------------------------------
libsubversion-1 is required for mesos to build.
-------------------------------------------------------------------
])])
AC_CHECK_HEADERS([svn_delta.h],
[AC_CHECK_LIB([svn_delta-1], [svn_txdelta], [],
[AC_MSG_ERROR([cannot find libsvn_delta-1
-------------------------------------------------------------------
libsubversion-1 is required for mesos to build.
-------------------------------------------------------------------
])])], [AC_MSG_ERROR([cannot find libsvn_delta-1 headers
-------------------------------------------------------------------
libsubversion-1 is required for mesos to build.
-------------------------------------------------------------------
])])
# Check if Sasl2 prefix path was provided, and if so, add it to
# the CPPFLAGS and LDFLAGS with respective /include and /lib path
# suffixes.
if test -n "`echo $with_sasl`" ; then
CPPFLAGS="-I${with_sasl}/include $CPPFLAGS"
LDFLAGS="-L${with_sasl}/lib $LDFLAGS"
fi
# TODO(benh): Also check for md5 support so we can use the CRAM-MD5
# mechanism. We can likely do a AC_CHECK_LIB looking for a particular
# function only provided if md5 support is present.
AC_CHECK_LIB([sasl2], [sasl_done], [],
[AC_MSG_ERROR([cannot find libsasl2
-------------------------------------------------------------------
We need libsasl2 for authentication!
-------------------------------------------------------------------
])])
# Perform necessary configuration for network isolator.
if test "x$with_network_isolator" = "xyes"; then
# Check for OS support.
AS_IF([test "$OS_NAME" = "linux"],
[],
[AC_MSG_ERROR([cannot build network isolator
-------------------------------------------------------------------
Network isolator is only supported on Linux!
-------------------------------------------------------------------
])])
# Check for libnl (both headers and libraries).
AC_CHECK_LIB([nl-3], [nl_has_capability], [],
[AC_MSG_ERROR([cannot find libnl-3
-------------------------------------------------------------------
We need libnl-3 for building network isolator!
Please install libnl3 (version 3.2.24 or higher):
http://www.infradead.org/~tgr/libnl/
-------------------------------------------------------------------
])])
AC_CHECK_HEADERS([netlink/netlink.h libnl3/netlink/netlink.h],
[break]
[AC_MSG_ERROR([cannot find libnl-3 headers
-------------------------------------------------------------------
We need libnl-3 headers for building network isolator!
Please install libnl3 (version 3.2.24 or higher):
http://www.infradead.org/~tgr/libnl/
-------------------------------------------------------------------
])])
# Check for libnl-route (both headers and libraries).
AC_CHECK_LIB([nl-route-3], [rtnl_link_veth_add], [],
[AC_MSG_ERROR([cannot find libnl-route-3
-------------------------------------------------------------------
We need libnl-route-3 for building network isolator!
Please install libnl3 (version 3.2.24 or higher):
http://www.infradead.org/~tgr/libnl/
-------------------------------------------------------------------
])])
AC_CHECK_HEADERS([netlink/route/link/veth.h libnl3/netlink/route/link/veth.h],
[break]
[AC_MSG_ERROR([cannot find libnl-route-3 headers
-------------------------------------------------------------------
We need libnl-route-3 headers for building network isolator!
Please install libnl3 (version 3.2.24 or higher):
http://www.infradead.org/~tgr/libnl/
-------------------------------------------------------------------
])])
# Check for libnl-idiag-3 (both headers and libraries).
AC_CHECK_LIB([nl-idiag-3], [idiagnl_msg_alloc_cache], [],
[AC_MSG_ERROR([cannot find libnl-idiag-3
-------------------------------------------------------------------
We need libnl-idiag-3 for building network isolator!
Please install libnl3 (version 3.2.24 or higher):
http://www.infradead.org/~tgr/libnl/
-------------------------------------------------------------------
])])
# TODO(jieyu): Automatically detect the location where the libnl
# headers are installed.
LIBNL_CFLAGS=-I/usr/include/libnl3
AC_SUBST([LIBNL_CFLAGS])
AC_DEFINE([WITH_NETWORK_ISOLATOR])
fi
AM_CONDITIONAL([WITH_NETWORK_ISOLATOR],
[test "x$with_network_isolator" = "xyes"])
# TODO(benh): Consider using AS_IF instead of just shell 'if'
# statements for better autoconf style (the AS_IF macros also make
# sure variable dependencies are handled appropriately).
# A helper for checking whether we can compile and link using JNI with
# the current JAVA_CPPFLAGS (and JAVA_TEST_LDFLAGS which we setup
# ourselves below).
# TRY_LINK_JNI([ACTION-SUCCESS], [ACTION-FAILURE])
AC_DEFUN([TRY_LINK_JNI], [
cat <<__EOF__ >conftest.cpp [
#include <jni.h>
int main(int argc, char** argv)
{
JNIEnv* env;
JavaVM* jvm;
JavaVMInitArgs vmArgs;
return JNI_CreateJavaVM(&jvm, (void**) &env, &vmArgs);
}]
__EOF__
# Try to compile and link via libtool (the one we generate).
./libtool --tag=CXX --mode=link $CXX -Wall -Werror $JAVA_CPPFLAGS \
-o conftest conftest.cpp $JAVA_TEST_LDFLAGS >&5
if test $? != 0; then
rm -f conftest # Cleanup after ourselves.
$2 # Expand failure action.
else
rm -f conftest # Cleanup after ourselves.
$1 # Expand success action.
fi
])
# Perform necessary configuration for building with Java.
if test "x$enable_java" = "xyes"; then
# First let's try and determine JAVA_HOME if it hasn't been set. We
# do this by checking to see if the directory found at the
# 'java.home' system property for the java found on the path
# includes javac. If so, then we'll guess that this is a JDK
# installation rather than a JRE installation.
if test -z "$JAVA_HOME"; then
AC_PATH_PROG([JAVAC], [javac], [$JAVAC])
AC_PATH_PROG([JAVA], [java], [$JAVA])
if test "x$JAVA" = "x" || test "x$JAVAC" = "x"; then
AC_MSG_ERROR([can not guess JAVA_HOME (no 'java' or 'javac' found)])
fi
AC_MSG_CHECKING([value of Java system property 'java.home'])
cat <<__EOF__ >conftest.java [
public class conftest {
public static void main(String[] args) {
System.out.print(System.getProperty("java.home"));
}
}]
__EOF__
# Now build and run the code.
$JAVAC conftest.java && JAVA_DOT_HOME="`$JAVA -cp . conftest`"
if test $? = 0 && test ! -z "$JAVA_DOT_HOME"; then
AC_MSG_RESULT($JAVA_DOT_HOME)
else
JAVA_DOT_HOME=""
AC_MSG_RESULT([not found])
fi
# Clean up after ourselves.
rm -f conftest.java conftest.class
# Check if 'java.home' looks like a JDK installation, or if
# 'java.home'/.. looks like a JDK installation (e.g., Linux).
if test -f $JAVA_DOT_HOME/bin/javac; then
JAVA_HOME=$JAVA_DOT_HOME
elif test -f `dirname $JAVA_DOT_HOME`/bin/javac; then
JAVA_HOME=`dirname $JAVA_DOT_HOME`
fi
if test -z "$JAVA_HOME"; then
AC_MSG_ERROR([could not guess JAVA_HOME])
else
AC_MSG_NOTICE([using JAVA_HOME=$JAVA_HOME])
fi
fi
# Determine linker flags for Java if not set.
if test "$OS_NAME" = "darwin"; then
dir="$JAVA_HOME/jre/lib/server"
JAVA_TEST_LDFLAGS="-framework JavaVM"
JAVA_JVM_LIBRARY=$dir/libjvm.dylib
elif test "$OS_NAME" = "linux"; then
for arch in amd64 i386 arm aarch64 ppc64 ppc64le s390 s390x; do
dir="$JAVA_HOME/jre/lib/$arch/server"
if test -e "$dir"; then
# Note that these are libtool specific flags.
JAVA_TEST_LDFLAGS="-L$dir -R$dir -Wl,-ljvm"
JAVA_JVM_LIBRARY=$dir/libjvm.so
break;
fi
done
fi
if test -z "$JAVA_TEST_LDFLAGS"; then
AC_MSG_ERROR([failed to determine linker flags for using Java \
(bad JAVA_HOME or missing support for your architecture?)])
fi
# Now try and build with JNI, looping through possible compiler
# flags as necessary (provided JAVA_CPPFLAGS was not set).
AC_MSG_CHECKING([whether or not we can build with JNI])
if test -z "$JAVA_CPPFLAGS"; then
if test "$OS_NAME" = "darwin"; then
while true; do # Loop until sucessful (via break) or exhausted options.
m4_foreach([java_cppflags],
[["-I$JAVA_HOME/include -I$JAVA_HOME/include/$OS_NAME"],
["-I/System/Library/Frameworks/JavaVM.framework/Headers"]],
[JAVA_CPPFLAGS=java_cppflags
TRY_LINK_JNI([break])])
# Exhausted options.
AC_MSG_ERROR([failed to build with JNI
-------------------------------------------------------------------
It appears we were unable to compile against the JNI. This is most
likely due to one of the following issues:
1. You do not have a JDK installed on your system.
2. All JDKs installed on your system have deprecated JNI headers.
It is advised to install OpenJDK on your system, as the JDK that
ships with OS X has deprecated JNI headers.
-------------------------------------------------------------------
])
done
else
while true; do # Loop until sucessful (via break) or exhausted options.
m4_foreach([java_cppflags],
[["-I$JAVA_HOME/include -I$JAVA_HOME/include/$OS_NAME"]],
[JAVA_CPPFLAGS=java_cppflags
TRY_LINK_JNI([break])])
# Exhausted options.
AC_MSG_ERROR([failed to build with JNI])
done
fi
else
TRY_LINK_JNI([], [AC_MSG_ERROR([failed to build with JNI])])
fi
AC_MSG_RESULT([yes])
AC_CONFIG_FILES([src/examples/java/test-exception-framework],
[chmod +x src/examples/java/test-exception-framework])
AC_CONFIG_FILES([src/examples/java/test-executor],
[chmod +x src/examples/java/test-executor])
AC_CONFIG_FILES([src/examples/java/test-framework],
[chmod +x src/examples/java/test-framework])
AC_CONFIG_FILES([src/examples/java/test-multiple-executors-framework],
[chmod +x src/examples/java/test-multiple-executors-framework])
AC_CONFIG_FILES([src/examples/java/test-log],
[chmod +x src/examples/java/test-log])
AC_CONFIG_FILES([src/java/mesos.pom])
AC_DEFINE([MESOS_HAS_JAVA])
has_java=yes
# Test for Maven so we can build the jar.
if test -z "$MAVEN_HOME"; then
AC_PATH_PROG([MVN], [mvn], [$MVN])
if test "x$MVN" = "x"; then
AC_MSG_ERROR([can not find mvn on your path
-------------------------------------------------------------------
You may want verify that Maven has been correctly installed and
added to your PATH or set the MAVEN_HOME environment variable
to point to your Maven installation.
-------------------------------------------------------------------
])
fi
else
AC_PATH_PROGS([MVN], [mvn], [$MVN], [$MAVEN_HOME/bin])
if test "x$MVN" = "x"; then
AC_MSG_ERROR([can not find mvn inside $MAVEN_HOME/bin
-------------------------------------------------------------------
You may want verify the MAVEN_HOME validity or check that Maven
has been correctly installed.
-------------------------------------------------------------------
])
fi
fi
fi
AM_CONDITIONAL([HAS_JAVA], [test "x$has_java" = "xyes"])
# Perform necessary configuration for building with Python.
if test "x$enable_python" = "xyes"; then
# If the user specified PYTHON_VERSION then assume that is the
# Python that they want and construct PYTHON using the canonical
# name (failing if PYTHON is also set since we can't easily check
# that PYTHON and PYTHON_VERSION are compatible). This bit of
# tomfoolery is mostly to match the semantics of AC_PYTHON_DEVEL
# (used below). If we don't do this then it's possible that a user
# will specify PYTHON_VERSION which will get ignored (and likely