-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1412 lines (1241 loc) · 47.4 KB
/
configure.in
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
# NOTE1: to do a proper Win32 cross compile from Linux use ./configure --host=i686-w64-mingw32
#
# NOTE2: $build refers to the platform where this script is running
# $host refers to the platform where the final code will run
dnl Process this file with autoconf to produce a configure script.
dnl
dnl OPP_CHECK_LIB( -- macro to check availability of a library
dnl $1: LIBRARY-NAME, -- descriptive name (only for printout)
dnl $2: HEADER, -- optional: header file to #include
dnl $3: FUNCTION, -- optional: function WITH ARG LIST, e.g. floor(0.5)
dnl $4: CFLAGS, -- optional: compiler flags
dnl $5: LDFLAGS, -- optional: linker flags
dnl $6: RESULT-VAR -- will contain "yes" or "no"
dnl $7: ACTION-IF-FOUND
dnl $8: ACTION-IF-NOT-FOUND
dnl )
dnl
AC_DEFUN(OPP_CHECK_LIB,[
save_CXXFLAGS=$CXXFLAGS
save_LIBS=$LIBS
CXXFLAGS="$4"
LIBS="$5"
AC_MSG_CHECKING(for $1 with CFLAGS="$4" LIBS="$5")
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <$2>]], [[$3;]])],
[AC_MSG_RESULT(yes); $6=yes; $7],
[AC_MSG_RESULT(no); $6=no; $8])
CXXFLAGS=$save_CXXFLAGS
LIBS=$save_LIBS
])
dnl
dnl Same as OPP_CHECK_LIB(), but also tries to run the program (uses
dnl AC_RUN_IFELSE instead of AC_LINK_IFELSE).
dnl
dnl OPP_CHECK_AND_RUN_LIB( -- macro to check availability of a library
dnl $1: LIBRARY-NAME, -- descriptive name (only for printout)
dnl $2: HEADER, -- optional: header file to #include
dnl $3: FUNCTION, -- optional: function WITH ARG LIST, e.g. floor(0.5)
dnl $4: CFLAGS, -- optional: compiler flags
dnl $5: LDFLAGS, -- optional: linker flags
dnl $6: RESULT-VAR -- will contain "yes" or "no"
dnl $7: ACTION-IF-FOUND
dnl $8: ACTION-IF-NOT-FOUND
dnl )
dnl
AC_DEFUN(OPP_CHECK_AND_RUN_LIB,[
save_CXXFLAGS=$CXXFLAGS
save_LIBS=$LIBS
CXXFLAGS="$4"
LIBS="$5"
AC_MSG_CHECKING(for $1 with CFLAGS="$4" LIBS="$5")
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[#include <$2>]], [[$3;]])],
[AC_MSG_RESULT(yes); $6=yes; $7],
[AC_MSG_RESULT(no); $6=no; $8])
CXXFLAGS=$save_CXXFLAGS
LIBS=$save_LIBS
])
dnl
dnl OPP_CHECK_LIB_NOLINK( -- macro to check availability of a library
dnl $1: LIBRARY-NAME, -- descriptive name (only for printout)
dnl $2: HEADER, -- optional: header file to #include
dnl $3: FUNCTION, -- optional: function WITH ARG LIST, e.g. floor(0.5)
dnl $4: CFLAGS, -- optional: compiler flags
dnl $5: RESULT-VAR -- will contain "yes" or "no"
dnl $6: ACTION-IF-FOUND
dnl $7: ACTION-IF-NOT-FOUND
dnl )
dnl
AC_DEFUN(OPP_CHECK_LIB_NOLINK,[
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$4"
AC_MSG_CHECKING(for $1 with CFLAGS="$4")
AC_TRY_COMPILE(
[#include <$2>], [$3;],
[AC_MSG_RESULT(yes); $5=yes; $6],
[AC_MSG_RESULT(no); $5=no; $7])
CXXFLAGS=$save_CXXFLAGS
])
# usage: AC_PROG_CXX_OPTION(--compiler-option, if-supported, if-unsupported)
AC_DEFUN([AC_PROG_CXX_OPTION], [
AC_MSG_CHECKING([whether $CXX supports $1])
ac_save_CXX="$CXX"
CXX="$CXX $1"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],[
AC_MSG_RESULT([yes])
CXX="$ac_save_CXX"
$2
], [
AC_MSG_RESULT([no])
CXX="$ac_save_CXX"
$3
])
])
#
# Autoconf initialization
#
AC_INIT
AC_CONFIG_SRCDIR(include/omnetpp.h)
AC_LANG(C++)
AC_CONFIG_AUX_DIR(src/utils)
AC_CANONICAL_HOST()
#
# OMNeT++/OMNEST version number
#
OMNETPP_PRODUCT="OMNeT++"
OMNETPP_RELEASE=`cat Version`
OMNETPP_VERSION=`cat Version | sed 's/^.*-//'`
OMNETPP_BUILDID="140714-c6b1772"
#
# Edition identifier in banner: Academic / Commercial / Evaluation
OMNETPP_EDITION="Academic Public License -- NOT FOR COMMERCIAL USE"
# We'll collect in this variable the components we've detected problems with
OPP_PROBLEM_PACKAGES=
#
# Location of various components. They are defined here so that they can be overridden in configure.user.
#
# determine OMNETPP_ROOT; note that 'case' branches on *build* platform not the host platform
case $build in
*-*-cygwin*)
OMNETPP_ROOT=`cygpath -w $OMNETPP_ROOT | sed 's|\\\\|/|g'`
;;
*-*-mingw32*)
OMNETPP_ROOT=`pwd -W`
;;
*)
OMNETPP_ROOT=`pwd`
;;
esac
OMNETPP_SRC_DIR="$OMNETPP_ROOT/src"
OMNETPP_UI_DIR="$OMNETPP_ROOT/ui"
OMNETPP_UTILS_DIR="$OMNETPP_SRC_DIR/utils"
OMNETPP_DOC_DIR="$OMNETPP_ROOT/doc"
OMNETPP_SAMPLES_DIR="$OMNETPP_ROOT/samples"
OMNETPP_TEST_DIR="$OMNETPP_ROOT/test"
OMNETPP_IMAGE_PATH="./bitmaps;./images;$OMNETPP_ROOT/images"
OMNETPP_BIN_DIR="$OMNETPP_ROOT/bin"
OMNETPP_INCL_DIR="$OMNETPP_ROOT/include"
OMNETPP_OUT_DIR="$OMNETPP_ROOT/out"
OMNETPP_LIB_DIR="$OMNETPP_ROOT/lib"
OMNETPP_TKENV_DIR="$OMNETPP_SRC_DIR/tkenv"
if test "$cygwin" = yes; then
MYPWD="$OMNETPP_SRC_DIR/utils/cygpwd"
else
MYPWD="pwd"
fi
#----------------------
# Read user settings (and allow override the above settings)
#----------------------
AC_MSG_NOTICE(-----------------------------------------------)
AC_MSG_NOTICE(reading configure.user for your custom settings)
AC_MSG_NOTICE(-----------------------------------------------)
. ./configure.user
#
# set default library suffixes. May be already defined
# with system/arch specific values
#
A_LIB_SUFFIX=${A_LIB_SUFFIX:-".a"}
SO_LIB_SUFFIX=${SO_LIB_SUFFIX:-".so"}
DLL_LIB_SUFFIX=${DLL_LIB_SUFFIX:-".dll"}
EXE_SUFFIX=
SHARED_LIB_SUFFIX='$(SO_LIB_SUFFIX)'
LIB_PREFIX="lib"
#
# Figure out the host platform
#
if test "$TOOLCHAIN" = "mingw"; then
# cross compiling for mingw
mingw=yes
jni_platform=win32
PLATFORM=win32.x86
EXE_SUFFIX=".exe"
SHARED_LIB_SUFFIX='$(DLL_LIB_SUFFIX)'
LDFLAGS_ARCH="$LDFLAGS_ARCH -Wl,--enable-auto-import -shared-libgcc"
else
jni_platform=$host_os
case $host in
*-*-cygwin*)
cygwin=yes
jni_platform=win32
PLATFORM=win32.x86
EXE_SUFFIX=".exe"
SHARED_LIB_SUFFIX='$(DLL_LIB_SUFFIX)'
# on NT, set total stack size
LDFLAGS_ARCH="$LDFLAGS_ARCH -Xlinker --stack -Xlinker $CYGWIN_STACKSIZE"
;;
*-*-mingw32*)
mingw=yes
jni_platform=win32
PLATFORM=win32.x86
EXE_SUFFIX=".exe"
SHARED_LIB_SUFFIX='$(DLL_LIB_SUFFIX)'
# on MinGW dll auto importing MUST be used with shared gcc and stdc++
# otherwise exceptions can't be thrown across dll boundaries
LDFLAGS_ARCH="$LDFLAGS_ARCH -Wl,--enable-auto-import -shared-libgcc -L/usr/bin"
# If we are building on windows (native compile) we have to add the /usr/lib and
# /usr/include directories as they are not added by default, but they are needed
# to properly find the Tcl/Tk, LibXML2 libraries.
if test "$cross_compiling" = no ; then
CFLAGS_ARCH="$CFLAGS_ARCH -I/usr/include"
LDFLAGS_ARCH="$LDFLAGS_ARCH -L/usr/lib"
fi
# NOTE: if we are cross-compiling we may need to add the lib and include path
# to the cross-compiled TckTk/Xml libs here. They should NOT reside in the default
# /usr/lib directory as that would interfere with the native build.
;;
x86_64-*-linux*)
jni_platform=linux
PLATFORM=linux.x86_64
;;
*-linux*)
# add long file support on 32 bit linux
CFLAGS_ARCH="$CFLAGS_ARCH -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
jni_platform=linux
PLATFORM=linux.x86
;;
*darwin*)
jni_platform=
PLATFORM=macosx
SO_LIB_SUFFIX=".dylib"
JNI_LIB_SUFFIX=".jnilib"
;;
*)
;;
esac
fi
JNI_LIB_SUFFIX=${JNI_LIB_SUFFIX:-$SHARED_LIB_SUFFIX}
# total stack size on NT defaults to 128MB (will be added to LDFLAGS later):
CYGWIN_STACKSIZE=${CYGWIN_STACKSIZE:-134217728}
# Build shared library by default
SHARED_LIBS=${SHARED_LIBS:-yes}
# No SystemC support by default
SYSTEMC=${SYSTEMC:-no}
#----------------------
# Default flags for values for other variables that come from configure.user.
#----------------------
#----------------------
# Set variables to defaults if not already set.
# Note: ${VAR:-defaultvalue} used below appears to be a POSIX syntax.
#----------------------
CFLAGS_DEBUG=${CFLAGS_DEBUG:- -g -Wall}
CFLAGS_RELEASE=${CFLAGS_RELEASE:- -O2 -DNDEBUG=1}
CXXFLAGS=${CXXFLAGS:-}
PREFER_CLANG=${PREFER_CLANG:-}
USE_CPP11=${USE_CPP11:-}
WHOLE_ARCHIVE_ON=
WHOLE_ARCHIVE_OFF=
MSGC=${MSGC:-opp_msgc}
NEDTOOL=${NEDTOOL:-nedtool}
MAKEDEPEND=${MAKEDEPEND:-opp_makedep -Y --objdirtree}
LN=${LN:-ln -sf}
MKPATH=${MKPATH:-mkdir -p}
SHLIB_POSTPROCESS=${SHLIB_POSTPROCESS:-opp_shlib_postprocess}
#----------------------
# Check compiler
#----------------------
if test "$TOOLCHAIN" = "mingw"; then
cc_candidates="i586-mingw32msvc-gcc"
cxx_candidates="i586-mingw32msvc-g++"
else
# icc, icpc: Intel compiler (further ones: Sun Studio: cxx, IBM: xlC)
cc_candidates="icc gcc clang cc xlc"
cxx_candidates="icpc g++ clang++ c++ cxx xlC"
if test "$PREFER_CLANG" = "yes"; then
# if we prefer clang over gcc put it at the beginning so it will be detected first
cc_candidates="clang $cc_candidates"
cxx_candidates="clang++ $cxx_candidates"
fi
fi
# the below macros should be present only ONCE in the whole file (otherwise bad things will happen)
AC_PROG_CC($cc_candidates)
AC_PROG_CXX($cxx_candidates)
AC_CHECK_PROG(tmp_CXX, $CXX, $CXX, not found)
if test "$tmp_CXX" = "not found"; then
OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES g++"
AC_MSG_ERROR([No C++ compiler found -- one is required to build OMNeT++/OMNEST, and also for model development.])
fi
if test "$TOOLCHAIN" = "mingw"; then
AS=${AS:-i586-mingw32msvc-as}
AR=${AR:-i586-mingw32msvc-ar cr}
SHLIB_LD=${SHLIB_LD:-$CXX -shared}
DLLTOOL=${DLLTOOL:-i586-mingw32msvc-dlltool}
STRIP=${STRIP:-i586-mingw32msvc-strip}
RANLIB=${RANLIB:-i586-mingw32msvc-ranlib}
else
if test "$CXX" = "icpc"; then
# disable useless warnings and 'remarks' with the Intel compiler:
#
# warning #654: overloaded virtual function "NEDElement::setAttribute" is only partially overridden
# warning #177: label "yyerrlab1" was declared but never referenced
# remark #869: parameter "node" was never referenced
# remark #981: operands are evaluated in unspecified order
# remark #279: controlling expression is constant (occurs in unfinished cppmsggenerator.cc code)
# remark #1572: floating-point equality and inequality comparisons are unreliable
# remark #424: extra ";" ignored
# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability..
# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability..
# remark #810: conversion from "unsigned int" to "char" may lose significant bits
# remark #810: conversion from "long" to "double" may lose significant bits
# remark #1418: external definition with no prior declaration
# remark #1419: external declaration in primary source file
# remark #383: value copied to temporary, reference to temporary used
#
#CFLAGS="$CFLAGS -wd654 -wd177 -wd869 -wd981 -wd279 -wd1572 -wd424 -wd1682 -wd1683 -wd810 -wd1418 -wd1419"
# -w1 disables all remarks
CFLAGS_ARCH="$CFLAGS_ARCH -w1 -wd654 -wd177"
fi
AS=${AS:-${ac_tool_prefix}as}
AR=${AR:-${ac_tool_prefix}ar cr}
if test "$PLATFORM" = "macosx"; then
SHLIB_LD=${SHLIB_LD:-$CXX -dynamiclib}
else
SHLIB_LD=${SHLIB_LD:-$CXX -shared}
fi
DLLTOOL=${DLLTOOL:-${ac_tool_prefix}dlltool}
STRIP=${STRIP:-${ac_tool_prefix}strip}
AC_PROG_RANLIB
fi
# determine toolchain name, used in opp_makemake-generated Makefiles as part of the linker path
if test "$TOOLCHAIN_NAME" = ""; then
if test "$mingw" = yes; then
TOOLCHAIN_NAME="gcc"
elif test "$cygwin" = yes; then
TOOLCHAIN_NAME="cygwin"
else
# toolchain name: compiler ($CC) without path
# note: doubling the brackets is needed, otherwise M4 swallows them!
TOOLCHAIN_NAME=`echo $CC | sed 's!^.*/!!g' | sed 's![[ :]]!_!'g`
fi
fi
#----------------------
# check whether the compiler supports the C++11 standard (gcc specific options)
# turned off for now, but should be enabled for OMNeT++ 5.0
#----------------------
if test "$USE_CPP11" = "yes"; then
AC_PROG_CXX_OPTION(-std=c++11 -Wno-deprecated-register, CXXFLAGS="$CXXFLAGS -std=c++11 -Wno-deprecated-register")
fi
#----------------------
# check and disable stack checking to avoid opplibs.so dependence on glibc 2.4
#----------------------
AC_PROG_CXX_OPTION(-fno-stack-protector, CFLAGS_ARCH="$CFLAGS_ARCH -fno-stack-protector")
#----------------------
# check for support of --no-as-needed linker option. GCC 4.6 has changed not to link with a shared lib
# if the program does not reference a symbol from the lib.
#----------------------
AS_NEEDED_OFF=-Wl,--no-as-needed
AC_PROG_CXX_OPTION($AS_NEEDED_OFF, ,AS_NEEDED_OFF="")
AS_NEEDED_ON=-Wl,--as-needed
AC_PROG_CXX_OPTION($AS_NEEDED_ON, ,AS_NEEDED_ON="")
#----------------------
# check if swapcontext() call is available (used for coroutines)
# NOTE: we should explicitly exclude MAC OS because AC_CHECK_FUNC reports that swapcontext()
# is present, but it is uninmplemented (and deprecated) on OS X 10.6 and later. We use the
# original 'portable' implementation on MAC.
#----------------------
if test "$PLATFORM" != "macosx"; then
AC_CHECK_FUNCS(swapcontext, [CFLAGS_ARCH="$CFLAGS_ARCH -DHAVE_SWAPCONTEXT"])
fi
#----------------------
# Test if "-fPIC" is needed for shared libs (there's a performance penalty if we use it unnecessarily)
#----------------------
# To test, we try to compile the following code into a shared library:
# int x;
# int getX() {return x;}
#
AC_MSG_CHECKING(if shared libs need -fPIC)
echo 'int x;' >conftest.cc
echo 'int getX() {return x;}' >>conftest.cc
fpic="x"
if echo $CFLAGS_DEBUG | grep -i -- "-fPIC" >/dev/null 2>/dev/null; then
if echo $CFLAGS_RELEASE | grep -i -- "-fPIC" >/dev/null 2>/dev/null; then
AC_MSG_RESULT([skip (already in CFLAGS)])
fpic=""
PIC_FLAGS=-fPIC
fi
fi
if test "$fpic" = "x" && \
$CXX -c conftest.cc >/dev/null 2>/dev/null && \
$SHLIB_LD -o conftest.so conftest.o >/dev/null 2>/dev/null; \
then
AC_MSG_RESULT(no)
fpic=""
fi
if test "$fpic" = "x" && \
$CXX -fPIC -c conftest.cc >/dev/null 2>/dev/null && \
$SHLIB_LD -fPIC -o conftest.so conftest.o >/dev/null 2>/dev/null; \
then
AC_MSG_RESULT(yes)
fpic="-fPIC"
fi
if test "$fpic" = "x" && \
$CXX -fpic -c conftest.cc >/dev/null 2>/dev/null && \
$SHLIB_LD -fpic -o conftest.so conftest.o >/dev/null 2>/dev/null; \
then
AC_MSG_RESULT(-fpic)
fpic="-fpic"
fi
if test "$fpic" = "x"; then
AC_MSG_RESULT(failure)
AC_MSG_WARN([COULD NOT FIGURE OUT HOW TO BUILD SHARED LIBRARY -- reverting to static libs])
SHARED_LIBS="no"
else
CFLAGS_DEBUG="$CFLAGS_DEBUG $fpic"
CFLAGS_RELEASE="$CFLAGS_RELEASE $fpic"
SHLIB_LD="$SHLIB_LD $fpic"
PIC_FLAGS="$fpic"
fi
rm -f conftest.*
#----------------------
# Test if --export-dynamic or -E linker option is accepted and/or needed
#----------------------
# We want to be able to dynamically load extensions into simulation executables,
# so we need to ensure that all symbols in the executable are visible to
# dynamically loaded libraries. However, not all linkers need or support
# --export-dynamic.
# Strategy: we'll compile the following program into a shared library:
# void function_from_main();
# void some_func() {func_from_main();}
# Then we *independently* compile with the following program:
# #include <dlfcn.h>
# void func_from_main() {}
# int main() {return dlopen("libconftest_a.so",RTLD_NOW)==0;}
# And we expect to be able to run the program successfully.
#
# first check if we need "-ldl" for dlopen() [Laura Marie Feeney suggests it's not needed for FreeBSD]
OPP_CHECK_LIB(dlopen, dlfcn.h, dlopen("",0), , , ldl_not_needed, ldl="", ldl="-ldl")
# then go ahead
AC_MSG_CHECKING(if --export-dynamic linker option is supported/needed)
echo 'void func_from_main();' >conftest_a.cc
echo 'void some_func() {func_from_main();}' >>conftest_a.cc
echo '#include <dlfcn.h>' >conftest_m.cc
echo '#include <stdio.h>' >>conftest_m.cc
echo 'void func_from_main() {}' >>conftest_m.cc
echo 'int main() {if (dlopen("./libconftest_a.so",RTLD_NOW)!=0) return 0; printf("%s",dlerror()); return 1;}' >>conftest_m.cc
if $CXX -c conftest_a.cc >/dev/null 2>/dev/null && \
$CXX -c conftest_m.cc >/dev/null 2>/dev/null && \
$SHLIB_LD -o libconftest_a.so conftest_a.o >/dev/null 2>/dev/null; \
then
silly_ok="no"
# 1st try.
if $CXX -o conftest conftest_m.o $ldl >/dev/null 2>/dev/null; then
if ./conftest >/dev/null 2>/dev/null; then
AC_MSG_RESULT(not needed)
silly_ok="yes"
fi
fi
# 2nd try.
if test $silly_ok = "no" && \
$CXX -o conftest -Wl,--export-dynamic conftest_m.o $ldl >/dev/null 2>/dev/null; \
then
if ./conftest >/dev/null 2>/dev/null; then
AC_MSG_RESULT(both)
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
silly_ok="yes"
fi
fi
# no solution found
if test $silly_ok = "no"; then
AC_MSG_RESULT(no solution found)
AC_MSG_WARN([No way was detected to export symbols from executables to shared])
AC_MSG_WARN([libraries. You probably will not be able to dynamically load])
AC_MSG_WARN([simple modules or other extensions written in C++ into simulation])
AC_MSG_WARN([programs like INET.])
fi
else
# note: expected failure on MinGW, because there's no dlopen().
# fixing this would mean overturning and re-testing the whole configure script
AC_MSG_RESULT(test failed)
fi
rm -f conftest_a.* conftest_m.* libconftest_a.so conftest
#----------------------
# Test for "-z allextract" (Sun) or "--whole-archive" (GNU) linker option,
#----------------------
# Goal: to eliminate "silly linker problem", that is, to convince the linker
# to include constructors of static C++ objects in statically linked libraries.
# To test, we'll compile the following code into a static library:
# #include <stdio.h>
# class A { public: A() {printf("=WORKS=");} };
# static A a;
# Then we link it with the following program:
# int main() {return 0;}
# And check if the executable prints '=WORKS=' when run.
#
AC_MSG_CHECKING(for flags needed to link with static libs containing simple modules)
echo '#include <stdio.h>' >conftest_a.cc
# NOTE: do not write "=WORKS=\n" because sh on OS X resolves it
echo 'class A { public: A() {printf("=WORKS=");} };' >>conftest_a.cc
echo 'static A a;' >> conftest_a.cc
echo 'int main() {return 0;}' >> conftest_m.cc
if $CXX -c conftest_a.cc >/dev/null 2>/dev/null && \
$CXX -c conftest_m.cc >/dev/null 2>/dev/null && \
$AR libconftest_a.a conftest_a.o >/dev/null 2>/dev/null && \
$RANLIB libconftest_a.a >/dev/null 2>/dev/null; \
then
silly_ok="no"
# 1st try.
if $CXX -o conftest conftest_m.o libconftest_a.a >/dev/null 2>/dev/null; then
if ./conftest 2>/dev/null | grep '=WORKS=' >/dev/null; then
AC_MSG_RESULT(none)
silly_ok="yes"
fi
fi
# 2nd try.
silly1=-Wl,--whole-archive
silly2=-Wl,--no-whole-archive
if test $silly_ok = "no" && \
$CXX -o conftest conftest_m.o $silly1 libconftest_a.a $silly2 >/dev/null 2>/dev/null && \
./conftest 2>/dev/null | grep '=WORKS=' >/dev/null; \
then
AC_MSG_RESULT(--whole-archive)
AC_MSG_NOTICE([NOTE: Use the following syntax when linking with static libraries])
AC_MSG_NOTICE([containing simple modules and other dynamically registered components:])
AC_MSG_NOTICE([ $CXX ... $silly1 <libs> $silly2 ...])
silly_ok="yes"
WHOLE_ARCHIVE_ON=$silly1
WHOLE_ARCHIVE_OFF=$silly2
fi
# 3rd try.
silly1=-Wl,-z,allextract
silly2=-Wl,-z,defaultextract
if test $silly_ok = "no" && \
$CXX -o conftest conftest_m.o $silly1 libconftest_a.a $silly2 >/dev/null 2>/dev/null && \
./conftest 2>/dev/null | grep '=WORKS=' >/dev/null; \
then
AC_MSG_RESULT([-z,allextract])
AC_MSG_NOTICE([NOTE: Use the following syntax when linking with static libraries])
AC_MSG_NOTICE([containing simple modules and other dynamically registered components:])
AC_MSG_NOTICE([ $CXX ... $silly1 <libs> $silly2 ...])
silly_ok="yes"
WHOLE_ARCHIVE_ON=$silly1
WHOLE_ARCHIVE_OFF=$silly2
fi
# 4th try.
silly1=-Wl,-all_load
silly2=
if test $silly_ok = "no" && \
$CXX -o conftest conftest_m.o $silly1 libconftest_a.a $silly2 >/dev/null 2>/dev/null && \
./conftest 2>/dev/null | grep '=WORKS=' >/dev/null; \
then
AC_MSG_RESULT([-all_load])
AC_MSG_NOTICE([NOTE: Use the following syntax when linking with static libraries])
AC_MSG_NOTICE([containing simple modules and other dynamically registered components:])
AC_MSG_NOTICE([ $CXX ... $silly1 <libs> $silly2 ...])
silly_ok="yes"
WHOLE_ARCHIVE_ON=$silly1
WHOLE_ARCHIVE_OFF=$silly2
fi
# no solution found
if test $silly_ok = "no"; then
AC_MSG_RESULT(no solution found)
AC_MSG_WARN([Avoid linking with static libraries containing simple modules])
AC_MSG_WARN([and other dynamically registered components. Those components])
AC_MSG_WARN([will not be found by the simulation program, because the linker])
AC_MSG_WARN([leaves them out from the executable.])
fi
else
AC_MSG_RESULT(test failed)
fi
rm -f conftest_a.* conftest_m.* libconftest_a.a conftest
#----------------------
# Check Cygwin
#----------------------
if test "$WITH_PARSIM" = "yes" -a "$cygwin" = "yes"; then
AC_MSG_ERROR([WITH_PARSIM=yes not supported with Cygwin -- please edit configure.user!])
fi
#----------------------
# set arch specific flags
#----------------------
CFLAGS_DEBUG="$CFLAGS_DEBUG $CFLAGS_ARCH"
CFLAGS_RELEASE="$CFLAGS_RELEASE $CFLAGS_ARCH"
LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
#----------------------
# Check for rpath
#----------------------
# add RUNTIME_PATH option if supported, so that setting LD_LIBRARY_PATH is no longer needed when using shared libs.
# Also, we add "." to rpath so that opp_run -L option does not need full path of the library
AC_MSG_CHECKING(whether linker supports -rpath)
LDFLAGS_SAVE="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,-rpath,\$(OMNETPP_LIB_DIR) -Wl,-rpath,."
AC_LINK_IFELSE(
[AC_LANG_PROGRAM()],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); RPATH_UNSUPPORTED="true"; LDFLAGS="$LDFLAGS_SAVE"])
#----------------------
# Checks for programs.
#----------------------
AC_PROG_YACC
if test "$YACC" = "yacc"; then
AC_MSG_ERROR([Bison not found, needed to build OMNeT++/OMNEST -- please install it!])
fi
BISON_VER_LINE=`$YACC --version | grep "bison.* [[234]]\\."`
if test -z "$BISON_VER_LINE"; then
AC_MSG_ERROR([At least bison version 2.0 required -- type '$YACC --version' to see the version number])
fi
AC_PROG_LEX
if test "$LEX" != "flex"; then
AC_MSG_ERROR([Flex not found, needed to build OMNeT++/OMNEST -- please install it!])
fi
FLEX_VER_LINE=`$LEX --version | grep "flex.* 2\\.[[5-9]]"`
if test -z "$FLEX_VER_LINE"; then
AC_MSG_ERROR([At least flex version 2.5 required -- type '$LEX --version' to see the version number])
fi
# make must be GNU make
AC_CHECK_PROG(MAKE, make , make, not found)
if test "$MAKE" = "not found"; then
OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES make"
AC_MSG_ERROR(make program not found -- it is required to build OMNeT++/OMNEST, and also for model development.)
else
if "$MAKE" --version 2>/dev/null | grep -i GNU >/dev/null; then :; else
AC_MSG_ERROR(GNU Make is required to build OMNeT++/OMNEST.)
fi
fi
# perl is needed for opp_msgc
AC_ARG_VAR(PERL, The Perl interpreter)
AC_CHECK_PROG(PERL, perl, perl, not found)
if test "$PERL" = "not found"; then
OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES perl"
AC_MSG_WARN(Perl not found -- please install it! Perl is required by opp_msgc, opp_makemake and other features.)
fi
if test ! -x /usr/bin/perl; then
this_perl=`which perl`
AC_MSG_ERROR(Perl MUST be available as /usr/bin/perl. Creating a soft link should help: ln -s $this_perl /usr/bin/perl)
fi
# swig is used for building the ui support libs
AC_ARG_VAR(SWIG, The Swig interface generator)
AC_CHECK_PROG(SWIG, swig, swig, not found)
#----------------------
# Checks for standard libraries.
#----------------------
SYS_LIBS=""
# math functions
OPP_CHECK_LIB(math, math.h, floor(0), , , math_ok)
if test $math_ok = no; then
OPP_CHECK_LIB(math, math.h, floor(0), , -lm, math_ok, SYS_LIBS="-lm $SYS_LIBS")
fi
if test $math_ok = no; then
AC_MSG_ERROR([Standard C math library -lm not found])
fi
# Check for standard C++ library
OPP_CHECK_LIB(standard C++ lib, iostream, /**/, , -lstdc++, stdcpp_ok, SYS_LIBS="-lstdc++ $SYS_LIBS")
# standard C++ library for clang on Mac
if test $stdcpp_ok = no; then
OPP_CHECK_LIB(standard C++ lib, iostream, /**/, , -lc++, stdcpp_ok, SYS_LIBS="-lc++ $SYS_LIBS")
fi
# standard C++ library for the intel compiler
if test $stdcpp_ok = no; then
OPP_CHECK_LIB(standard C++ lib, iostream, /**/, , -lcxa, stdcpp_ok, SYS_LIBS="-lcxa $SYS_LIBS")
fi
if test $stdcpp_ok = no; then
AC_MSG_ERROR([Standard C++ library -lstdc++_s or -lstdc++ or -lcxx or -lcxa or -lc++ not found])
fi
# dlopen()
OPP_CHECK_LIB(dlopen, dlfcn.h, dlopen("",0), , , dl_ok)
if test $dl_ok = no; then
OPP_CHECK_LIB(dlopen, dlfcn.h, dlopen("",0), , -ldl, dl_ok, SYS_LIBS="-ldl $SYS_LIBS")
fi
if test $dl_ok = yes; then
HAVE_DLOPEN=1
else
HAVE_DLOPEN=0
AC_MSG_WARN([no dlopen(): dynamic loading of libs not possible])
fi
# winsock (for MinGW)
OPP_CHECK_LIB(winsock, winsock.h, socket(0,0,0), , -lwsock32, wsock_ok, SYS_LIBS="-lwsock32 $SYS_LIBS")
#----------------------
# Check for Tcl/Tk.
#----------------------
if test -n "$NO_TCL"; then
# skip testing for TCL
TKENV_IF_POSSIBLE=missing-dependency
# and build samples using Cmdenv (TBD)
ALL_ENV_LIBS='$(CMDENV_LIBS)'
else
if test -d /usr/include/tcl8.6; then
TK_CFLAGS86=${TK_CFLAGS:-"-I/usr/include/tcl8.6"}
fi
if test -d /usr/include/tcl8.5; then
TK_CFLAGS85=${TK_CFLAGS:-"-I/usr/include/tcl8.5"}
fi
if test -n "$TK_LIBS"; then
OPP_CHECK_LIB(Tcl/Tk, tk.h, Tk_MainLoop(), $TK_CFLAGS, $TK_LIBS, tcltk_ok)
else
# try to use tcl/tk without X (e.g. on Mac OS X native aqua Tcl/Tk impl)
OPP_CHECK_LIB(Tcl/Tk 8.6, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $TK_CFLAGS86, -ltk8.6 -ltcl8.6,
tcltk_ok, TK_LIBS="-ltk8.6 -ltcl8.6" TK_CFLAGS=$TK_CFLAGS86)
if test $tcltk_ok = no; then
OPP_CHECK_LIB(Tcl/Tk 8.5, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $TK_CFLAGS85, -ltk8.5 -ltcl8.5,
tcltk_ok, TK_LIBS="-ltk8.5 -ltcl8.5" TK_CFLAGS=$TK_CFLAGS85)
fi
# look for X window libs and headers
if test $tcltk_ok = no; then
# try to find Tcl/Tk ourselves, but it usually needs to link with Xlib
AC_PATH_X
if test "$no_x" = "yes"; then
opp_x11inc=
opp_x11lib=
else
if test -n "$x_includes"; then
opp_x11inc="-I$x_includes"
fi
if test -n "$x_libraries"; then
opp_x11lib="-L$x_libraries -lX11"
fi
fi
fi
if test $tcltk_ok = no; then
OPP_CHECK_LIB(Tcl/Tk 8.6, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS86, $opp_x11lib -ltk86 -ltcl86,
tcltk_ok, TK_LIBS="$opp_x11lib -ltk86 -ltcl86" TK_CFLAGS="$opp_x11inc $TK_CFLAGS86")
fi
if test $tcltk_ok = no; then
OPP_CHECK_LIB(Tcl/Tk 8.6, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS86, $opp_x11lib -ltk8.6 -ltcl8.6,
tcltk_ok, TK_LIBS="$opp_x11lib -ltk8.6 -ltcl8.6" TK_CFLAGS="$opp_x11inc $TK_CFLAGS86")
fi
if test $tcltk_ok = no -a "$cygwin" = yes; then
OPP_CHECK_LIB(Tcl/Tk 8.6, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS86, $opp_x11lib -lcygtk86 -lcygtcl86,
tcltk_ok, TK_LIBS="$opp_x11lib -lcygtk86 -lcygtcl86" TK_CFLAGS="$opp_x11inc $TK_CFLAGS86")
fi
# check for 8.5
if test $tcltk_ok = no; then
OPP_CHECK_LIB(Tcl/Tk 8.5, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS85, $opp_x11lib -ltk85 -ltcl85,
tcltk_ok, TK_LIBS="$opp_x11lib -ltk85 -ltcl85" TK_CFLAGS="$opp_x11inc $TK_CFLAGS85")
fi
if test $tcltk_ok = no; then
OPP_CHECK_LIB(Tcl/Tk 8.5, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS85, $opp_x11lib -ltk8.5 -ltcl8.5,
tcltk_ok, TK_LIBS="$opp_x11lib -ltk8.5 -ltcl8.5" TK_CFLAGS="$opp_x11inc $TK_CFLAGS85")
fi
if test $tcltk_ok = no -a "$cygwin" = yes; then
OPP_CHECK_LIB(Tcl/Tk 8.5, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS85, $opp_x11lib -lcygtk85 -lcygtcl85,
tcltk_ok, TK_LIBS="$opp_x11lib -lcygtk85 -lcygtcl85" TK_CFLAGS="$opp_x11inc $TK_CFLAGS85")
fi
fi
if test $tcltk_ok = no; then
# try to give a hint in the error message about the problem
if test "$no_x" = "yes"; then
if test "$cygwin" = yes; then
AC_MSG_ERROR([Cannot build Tcl/Tk apps, probably due to missing X11 headers -- try installing the XFree86 packages.])
else
AC_MSG_ERROR([Cannot build Tcl/Tk apps, probably due to misconfigured or missing X11 headers or libs. Check config.log for more info!])
fi
else
AC_MSG_ERROR([Tcl/Tk not found, needed for all GUI parts. Version 8.4.0+ and devel package required. Check config.log for more info!])
fi
fi
# Check for wish.
AC_CHECK_PROGS(WISH, $WISH wish wish86 wish8.6 wish85 wish8.5 cygwish cygwish86 cygwish85, nope)
if test "$WISH" = nope; then
AC_MSG_ERROR([Cannot find wish, part of Tcl/Tk -- maybe it is not in the PATH or has some exotic name (tested names were: wish wish86 wish8.6 wish85 wish8.5 wish84 wish8.4 cygwish cygwish86 cygwish85 cygwish84)])
fi
if echo 'puts OK; exit' | $WISH | grep OK >/dev/null; then :; else
AC_MSG_ERROR([Cannot run wish (wish command "puts OK; exit" failed): maybe you are not running X or DISPLAY environment variable not set?])
fi
if echo 'catch {package require Tk 8.4; puts OK}; exit' | $WISH | grep OK >/dev/null; then :; else
AC_MSG_ERROR([wish command "package require Tk 8.4" failed: probably old Tcl/Tk version, version 8.4.0+ required])
fi
# note: square brackets necessary otherwise M4 messes up the Tcl command
[tcl_library=`echo 'puts [info library]; exit' | $WISH`]
# if we got through until here, enable building of the following progs:
TKENV_IF_POSSIBLE=tkenv
# and build samples using Tkenv
ALL_ENV_LIBS='$(TKENV_LIBS) $(CMDENV_LIBS)'
fi # end of Tcl tests ($NO_TCL=="" branch)
#----------------------
# Check for JRE
#----------------------
AC_CHECK_PROGS(JRE, $JRE java, nope)
AC_CHECK_PROGS(PRIVATE_JRE, $PRIVATE_JRE ide/jre/bin/java, nope)
if test "$JRE" = nope -a "$PRIVATE_JRE" = nope; then
OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES JRE (recommended)"
AC_MSG_WARN([Cannot find a suitable Java Runtime Environment - The IDE requires JRE 1.6 or later. Please install it before configuring])
fi
#----------------------
# Check for JDK
#----------------------
if test "$JAVA_CFLAGS" = ""; then
if test "$JDK" = ""; then
javahome_candidates="/usr/lib/jvm/java /usr/lib/jvm/default-java /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-1.6.0-sun /usr/lib/jvm/java-5-sun /usr/lib/jvm/java-1.5.0-sun /usr/java/jdk /Library/Java/Home"
for dir in $javahome_candidates; do
if test "$JAVA_HOME" = "" -a -d "$dir"; then
JAVA_HOME=$dir
fi
done
else
JAVA_HOME=$JDK
fi
if test "$JAVA_HOME" = ""; then
AC_MSG_WARN(JAVA_HOME variable not set.)
else
if test "$PLATFORM" = "macosx"; then
JAVA_CFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers"
JAVA_LIBS=""
else
JAVA_CFLAGS="-fno-strict-aliasing -I$JAVA_HOME/include -I$JAVA_HOME/include/$jni_platform"
JAVA_LIBS="-L$JAVA_HOME/jre/lib/i386/client -Wl,-rpath,$JAVA_HOME/jre/lib/i386/client:. -ljvm"
fi
fi
fi
OPP_CHECK_LIB_NOLINK(JNI, jni.h, JNI_GetCreatedJavaVMs(0,0,0), $CFLAGS_RELEASE $JAVA_CFLAGS, jni_ok)
if test "$jni_ok" = "no" -o "$SWIG" = "not found"; then
JNILIBS_IF_POSSIBLE=missing-dependency
else
JNILIBS_IF_POSSIBLE=jnilibs
fi
#----------------------
# Check for MPI.
#----------------------
if test -n "$MPI_LIBS"; then
OPP_CHECK_LIB(MPI, mpi.h, MPI_Init(0,0), $CFLAGS_RELEASE $MPI_CFLAGS, $LDFLAGS $MPI_LIBS, mpi_ok)
else
mpi_ok=no
# LAM and OpenMPI support mpic++ -showme
# NOTE: on some systems (e.g. RHEL and Fedora), "module load openmpi_i386" or similar command may be additionally needed to make MPI accessible
AC_CHECK_PROG(MPICPP, mpic++, mpic++, not found)
if test "$MPICPP" != "not found"; then
MPI_CFLAGS=`mpic++ -showme:compile`
MPI_LIBS=`mpic++ -showme:link`
OPP_CHECK_LIB(MPI, mpi.h, MPI_Init(0,0), $CFLAGS_RELEASE $MPI_CFLAGS, $LDFLAGS $MPI_LIBS, mpi_ok)
fi
if test $mpi_ok = no; then
# MPICH2 has mpicxx -compile-info and -link-info, slightly broken
# (both print the same string, which includes the compiler name too)
AC_CHECK_PROG(MPICXX, mpicxx, mpicxx, not found)
if test "$MPICXX" != "not found"; then
MPI_CFLAGS=`mpicxx -c -compile-info | sed 's/^[^ ]*//'`
MPI_LIBS=`mpicxx -link-info | sed 's/^[^ ]*//'`
OPP_CHECK_LIB(MPI, mpi.h, MPI_Init(0,0), $CFLAGS_RELEASE $MPI_CFLAGS, $LDFLAGS $MPI_LIBS, mpi_ok)
fi
fi
if test $mpi_ok = no; then
mpilibs="-lmpi" #SGI and mingw (on MinGW modify mpi.h and insert #include <wchar.h> at the top of the file)
OPP_CHECK_LIB(MPI, mpi.h, MPI_Init(0,0), $CFLAGS_RELEASE $MPI_CFLAGS, $LDFLAGS $mpilibs, mpi_ok, MPI_LIBS="$mpilibs")
fi
fi
if test $mpi_ok = yes; then
HAVE_MPI=yes
MPI_CFLAGS="$MPI_CFLAGS -DWITH_MPI"
else
HAVE_MPI=no
OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES MPI (optional)"
AC_MSG_WARN([Optional package MPI (needed for parallel simulation) not found.])
fi
#----------------------
# Check for PCAP.
#----------------------
# Note: on Windows, we need to check beforehand if wpcap.dll exists, because
# otherwise the test program (that links with pcap.lib) brings up a GUI (!)
# error dialog complaining that wpcap.dll was missing
case $host in
*-*-cygwin* | *-*-mingw32*)
# we do not have to test for the DLL if we are cross-compiling because the DLL is obviously not installed
# on the build system (as it is a non-windows architecture).
if test "$cross_compiling" = no ; then
OPP_CHECK_AND_RUN_LIB(WinPCAP, windows.h, return LoadLibrary("wpcap.dll")==NULL ? 1 : 0, $CFLAGS_RELEASE, , wpcap_dll)
else
wpcap_dll=notneeded
fi
;;
*)
wpcap_dll=notneeded
;;
esac
if test $wpcap_dll = "no"; then
pcap_ok=no
AC_MSG_NOTICE([WinPCAP not found -- if you need packet capture functionality in your models, install it from winpcap.org])
else
if test -n "$PCAP_LIBS"; then
OPP_CHECK_LIB(PCAP, pcap.h, pcap_lib_version(), $CFLAGS_RELEASE $PCAP_CFLAGS, $PCAP_LIBS, pcap_ok)
else
PCAP_LIBS="-lpcap"
OPP_CHECK_LIB(PCAP, pcap.h, pcap_lib_version(), $CFLAGS_RELEASE $PCAP_CFLAGS, $PCAP_LIBS, pcap_ok)
fi
fi
if test $pcap_ok = yes; then
HAVE_PCAP=yes
CFLAGS_RELEASE="$CFLAGS_RELEASE $PCAP_CFLAGS -DHAVE_PCAP"
CFLAGS_DEBUG="$CFLAGS_DEBUG $PCAP_CFLAGS -DHAVE_PCAP"
else
HAVE_PCAP=no
PCAP_CFLAGS=""
PCAP_LIBS=""
OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES PCAP (optional)"
fi
#----------------------
# Check for PTHREAD.
# On MinGW, add "-mthread" to PTHREAD_CFLAGS and PTHREAD_LIBS to force using
# the multithreaded standard libraries.
#----------------------
if test -n "$PTHREAD_LIBS"; then
OPP_CHECK_LIB(PTHREAD, pthread.h, pthread_rwlock_rdlock(0), $CFLAGS_RELEASE $PTHREAD_CFLAGS, $PTHREAD_LIBS, pthread_ok)
else
PTHREAD_LIBS="-lpthread"
OPP_CHECK_LIB(PTHREAD, pthread.h, pthread_rwlock_rdlock(0), $CFLAGS_RELEASE $PTHREAD_CFLAGS, $PTHREAD_LIBS, pthread_ok)
fi
if test $pthread_ok = yes; then