Project

General

Profile

Statistics
| Branch: | Revision:

root / configure.in @ aeae20a1

History | View | Annotate | Download (48.8 KB)

1 01873262 Georg Kunz
# NOTE: set UNIVERSAL_BINARIES=yes to build universal binaries on Mac OS X 10.5
2
# NOTE: set TOOLCHAIN=mingw to use the MINGW compiler to cross compile to Windows on Linux
3
4
dnl Process this file with autoconf to produce a configure script.
5
6
dnl
7
dnl OPP_CHECK_LIB(      -- macro to check availability of a library
8
dnl   $1: LIBRARY-NAME, -- descriptive name (only for printout)
9
dnl   $2: HEADER,       -- optional: header file to #include
10
dnl   $3: FUNCTION,     -- optional: function WITH ARG LIST, e.g. floor(0.5)
11
dnl   $4: CFLAGS,       -- optional: compiler flags
12
dnl   $5: LDFLAGS,      -- optional: linker flags
13
dnl   $6: RESULT-VAR    -- will contain "yes" or "no"
14
dnl   $7: ACTION-IF-FOUND
15
dnl   $8: ACTION-IF-NOT-FOUND
16
dnl )
17
dnl
18
AC_DEFUN(OPP_CHECK_LIB,[
19
   save_CXXFLAGS=$CXXFLAGS
20
   save_LIBS=$LIBS
21
22
   CXXFLAGS="$4"
23
   LIBS="$5"
24
25
   AC_MSG_CHECKING(for $1 with CFLAGS="$4" LIBS="$5")
26
27
   AC_LINK_IFELSE(
28
     [AC_LANG_PROGRAM([[#include <$2>]], [[$3;]])],
29
     [AC_MSG_RESULT(yes); $6=yes; $7],
30
     [AC_MSG_RESULT(no); $6=no; $8])
31
32
   CXXFLAGS=$save_CXXFLAGS
33
   LIBS=$save_LIBS
34
])
35
36
dnl
37
dnl Same as OPP_CHECK_LIB(), but also tries to run the program (uses
38
dnl AC_RUN_IFELSE instead of AC_LINK_IFELSE).
39
dnl
40
dnl OPP_CHECK_AND_RUN_LIB(      -- macro to check availability of a library
41
dnl   $1: LIBRARY-NAME, -- descriptive name (only for printout)
42
dnl   $2: HEADER,       -- optional: header file to #include
43
dnl   $3: FUNCTION,     -- optional: function WITH ARG LIST, e.g. floor(0.5)
44
dnl   $4: CFLAGS,       -- optional: compiler flags
45
dnl   $5: LDFLAGS,      -- optional: linker flags
46
dnl   $6: RESULT-VAR    -- will contain "yes" or "no"
47
dnl   $7: ACTION-IF-FOUND
48
dnl   $8: ACTION-IF-NOT-FOUND
49
dnl )
50
dnl
51
AC_DEFUN(OPP_CHECK_AND_RUN_LIB,[
52
   save_CXXFLAGS=$CXXFLAGS
53
   save_LIBS=$LIBS
54
55
   CXXFLAGS="$4"
56
   LIBS="$5"
57
58
   AC_MSG_CHECKING(for $1 with CFLAGS="$4" LIBS="$5")
59
60
   AC_RUN_IFELSE(
61
     [AC_LANG_PROGRAM([[#include <$2>]], [[$3;]])],
62
     [AC_MSG_RESULT(yes); $6=yes; $7],
63
     [AC_MSG_RESULT(no); $6=no; $8])
64
65
   CXXFLAGS=$save_CXXFLAGS
66
   LIBS=$save_LIBS
67
])
68
69
dnl
70
dnl OPP_CHECK_LIB_NOLINK(      -- macro to check availability of a library
71
dnl   $1: LIBRARY-NAME, -- descriptive name (only for printout)
72
dnl   $2: HEADER,       -- optional: header file to #include
73
dnl   $3: FUNCTION,     -- optional: function WITH ARG LIST, e.g. floor(0.5)
74
dnl   $4: CFLAGS,       -- optional: compiler flags
75
dnl   $5: RESULT-VAR    -- will contain "yes" or "no"
76
dnl   $6: ACTION-IF-FOUND
77
dnl   $7: ACTION-IF-NOT-FOUND
78
dnl )
79
dnl
80
AC_DEFUN(OPP_CHECK_LIB_NOLINK,[
81
   save_CXXFLAGS=$CXXFLAGS
82
   CXXFLAGS="$4"
83
84
   AC_MSG_CHECKING(for $1 with CFLAGS="$4")
85
86
   AC_TRY_COMPILE(
87
     [#include <$2>], [$3;],
88
     [AC_MSG_RESULT(yes); $5=yes; $6],
89
     [AC_MSG_RESULT(no); $5=no; $7])
90
91
   CXXFLAGS=$save_CXXFLAGS
92
])
93
94
# usage: AC_PROG_CC_OPTION(--compiler-option, if-supported, if-unsupported)
95
# add this option to $(CC) if it is supported by the compiler
96
# if no sc
97
# Martin Waitz <tali@admingilde.org>
98
AC_DEFUN([AC_PROG_CXX_OPTION], [
99
    AC_MSG_CHECKING([whether $CXX supports $1])
100
    ac_save_CXX="$CXX"
101
    CXX="$CXX $1"
102
    AC_COMPILE_IFELSE(AC_LANG_PROGRAM(),[
103
        AC_MSG_RESULT([yes])
104
        ifelse($2, , [], [
105
        CXX="$ac_save_CXX"
106
        $2])
107
    ], [
108
        AC_MSG_RESULT([no])
109
        CXX="$ac_save_CXX"
110
        $3
111
    ])
112
])
113
114
#
115
# Autoconf initialization
116
#
117
AC_INIT
118
AC_CONFIG_SRCDIR(include/omnetpp.h)
119
AC_LANG(C++)
120
AC_CONFIG_AUX_DIR(src/utils)
121
AC_CANONICAL_HOST()
122
123
#
124
# OMNeT++/OMNEST version number
125
#
126
OMNETPP_PRODUCT="OMNeT++"
127
OMNETPP_RELEASE=`cat Version`
128
OMNETPP_VERSION=`cat Version | sed 's/^.*-//'`
129
OMNETPP_BUILDID="100611-4b63c38"
130
OMNETPP_EDITION="Academic Public License -- NOT FOR COMMERCIAL USE"
131
132
# We'll collect in this variable the components we've detected problems with
133
OPP_PROBLEM_PACKAGES=
134
135
#
136
# Location of various components. They are defined here so that they can be overridden in configure.user.
137
#
138
139
# determine OMNETPP_ROOT; note that 'case' branches on *host* platform not the target platform
140
case $host in
141
*-*-cygwin*)
142
    OMNETPP_ROOT=`cygpath -w $OMNETPP_ROOT | sed 's|\\\\|/|g'`
143
    ;;
144
*-*-mingw32*)
145
    OMNETPP_ROOT=`pwd -W`
146
    ;;
147
*)
148
    OMNETPP_ROOT=`pwd`
149
    ;;
150
esac
151
152
OMNETPP_SRC_DIR="$OMNETPP_ROOT/src"
153
OMNETPP_UI_DIR="$OMNETPP_ROOT/ui"
154
OMNETPP_UTILS_DIR="$OMNETPP_SRC_DIR/utils"
155
OMNETPP_DOC_DIR="$OMNETPP_ROOT/doc"
156
OMNETPP_TEST_DIR="$OMNETPP_ROOT/test"
157
OMNETPP_IMAGE_PATH="./bitmaps;./images;$OMNETPP_ROOT/images"
158
159
OMNETPP_BIN_DIR="$OMNETPP_ROOT/bin"
160
OMNETPP_INCL_DIR="$OMNETPP_ROOT/include"
161
OMNETPP_OUT_DIR="$OMNETPP_ROOT/out"
162
OMNETPP_LIB_DIR="$OMNETPP_ROOT/lib"
163
164
OMNETPP_TKENV_DIR="$OMNETPP_SRC_DIR/tkenv"
165
166
if test "$cygwin" = yes; then
167
    MYPWD="$OMNETPP_SRC_DIR/utils/cygpwd"
168
else
169
    MYPWD="pwd"
170
fi
171
172
#----------------------
173
# Read user settings (and allow override the above settings)
174
#----------------------
175
AC_MSG_NOTICE(-----------------------------------------------)
176
AC_MSG_NOTICE(reading configure.user for your custom settings)
177
AC_MSG_NOTICE(-----------------------------------------------)
178
. ./configure.user
179
180
181
#
182
# set default library suffixes. May be already defined
183
# with system/arch specific values
184
#
185
A_LIB_SUFFIX=${A_LIB_SUFFIX:-".a"}
186
SO_LIB_SUFFIX=${SO_LIB_SUFFIX:-".so"}
187
DLL_LIB_SUFFIX=${DLL_LIB_SUFFIX:-".dll"}
188
EXE_SUFFIX=
189
SHARED_LIB_SUFFIX='$(SO_LIB_SUFFIX)'
190
LIB_PREFIX="lib"
191
192
#
193
#  Figure out target platform
194
#
195
if test "$TOOLCHAIN" = "mingw"; then
196
    # cross compiling for mingw
197
    mingw=yes
198
    jni_platform=win32
199
    PLATFORM=win32.x86
200
    EXE_SUFFIX=".exe"
201
    SHARED_LIB_SUFFIX='$(DLL_LIB_SUFFIX)'
202
    LDFLAGS_ARCH="$LDFLAGS_ARCH -enable-auto-import -shared-libgcc"
203
else
204
    jni_platform=$host_os
205
    case $host in
206
    *-*-cygwin*)
207
        cygwin=yes
208
        jni_platform=win32
209
        PLATFORM=win32.x86
210
        EXE_SUFFIX=".exe"
211
        SHARED_LIB_SUFFIX='$(DLL_LIB_SUFFIX)'
212
        # on NT, set total stack size
213
        LDFLAGS_ARCH="$LDFLAGS_ARCH -Xlinker --stack -Xlinker $CYGWIN_STACKSIZE"
214
        ;;
215
    *-*-mingw32*)
216
        mingw=yes
217
        jni_platform=win32
218
        PLATFORM=win32.x86
219
        EXE_SUFFIX=".exe"
220
        SHARED_LIB_SUFFIX='$(DLL_LIB_SUFFIX)'
221
        # add default include and lib paths to make it similar to gcc on Linux
222
        CFLAGS_ARCH="$CFLAGS_ARCH -I/usr/include"
223
        # on MinGW dll auto importing is used and must be linked with shared gcc and stdc++
224
        # otherwise exceptions cant be thrown across dll boundaries
225
        LDFLAGS_ARCH="$LDFLAGS_ARCH -enable-auto-import -shared-libgcc -L/usr/bin -L/usr/lib"
226
        ;;
227
    x86_64-*-linux*)
228
        jni_platform=linux
229
        PLATFORM=linux.x86_64
230
        ;;
231
    *-linux*)
232
        jni_platform=linux
233
        PLATFORM=linux.x86
234
        ;;
235
    *darwin*)
236
        jni_platform=
237
        PLATFORM=macosx
238
        SO_LIB_SUFFIX=".dylib"
239
        JNI_LIB_SUFFIX=".jnilib"
240
        if test "$UNIVERSAL_BINARIES" = "yes"; then
241
           CFLAGS_ARCH="$CFLAGS_ARCH -arch ppc -arch i386"
242
           LDFLAGS_ARCH="$LDFLAGS_ARCH -arch ppc -arch i386"
243
        fi
244
        # CDT 6.x does not support 64 bit debugging so we force
245
        # the compiler to build 32 bit executable because on OS X 10.6,
246
        # gcc builds 64 bit executables by default. After upgrading to
247
        # CDT 7.0 these lines can be removed.
248
        CFLAGS_ARCH="$CFLAGS_ARCH -m32"
249
        LDFLAGS_ARCH="$LDFLAGS_ARCH -m32"
250
        ;;
251
    *)
252
        ;;
253
    esac
254
fi
255
256
JNI_LIB_SUFFIX=${JNI_LIB_SUFFIX:-$SHARED_LIB_SUFFIX}
257
258
# total stack size on NT defaults to 128MB (will be added to LDFLAGS later):
259
CYGWIN_STACKSIZE=${CYGWIN_STACKSIZE:-134217728}
260
261
# Build shared library by default
262
SHARED_LIBS=${SHARED_LIBS:-yes}
263
264
#----------------------
265
# Default flags for values for other variables that come from configure.user.
266
#----------------------
267
#----------------------
268
# pthread for Horizon
269
#----------------------
270
271
PTHREAD_CFLAGS="-I /usr/include"
272
PTHREAD_LIBS="-lpthread"
273
#----------------------
274
# Set variables to defaults if not already set.
275
# Note: ${VAR:-defaultvalue} used below appears to be a POSIX syntax.
276
#----------------------
277
# on mingw special debug option is needed to debug with gdb.
278
if test "$mingw" = "yes"; then
279
  CFLAGS_DEBUG=${CFLAGS_DEBUG:- -gstabs+ -Wall}
280
else
281
  CFLAGS_DEBUG=${CFLAGS_DEBUG:- -g -Wall}
282
fi
283
284
CFLAGS_RELEASE=${CFLAGS_RELEASE:- -O2 -DNDEBUG=1}
285
286
WHOLE_ARCHIVE_ON=
287
WHOLE_ARCHIVE_OFF=
288
289
MSGC=${MSGC:-opp_msgc}
290
NEDTOOL=${NEDTOOL:-nedtool}
291
MAKEDEPEND=${MAKEDEPEND:-opp_makedep -Y --objdirtree}
292
LN=${LN:-ln -sf}
293
MKPATH=${MKPATH:-mkdir -p}
294
SHLIB_POSTPROCESS=${SHLIB_POSTPROCESS:-opp_shlib_postprocess}
295
296
#----------------------
297
# Check compiler
298
#----------------------
299
300
if test "$TOOLCHAIN" = "mingw"; then
301
    cc_candidates="i586-mingw32msvc-gcc"
302
    cxx_candidates="i586-mingw32msvc-g++"
303
else
304
    # icc, icpc: Intel compiler (further ones: Sun Studio: cxx, IBM: xlC)
305
    cc_candidates="icc gcc cc xlc"
306
    cxx_candidates="icpc g++ c++ cxx xlC"
307
fi
308
309
# the below macros should be present only ONCE in the whole file (otherwise bad things will happen)
310
AC_PROG_CC($cc_candidates)
311
AC_PROG_CXX($cxx_candidates)
312
313
AC_CHECK_PROG(tmp_CXX, $CXX, $CXX, not found)
314
if test "$tmp_CXX" = "not found"; then
315
   OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES g++"
316
   AC_MSG_ERROR([No C++ compiler found -- one is required to build OMNeT++/OMNEST, and also for model development.])
317
fi
318
319
if test "$TOOLCHAIN" = "mingw"; then
320
    AS=${AS:-i586-mingw32msvc-as}
321
    AR=${AR:-i586-mingw32msvc-ar cr}
322
    SHLIB_LD=${SHLIB_LD:-$CXX -shared}
323
    DLLTOOL=${DLLTOOL:-i586-mingw32msvc-dlltool}
324
    STRIP=${STRIP:-i586-mingw32msvc-strip}
325
    RANLIB=${RANLIB:-i586-mingw32msvc-ranlib}
326
else
327
    if test "$CXX" = "icpc"; then
328
        # disable useless warnings and 'remarks' with the Intel compiler:
329
        #
330
        # warning #654: overloaded virtual function "NEDElement::setAttribute" is only partially overridden
331
        # warning #177: label "yyerrlab1" was declared but never referenced
332
        # remark #869: parameter "node" was never referenced
333
        # remark #981: operands are evaluated in unspecified order
334
        # remark #279: controlling expression is constant  (occurs in unfinished cppmsggenerator.cc code)
335
        # remark #1572: floating-point equality and inequality comparisons are unreliable
336
        # remark #424: extra ";" ignored
337
        # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability..
338
        # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability..
339
        # remark #810: conversion from "unsigned int" to "char" may lose significant bits
340
        # remark #810: conversion from "long" to "double" may lose significant bits
341
        # remark #1418: external definition with no prior declaration
342
        # remark #1419: external declaration in primary source file
343
        # remark #383: value copied to temporary, reference to temporary used
344
        #
345
        #CFLAGS="$CFLAGS -wd654 -wd177 -wd869 -wd981 -wd279 -wd1572 -wd424 -wd1682 -wd1683 -wd810 -wd1418 -wd1419"
346
347
        # -w1 disables all remarks
348
        CFLAGS_DEBUG="$CFLAGS_DEBUG -w1 -wd654 -wd177"
349
        CFLAGS_RELEASE="$CFLAGS_RELEASE -w1 -wd654 -wd177"
350
    fi
351
    AS=${AS:-as}
352
    AR=${AR:-ar cr}
353
    if test "$PLATFORM" = "macosx"; then
354
        SHLIB_LD=${SHLIB_LD:-$CXX -dynamiclib}
355
    else
356
        SHLIB_LD=${SHLIB_LD:-$CXX -shared}
357
    fi
358
    DLLTOOL=${DLLTOOL:-dlltool}
359
    STRIP=${STRIP:-strip}
360
    AC_PROG_RANLIB
361
fi
362
363
364
# determine toolchain name, used in opp_makemake-generated Makefiles as part of the linker path
365
if test "$TOOLCHAIN_NAME" = ""; then
366
    if test "$mingw" = yes; then
367
        TOOLCHAIN_NAME="gcc"
368
    elif test "$cygwin" = yes; then
369
        TOOLCHAIN_NAME="cygwin"
370
    else
371
        # toolchain name: compiler ($CC) without path
372
        # note: doubling the brackets is needed, otherwise M4 swallows them!
373
        TOOLCHAIN_NAME=`echo $CC | sed 's!^.*/!!g' | sed 's![[ :]]!_!'g`
374
    fi
375
fi
376
377
#----------------------
378
# check and disable stack checking to avoid opplibs.so dependence on glibc 2.4
379
#----------------------
380
AC_PROG_CXX_OPTION(-fno-stack-protector, CFLAGS_RELEASE="$CFLAGS_RELEASE -fno-stack-protector")
381
AC_PROG_CXX_OPTION(-fno-stack-protector, CFLAGS_DEBUG="$CFLAGS_DEBUG -fno-stack-protector")
382
383
#----------------------
384
# Test if "-fPIC" is needed for shared libs (there's a performance penalty if we use it unnecessarily)
385
#----------------------
386
# To test, we try to compile the following code into a shared library:
387
#      int x;
388
#      int getX() {return x;}
389
#
390
391
AC_MSG_CHECKING(if shared libs need -fPIC)
392
echo 'int x;' >conftest.cc
393
echo 'int getX() {return x;}' >>conftest.cc
394
fpic="x"
395
if echo $CFLAGS_DEBUG | grep -i -- "-fPIC" >/dev/null 2>/dev/null; then
396
   if echo $CFLAGS_RELEASE | grep -i -- "-fPIC" >/dev/null 2>/dev/null; then
397
        AC_MSG_RESULT([skip (already in CFLAGS)])
398
        fpic=""
399
   fi
400
fi
401
if test "$fpic" = "x" && \
402
   $CXX -c conftest.cc >/dev/null 2>/dev/null && \
403
   $SHLIB_LD -o conftest.so conftest.o >/dev/null 2>/dev/null; \
404
then
405
   AC_MSG_RESULT(no)
406
   fpic=""
407
fi
408
if test "$fpic" = "x" && \
409
   $CXX -fPIC -c conftest.cc >/dev/null 2>/dev/null && \
410
   $SHLIB_LD -fPIC -o conftest.so conftest.o >/dev/null 2>/dev/null; \
411
then
412
   AC_MSG_RESULT(yes)
413
   fpic="-fPIC"
414
fi
415
if test "$fpic" = "x" && \
416
   $CXX -fpic -c conftest.cc >/dev/null 2>/dev/null && \
417
   $SHLIB_LD -fpic -o conftest.so conftest.o >/dev/null 2>/dev/null; \
418
then
419
   AC_MSG_RESULT(-fpic)
420
   fpic="-fpic"
421
fi
422
if test "$fpic" = "x"; then
423
   AC_MSG_RESULT(failure)
424
   AC_MSG_WARN([COULD NOT FIGURE OUT HOW TO BUILD SHARED LIBRARY -- reverting to static libs])
425
   SHARED_LIBS="no"
426
else
427
   CFLAGS_DEBUG="$CFLAGS_DEBUG $fpic"
428
   CFLAGS_RELEASE="$CFLAGS_RELEASE $fpic"
429
   SHLIB_LD="$SHLIB_LD $fpic"
430
fi
431
rm -f conftest.*
432
433
434
#----------------------
435
# Test if --export-dynamic or -E linker option is accepted and/or needed
436
#----------------------
437
# We want to be able to dynamically load extensions into simulation executables,
438
# so we need to ensure that all symbols in the executable are visible to
439
# dynamically loaded libraries. However, not all linkers need or support
440
# --export-dynamic.
441
# Strategy: we'll compile the following program into a shared library:
442
#      void function_from_main();
443
#      void some_func() {func_from_main();}
444
# Then we *independently* compile with the following program:
445
#      #include <dlfcn.h>
446
#      void func_from_main() {}
447
#      int main() {return dlopen("libconftest_a.so",RTLD_NOW)==0;}
448
# And we expect to be able to run the program successfully.
449
#
450
451
# first check if we need "-ldl" for dlopen() [Laura Marie Feeney suggests it's not needed for FreeBSD]
452
OPP_CHECK_LIB(dlopen, dlfcn.h, dlopen("",0), , , ldl_not_needed, ldl="", ldl="-ldl")
453
454
# then go ahead
455
AC_MSG_CHECKING(if --export-dynamic linker option is supported/needed)
456
echo 'void func_from_main();' >conftest_a.cc
457
echo 'void some_func() {func_from_main();}' >>conftest_a.cc
458
echo '#include <dlfcn.h>' >conftest_m.cc
459
echo '#include <stdio.h>' >>conftest_m.cc
460
echo 'void func_from_main() {}' >>conftest_m.cc
461
echo 'int main() {if (dlopen("./libconftest_a.so",RTLD_NOW)!=0) return 0; printf("%s",dlerror()); return 1;}' >>conftest_m.cc
462
if $CXX -c conftest_a.cc >/dev/null 2>/dev/null && \
463
   $CXX -c conftest_m.cc >/dev/null 2>/dev/null && \
464
   $SHLIB_LD -o libconftest_a.so conftest_a.o >/dev/null 2>/dev/null; \
465
then
466
   silly_ok="no"
467
   # 1st try.
468
   if $CXX -o conftest conftest_m.o $ldl >/dev/null 2>/dev/null; then
469
      if ./conftest >/dev/null 2>/dev/null; then
470
         AC_MSG_RESULT(not needed)
471
         silly_ok="yes"
472
      fi
473
   fi
474
   # 2nd try.
475
   if test $silly_ok = "no" && \
476
      $CXX -o conftest -Wl,--export-dynamic conftest_m.o $ldl >/dev/null 2>/dev/null; \
477
   then
478
      if ./conftest >/dev/null 2>/dev/null; then
479
         AC_MSG_RESULT(both)
480
         LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
481
         silly_ok="yes"
482
      fi
483
   fi
484
   # no solution found
485
   if test $silly_ok = "no"; then
486
      AC_MSG_RESULT(no solution found)
487
      AC_MSG_WARN([No way was detected to export symbols from executables to shared])
488
      AC_MSG_WARN([libraries. You probably will not be able to dynamically load])
489
      AC_MSG_WARN([simple modules or other extensions written in C++ into simulation])
490
      AC_MSG_WARN([programs like INET.])
491
   fi
492
else
493
   # note: expected failure on MinGW, because there's no dlopen().
494
   # fixing this would mean overturning and re-testing the whole configure script
495
   AC_MSG_RESULT(test failed)
496
fi
497
rm -f conftest_a.* conftest_m.* libconftest_a.so conftest
498
499
#----------------------
500
# Test for "-z allextract" (Sun) or "--whole-archive" (GNU) linker option,
501
#----------------------
502
# Goal: to eliminate "silly linker problem", that is, to convince the linker
503
# to include constructors of static C++ objects in statically linked libraries.
504
# To test, we'll compile the following code into a static library:
505
#      #include <stdio.h>
506
#      class A { public: A() {printf("=WORKS=");} };
507
#      static A a;
508
# Then we link it with the following program:
509
#      int main() {return 0;}
510
# And check if the executable prints '=WORKS=' when run.
511
#
512
AC_MSG_CHECKING(for flags needed to link with static libs containing simple modules)
513
echo '#include <stdio.h>' >conftest_a.cc
514
# NOTE: do not write "=WORKS=\n" because sh on OS X resolves it
515
echo 'class A { public: A() {printf("=WORKS=");} };' >>conftest_a.cc
516
echo 'static A a;' >> conftest_a.cc
517
echo 'int main() {return 0;}' >> conftest_m.cc
518
if $CXX -c conftest_a.cc >/dev/null 2>/dev/null && \
519
   $CXX -c conftest_m.cc >/dev/null 2>/dev/null && \
520
   $AR libconftest_a.a conftest_a.o >/dev/null 2>/dev/null && \
521
   $RANLIB libconftest_a.a >/dev/null 2>/dev/null; \
522
then
523
   silly_ok="no"
524
   # 1st try.
525
   if $CXX -o conftest conftest_m.o libconftest_a.a >/dev/null 2>/dev/null; then
526
      if ./conftest 2>/dev/null | grep '=WORKS=' >/dev/null; then
527
         AC_MSG_RESULT(none)
528
         silly_ok="yes"
529
      fi
530
   fi
531
532
   # 2nd try.
533
   silly1=-Wl,--whole-archive
534
   silly2=-Wl,--no-whole-archive
535
   if test $silly_ok = "no" && \
536
      $CXX -o conftest conftest_m.o $silly1 libconftest_a.a $silly2 >/dev/null 2>/dev/null && \
537
      ./conftest 2>/dev/null | grep '=WORKS=' >/dev/null; \
538
   then
539
      AC_MSG_RESULT(--whole-archive)
540
      AC_MSG_NOTICE([NOTE: Use the following syntax when linking with static libraries])
541
      AC_MSG_NOTICE([containing simple modules and other dynamically registered components:])
542
      AC_MSG_NOTICE([   $CXX ... $silly1 <libs> $silly2 ...])
543
      silly_ok="yes"
544
      WHOLE_ARCHIVE_ON=$silly1
545
      WHOLE_ARCHIVE_OFF=$silly2
546
   fi
547
548
   # 3rd try.
549
   silly1=-Wl,-z,allextract
550
   silly2=-Wl,-z,defaultextract
551
   if test $silly_ok = "no" && \
552
      $CXX -o conftest conftest_m.o $silly1 libconftest_a.a $silly2 >/dev/null 2>/dev/null && \
553
      ./conftest 2>/dev/null | grep '=WORKS=' >/dev/null; \
554
   then
555
      AC_MSG_RESULT([-z,allextract])
556
      AC_MSG_NOTICE([NOTE: Use the following syntax when linking with static libraries])
557
      AC_MSG_NOTICE([containing simple modules and other dynamically registered components:])
558
      AC_MSG_NOTICE([   $CXX ... $silly1 <libs> $silly2 ...])
559
      silly_ok="yes"
560
      WHOLE_ARCHIVE_ON=$silly1
561
      WHOLE_ARCHIVE_OFF=$silly2
562
   fi
563
564
   # 4th try.
565
   silly1=-Wl,-all_load
566
   silly2=
567
   if test $silly_ok = "no" && \
568
      $CXX -o conftest conftest_m.o $silly1 libconftest_a.a $silly2 >/dev/null 2>/dev/null && \
569
      ./conftest 2>/dev/null | grep '=WORKS=' >/dev/null; \
570
   then
571
      AC_MSG_RESULT([-all_load])
572
      AC_MSG_NOTICE([NOTE: Use the following syntax when linking with static libraries])
573
      AC_MSG_NOTICE([containing simple modules and other dynamically registered components:])
574
      AC_MSG_NOTICE([   $CXX ... $silly1 <libs> $silly2 ...])
575
      silly_ok="yes"
576
      WHOLE_ARCHIVE_ON=$silly1
577
      WHOLE_ARCHIVE_OFF=$silly2
578
   fi
579
   # no solution found
580
   if test $silly_ok = "no"; then
581
      AC_MSG_RESULT(no solution found)
582
      AC_MSG_WARN([Avoid linking with static libraries containing simple modules])
583
      AC_MSG_WARN([and other dynamically registered components. Those components])
584
      AC_MSG_WARN([will not be found by the simulation program, because the linker])
585
      AC_MSG_WARN([leaves them out from the executable.])
586
   fi
587
else
588
   AC_MSG_RESULT(test failed)
589
fi
590
rm -f conftest_a.* conftest_m.* libconftest_a.a conftest
591
592
593
#----------------------
594
# Check Cygwin
595
#----------------------
596
if test "$WITH_PARSIM" = "yes" -a "$cygwin" = "yes"; then
597
   AC_MSG_ERROR([WITH_PARSIM=yes not supported with Cygwin -- please edit configure.user!])
598
fi
599
600
#----------------------
601
# set arch specific flags
602
#----------------------
603
CFLAGS_DEBUG="$CFLAGS_DEBUG $CFLAGS_ARCH"
604
CFLAGS_RELEASE="$CFLAGS_RELEASE $CFLAGS_ARCH"
605
LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
606
607
#----------------------
608
# Check for rpath
609
#----------------------
610
# add RUNTIME_PATH option if supported, so that setting LD_LIBRARY_PATH is no longer needed when using shared libs.
611
# Also, we add "." to rpath so that opp_run -L option does not need full path of the library
612
AC_MSG_CHECKING(whether linker supports -rpath)
613
LDFLAGS_SAVE="$LDFLAGS"
614
LDFLAGS="$LDFLAGS -Wl,-rpath,\$(OMNETPP_LIB_DIR) -Wl,-rpath,."
615
AC_LINK_IFELSE(
616
     [AC_LANG_PROGRAM()],
617
     [AC_MSG_RESULT(yes)],
618
     [AC_MSG_RESULT(no); RPATH_UNSUPPORTED="true"; LDFLAGS="$LDFLAGS_SAVE"])
619
620
#----------------------
621
# Checks for programs.
622
#----------------------
623
624
AC_PROG_YACC
625
if test "$YACC" = "yacc"; then
626
   AC_MSG_ERROR([Bison not found, needed to build OMNeT++/OMNEST -- please install it!])
627
fi
628
BISON_VER_LINE=`$YACC --version | grep "bison.* [[234]]\\."`
629
if test -z "$BISON_VER_LINE"; then
630
   AC_MSG_ERROR([At least bison version 2.0 required -- type '$YACC --version' to see the version number])
631
fi
632
633
AC_PROG_LEX
634
if test "$LEX" != "flex"; then
635
   AC_MSG_ERROR([Flex not found, needed to build OMNeT++/OMNEST -- please install it!])
636
fi
637
FLEX_VER_LINE=`$LEX --version | grep "flex.* 2\\.[[5-9]]"`
638
if test -z "$FLEX_VER_LINE"; then
639
   AC_MSG_ERROR([At least flex version 2.5 required -- type '$LEX --version' to see the version number])
640
fi
641
642
# make must be GNU make
643
AC_CHECK_PROG(MAKE, make , make, not found)
644
if test "$MAKE" = "not found"; then
645
   OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES make"
646
   AC_MSG_ERROR(make program not found -- it is required to build OMNeT++/OMNEST, and also for model development.)
647
else
648
   if "$MAKE" --version 2>/dev/null | grep -i GNU >/dev/null; then :; else
649
       AC_MSG_ERROR(GNU Make is required to build OMNeT++/OMNEST.)
650
   fi
651
fi
652
653
# perl is needed for opp_msgc
654
AC_ARG_VAR(PERL, The Perl interpreter)
655
AC_CHECK_PROG(PERL, perl, perl, not found)
656
if test "$PERL" = "not found"; then
657
   OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES  perl"
658
   AC_MSG_WARN(Perl not found -- please install it! Perl is required by opp_msgc, opp_makemake and other features.)
659
fi
660
if test ! -x /usr/bin/perl; then
661
   this_perl=`which perl`
662
   AC_MSG_ERROR(Perl MUST be available as /usr/bin/perl. Creating a soft link should help: ln -s $this_perl /usr/bin/perl)
663
fi
664
665
# swig is used for building the ui support libs
666
AC_ARG_VAR(SWIG, The Swig interface generator)
667
AC_CHECK_PROG(SWIG, swig, swig, not found)
668
669
670
#----------------------
671
# Checks for standard libraries.
672
#----------------------
673
674
SYS_LIBS=""
675
676
# time functions
677
OPP_CHECK_LIB(time, time.h, clock_gettime(0,0), , , time_ok)
678
if test $time_ok = no; then
679
   OPP_CHECK_LIB(time, time.h, clock_gettime(0,0), ,-lrt, time_ok, SYS_LIBS="-lrt $SYS_LIBS")
680
fi
681
if test $time_ok = no; then
682
   AC_MSG_ERROR([Time library -lrt not found])
683
fi
684
685
# math functions
686
OPP_CHECK_LIB(math, math.h, floor(0), , , math_ok)
687
if test $math_ok = no; then
688
   OPP_CHECK_LIB(math, math.h, floor(0), , -lm, math_ok, SYS_LIBS="-lm $SYS_LIBS")
689
fi
690
if test $math_ok = no; then
691
   AC_MSG_ERROR([Standard C math library -lm not found])
692
fi
693
694
# -lstdc++
695
# currently we have a modified version of mingw which has a shared stdc++ by default so the below
696
# check is not needed
697
#if test "$mingw" = "yes"; then
698
#   # check for shared version (on mingw)
699
#   OPP_CHECK_LIB(standard C++ lib, iostream, /**/, , -lstdc++_s, stdcpp_ok, SYS_LIBS="-lstdc++_s $SYS_LIBS")
700
#else
701
   OPP_CHECK_LIB(standard C++ lib, iostream, /**/, , -lstdc++, stdcpp_ok, SYS_LIBS="-lstdc++ $SYS_LIBS")
702
   if test $stdcpp_ok = no; then
703
      OPP_CHECK_LIB(standard C++ lib, iostream, /**/, , -lcxx, stdcpp_ok, SYS_LIBS="-lcxx $SYS_LIBS")
704
   fi
705
   if test $stdcpp_ok = no; then
706
      OPP_CHECK_LIB(standard C++ lib, iostream, /**/, , -lcxa, stdcpp_ok, SYS_LIBS="-lcxa $SYS_LIBS")
707
   fi
708
#fi
709
if test $stdcpp_ok = no; then
710
   AC_MSG_ERROR([Standard C++ library -lstdc++_s or -lstdc++ or -lcxx or -lcxa not found])
711
fi
712
713
# dlopen()
714
OPP_CHECK_LIB(dlopen, dlfcn.h, dlopen("",0), , , dl_ok)
715
if test $dl_ok = no; then
716
   OPP_CHECK_LIB(dlopen, dlfcn.h, dlopen("",0), , -ldl, dl_ok, SYS_LIBS="-ldl $SYS_LIBS")
717
fi
718
if test $dl_ok = yes; then
719
   HAVE_DLOPEN=1
720
else
721
   HAVE_DLOPEN=0
722
   AC_MSG_WARN([no dlopen(): dynamic loading of libs not possible])
723
fi
724
725
# winsock (for MinGW)
726
OPP_CHECK_LIB(winsock, winsock.h, socket(0,0,0), , -lwsock32, wsock_ok, SYS_LIBS="-lwsock32 $SYS_LIBS")
727
728
# zlib
729
if test "$ZLIB_LIBS" = ""; then
730
    ZLIB_LIBS=-lz
731
fi
732
OPP_CHECK_LIB(zlib, zlib.h, gzopen("",""), $CFLAGS_RELEASE $ZLIB_CFLAGS, $ZLIB_LIBS, zlib_ok)
733
# on mingw/msys try a different library name
734
if test $zlib_ok = no -a "$mingw" = yes; then
735
    ZLIB_LIBS="-lzlib1"
736
    OPP_CHECK_LIB(zlib, zlib.h, gzopen("",""), $CFLAGS_RELEASE $ZLIB_CFLAGS, $ZLIB_LIBS, zlib_ok)
737
fi
738
if test $zlib_ok = no; then
739
   AC_MSG_ERROR([zlib or zlib header file not found, please install it])
740
fi
741
742
743
#----------------------
744
# Check for Tcl/Tk.
745
#----------------------
746
if test -n "$NO_TCL"; then
747
748
    # skip testing for TCL
749
    TKENV_IF_POSSIBLE=missing-dependency
750
751
    # and build samples using Cmdenv (TBD)
752
    ALL_ENV_LIBS='$(CMDENV_LIBS)'
753
754
else  #matching "fi" is after BLT testing
755
756
   if test -d /usr/include/tcl8.4; then
757
        # this was reported to be the case on Debian 3.1 "sarge"
758
        TK_CFLAGS84=${TK_CFLAGS:-"-I/usr/include/tcl8.4"}
759
   fi
760
   if test -d /usr/include/tcl8.5; then
761
        TK_CFLAGS85=${TK_CFLAGS:-"-I/usr/include/tcl8.5"}
762
   fi
763
   if test -d /usr/include/tcl8.6; then
764
        TK_CFLAGS86=${TK_CFLAGS:-"-I/usr/include/tcl8.6"}
765
   fi
766
767
   if test -n "$TK_LIBS"; then
768
        OPP_CHECK_LIB(Tcl/Tk, tk.h, Tk_MainLoop(), $TK_CFLAGS, $TK_LIBS, tcltk_ok)
769
    else
770
        # try to use tcl/tk without X (e.g. on Mac OS X native aqua Tcl/Tk impl)
771
        OPP_CHECK_LIB(Tcl/Tk 8.6, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $TK_CFLAGS86, -ltk8.6 -ltcl8.6,
772
                          tcltk_ok, TK_LIBS="-ltk8.6 -ltcl8.6" TK_CFLAGS=$TK_CFLAGS86)
773
        if test $tcltk_ok = no; then
774
           OPP_CHECK_LIB(Tcl/Tk 8.5, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $TK_CFLAGS85, -ltk8.5 -ltcl8.5,
775
                          tcltk_ok, TK_LIBS="-ltk8.5 -ltcl8.5" TK_CFLAGS=$TK_CFLAGS85)
776
        fi
777
        if test $tcltk_ok = no; then
778
            OPP_CHECK_LIB(Tcl/Tk 8.4, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $TK_CFLAGS84, -ltk8.4 -ltcl8.4,
779
                          tcltk_ok, TK_LIBS="-ltk8.4 -ltcl8.4" TK_CFLAGS=$TK_CFLAGS84)
780
        fi
781
        # look for X window libs and headers
782
        if test $tcltk_ok = no; then
783
            # try to find Tcl/Tk ourselves, but it usually needs to link with Xlib
784
            AC_PATH_X
785
            if test "$no_x" = "yes"; then
786
                opp_x11inc=
787
                opp_x11lib=
788
            else
789
               if test -n "$x_includes"; then
790
                   opp_x11inc="-I$x_includes"
791
               fi
792
               if test -n "$x_libraries"; then
793
                   opp_x11lib="-L$x_libraries -lX11"
794
               fi
795
            fi
796
        fi
797
        if test $tcltk_ok = no; then
798
            OPP_CHECK_LIB(Tcl/Tk 8.6, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS86, $opp_x11lib -ltk86 -ltcl86,
799
                          tcltk_ok, TK_LIBS="$opp_x11lib -ltk86 -ltcl86" TK_CFLAGS=$TK_CFLAGS86)
800
        fi
801
        if test $tcltk_ok = no; then
802
            OPP_CHECK_LIB(Tcl/Tk 8.6, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS86, $opp_x11lib -ltk8.6 -ltcl8.6,
803
                          tcltk_ok, TK_LIBS="$opp_x11lib -ltk8.6 -ltcl8.6" TK_CFLAGS=$TK_CFLAGS86)
804
        fi
805
        if test $tcltk_ok = no -a "$cygwin" = yes; then
806
            OPP_CHECK_LIB(Tcl/Tk 8.6, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS86, $opp_x11lib -lcygtk86 -lcygtcl86,
807
                          tcltk_ok, TK_LIBS="$opp_x11lib -lcygtk86 -lcygtcl86" TK_CFLAGS=$TK_CFLAGS86)
808
        fi
809
        # check for 8.5
810
        if test $tcltk_ok = no; then
811
            OPP_CHECK_LIB(Tcl/Tk 8.5, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS85, $opp_x11lib -ltk85 -ltcl85,
812
                          tcltk_ok, TK_LIBS="$opp_x11lib -ltk85 -ltcl85" TK_CFLAGS=$TK_CFLAGS85)
813
        fi
814
        if test $tcltk_ok = no; then
815
            OPP_CHECK_LIB(Tcl/Tk 8.5, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS85, $opp_x11lib -ltk8.5 -ltcl8.5,
816
                          tcltk_ok, TK_LIBS="$opp_x11lib -ltk8.5 -ltcl8.5" TK_CFLAGS=$TK_CFLAGS85)
817
        fi
818
        if test $tcltk_ok = no -a "$cygwin" = yes; then
819
            OPP_CHECK_LIB(Tcl/Tk 8.5, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS85, $opp_x11lib -lcygtk85 -lcygtcl85,
820
                          tcltk_ok, TK_LIBS="$opp_x11lib -lcygtk85 -lcygtcl85" TK_CFLAGS=$TK_CFLAGS85)
821
        fi
822
        # check for 8.4
823
        if test $tcltk_ok = no; then
824
            OPP_CHECK_LIB(Tcl/Tk 8.4, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS84, $opp_x11lib -ltk84 -ltcl84,
825
                          tcltk_ok, TK_LIBS="$opp_x11lib -ltk84 -ltcl84" TK_CFLAGS=$TK_CFLAGS84)
826
        fi
827
        if test $tcltk_ok = no; then
828
            OPP_CHECK_LIB(Tcl/Tk 8.4, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS84, $opp_x11lib -ltk8.4 -ltcl8.4,
829
                          tcltk_ok, TK_LIBS="$opp_x11lib -ltk8.4 -ltcl8.4" TK_CFLAGS=$TK_CFLAGS84)
830
        fi
831
        if test $tcltk_ok = no -a "$cygwin" = yes; then
832
            OPP_CHECK_LIB(Tcl/Tk 8.4, tk.h, Tk_MainLoop(), $CFLAGS_RELEASE $opp_x11inc $TK_CFLAGS84, $opp_x11lib -lcygtk84 -lcygtcl84,
833
                          tcltk_ok, TK_LIBS="$opp_x11lib -lcygtk84 -lcygtcl84" TK_CFLAGS=$TK_CFLAGS84)
834
        fi
835
    fi
836
837
    if test $tcltk_ok = no; then
838
        # try to give a hint in the error message about the problem
839
        if test "$no_x" = "yes"; then
840
            if test "$cygwin" = yes; then
841
                AC_MSG_ERROR([Cannot build Tcl/Tk apps, probably due to missing X11 headers -- try installing the XFree86 packages or get the X headers from www.omnetpp.org.])
842
            else
843
                AC_MSG_ERROR([Cannot build Tcl/Tk apps, probably due to misconfigured or missing X11 headers or libs. Check config.log for more info!])
844
            fi
845
        else
846
            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!])
847
        fi
848
    fi
849
850 0c2704af Georg Kunz
    # Check for tclsh.
851
    AC_CHECK_PROGS(TCLSH, $TCLSH tclsh tclsh86 tclsh8.6 tclsh85 tclsh8.5 tclsh84 tclsh8.4 cygtclsh cygtclsh86 cygtclsh85 cygtclsh84, nope)
852
    if test "$TCLSH" = nope; then
853
       AC_MSG_ERROR([Cannot find tclsh, part of Tcl/Tk -- maybe it is not in the PATH or has some exotic name (tested names were: tclsh tclsh86 tclsh8.6 tclsh85 tclsh8.5 tclsh84 tclsh8.4 cygtclsh cygtclsh86 cygtclsh85 cygtclsh84)])
854 01873262 Georg Kunz
    fi
855 0c2704af Georg Kunz
    if echo 'puts OK; exit' | $TCLSH | grep OK >/dev/null; then :; else
856
        AC_MSG_ERROR([Cannot run tclsh (tclsh command "puts OK; exit" failed): maybe your TCL installation is broken?])
857 01873262 Georg Kunz
    fi
858
859 0c2704af Georg Kunz
    # disabled because this check actually only works with a running X server. However, the OPP_CHECK_LIB checks above should cover this check most of the time.
860
    #if echo 'catch {package require Tk 8.4; puts OK}; exit' | $TCLSH | grep OK >/dev/null; then :; else
861
    #    AC_MSG_ERROR([tclsh command "package require Tk 8.4" failed: probably old Tcl/Tk version, version 8.4.0+ required])
862
    #fi
863
864 01873262 Georg Kunz
    # note: square brackets necessary otherwise M4 messes up the Tcl command
865 0c2704af Georg Kunz
    [tcl_library=`echo 'puts [info library]; exit' | $TCLSH`]
866 01873262 Georg Kunz
867
868
    #----------------------
869
    # Check for BLT. NOTE: since plove and scalars are out, blt-devel is no longer needed
870
    #----------------------
871 0c2704af Georg Kunz
    if echo 'catch {package require BLT 2.4; puts OK}; exit' | $TCLSH | grep OK >/dev/null; then
872 01873262 Georg Kunz
        HAVE_BLT=yes
873
    else
874
        HAVE_BLT=no
875
        # Native Tcl/Tk (aqua) on Mac OS does not support BLT so we do not annoy the users
876
        if test "$PLATFORM" != "macosx"; then
877
            OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES  BLT (optional)"
878
            AC_MSG_WARN([Tcl cannot load BLT (wish command "package require BLT 2.4" failed), BLT not installed?])
879
        fi
880
    fi
881
882
    # if we got through until here, enable building of the following progs:
883
    TKENV_IF_POSSIBLE=tkenv
884
885
    # and build samples using Tkenv
886
    ALL_ENV_LIBS='$(TKENV_LIBS) $(CMDENV_LIBS)'
887
888
fi # end of Tcl tests ($NO_TCL=="" branch)
889
890
#----------------------
891
# Check for pthread
892
#----------------------
893
OPP_CHECK_LIB(PTHREAD, pthread.h, pthread_join, $PTHREAD_CFLAGS, $PTHREAD_LIBS, pthread_ok)
894
if test $pthread_ok = no; then
895
	AC_MSG_ERROR([pthread lib not found.])
896
fi
897
898
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
899
SYS_LIBS="$SYS_LIBS $PTHREAD_LIBS"
900
901
902
#----------------------
903
# Check for libatomic-ops-dev
904
#----------------------
905
OPP_CHECK_LIB(ATOMIC-OPS, atomic_ops.h, AO_load, $ATOMIC_OPS_CFLAGS, $ATOMIC_OPS_LIBS, atomic_ops_ok)
906
if test $atomic_ops_ok = no; then
907
    AC_MSG_ERROR([libatomic-ops not found. You can disable use of this library in configure.user, but be warned that this might cause data corruption at runtime.])
908
fi
909
910
CFLAGS="$CFLAGS $ATOMIC_OPS_CFLAGS"
911
USER_CFLAGS="$USER_CFLAGS $ATOMIC_OPS_CFLAGS"
912
SYS_LIBS="$SYS_LIBS $ATOMIC_OPS_LIBS"
913
914
#----------------------
915
# Check for JRE
916
#----------------------
917
AC_CHECK_PROGS(JRE, $JRE java, nope)
918
if test "$JRE" = nope; then
919
   OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES  JRE (recommended)"
920
   AC_MSG_WARN([Cannot find a suitable Java Runtime Environment - The IDE requires JRE 1.5 or later. Please install it before configuring])
921
fi
922
923
#----------------------
924
# Check for JDK
925
#----------------------
926
927
if test "$JAVA_CFLAGS" = ""; then
928
   if test "$JDK" = ""; then
929
     javahome_candidates="/usr/lib/jvm/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"
930
     for dir in $javahome_candidates; do
931
         if test "$JAVA_HOME" = "" -a -d "$dir"; then
932
             JAVA_HOME=$dir
933
         fi
934
     done
935
   else
936
     JAVA_HOME=$JDK
937
   fi
938
   if test "$JAVA_HOME" = ""; then
939
      AC_MSG_WARN(JAVA_HOME variable not set.)
940
   else
941
      JAVA_CFLAGS="-fno-strict-aliasing -I$JAVA_HOME/include -I$JAVA_HOME/include/$jni_platform"
942
      JAVA_LIBS="-L$JAVA_HOME/jre/lib/i386/client -Wl,-rpath,$JAVA_HOME/jre/lib/i386/client:. -ljvm"
943
   fi
944
fi
945
946
OPP_CHECK_LIB_NOLINK(JNI, jni.h, JNI_GetCreatedJavaVMs(0,0,0), $CFLAGS_RELEASE $JAVA_CFLAGS, jni_ok)
947
948
if test "$jni_ok" = "no" -o "$SWIG" = "not found"; then
949
   JNILIBS_IF_POSSIBLE=missing-dependency
950
else
951
   JNILIBS_IF_POSSIBLE=jnilibs
952
fi
953
954
#----------------------
955
# Check for MPI.
956
#----------------------
957
958
if test -n "$MPI_LIBS"; then
959
    OPP_CHECK_LIB(MPI, mpi.h, MPI_Init(0,0), $CFLAGS_RELEASE $MPI_CFLAGS, $LDFLAGS $MPI_LIBS, mpi_ok)
960
else
961
    mpi_ok=no
962
    # LAM and OpenMPI support mpic++ -showme
963
    # NOTE: on some systems (e.g. RHEL and Fedora), "module load openmpi_i386" or similar command may be additionally needed to make MPI accessible
964
    AC_CHECK_PROG(MPICPP, mpic++, mpic++, not found)
965
    if test "$MPICPP" != "not found"; then
966
        MPI_CFLAGS=`mpic++ -showme:compile`
967
        MPI_LIBS=`mpic++ -showme:link`
968
        OPP_CHECK_LIB(MPI, mpi.h, MPI_Init(0,0), $CFLAGS_RELEASE $MPI_CFLAGS, $LDFLAGS $MPI_LIBS, mpi_ok)
969
    fi
970
971
    if test $mpi_ok = no; then
972
          # MPICH2 has mpicxx -compile-info and -link-info, slightly broken
973
          # (both print the same string, which includes the compiler name too)
974
          AC_CHECK_PROG(MPICXX, mpicxx, mpicxx, not found)
975
          if test "$MPICXX" != "not found"; then
976
              MPI_CFLAGS=`mpicxx -c -compile-info | sed 's/^[^ ]*//'`
977
              MPI_LIBS=`mpicxx -link-info | sed 's/^[^ ]*//'`
978
              OPP_CHECK_LIB(MPI, mpi.h, MPI_Init(0,0), $CFLAGS_RELEASE $MPI_CFLAGS, $LDFLAGS $MPI_LIBS, mpi_ok)
979
          fi
980
    fi
981
982
    if test $mpi_ok = no; then
983
       mpilibs="-lmpi"   #SGI and mingw (on MinGW modify mpi.h and insert #include <wchar.h> at the top of the file)
984
       OPP_CHECK_LIB(MPI, mpi.h, MPI_Init(0,0), $CFLAGS_RELEASE $MPI_CFLAGS, $LDFLAGS $mpilibs, mpi_ok, MPI_LIBS="$mpilibs")
985
    fi
986
fi
987
988
if test $mpi_ok = yes; then
989
   HAVE_MPI=yes
990
   MPI_CFLAGS="$MPI_CFLAGS -DWITH_MPI"
991
else
992
   HAVE_MPI=no
993
   OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES  MPI (optional)"
994
   AC_MSG_WARN([Optional package MPI (needed for parallel simulation) not found.])
995
fi
996
997
998
#----------------------
999
# Check for PCAP.
1000
#----------------------
1001
1002
# Note: on Windows, we need to check beforehand if wpcap.dll exists, because
1003
# otherwise the test program (that links with pcap.lib) brings up a GUI (!)
1004
# error dialog complaining that wpcap.dll was missing
1005
case $host in
1006
*-*-cygwin* | *-*-mingw32*)
1007
    OPP_CHECK_AND_RUN_LIB(WinPCAP, windows.h, return LoadLibrary("wpcap.dll")==NULL ? 1 : 0, $CFLAGS_RELEASE, , wpcap_dll)
1008
    ;;
1009
*)
1010
    wpcap_dll=notneeded
1011
    ;;
1012
esac
1013
1014
if test $wpcap_dll = "no"; then
1015
    pcap_ok=no
1016
    AC_MSG_NOTICE([WinPCAP not found -- if you need packet capture functionality in your models, install it from winpcap.org])
1017
else
1018
    if test -n "$PCAP_LIBS"; then
1019
        OPP_CHECK_AND_RUN_LIB(PCAP, pcap.h, pcap_lib_version(), $CFLAGS_RELEASE $PCAP_CFLAGS, $PCAP_LIBS, pcap_ok)
1020
    else
1021
        PCAP_LIBS="-lpcap"
1022
        OPP_CHECK_AND_RUN_LIB(PCAP, pcap.h, pcap_lib_version(), $CFLAGS_RELEASE $PCAP_CFLAGS, $PCAP_LIBS, pcap_ok)
1023
    fi
1024
fi
1025
if test $pcap_ok = yes; then
1026
    HAVE_PCAP=yes
1027
    CFLAGS_RELEASE="$CFLAGS_RELEASE $PCAP_CFLAGS -DHAVE_PCAP"
1028
    CFLAGS_DEBUG="$CFLAGS_DEBUG $PCAP_CFLAGS -DHAVE_PCAP"
1029
else
1030
    HAVE_PCAP=no
1031
    PCAP_CFLAGS=""
1032
    PCAP_LIBS=""
1033
    OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES  PCAP (optional)"
1034
fi
1035
1036
#----------------------
1037
# Check for PTHREAD.
1038
# On MinGW, add "-mthread" to PTHREAD_CFLAGS and PTHREAD_LIBS to force using
1039
# the multithreaded standard libraries.
1040
#----------------------
1041
1042
if test -n "$PTHREAD_LIBS"; then
1043
    OPP_CHECK_LIB(PTHREAD, pthread.h, pthread_rwlock_rdlock(0), $CFLAGS_RELEASE $PTHREAD_CFLAGS, $PTHREAD_LIBS, pthread_ok)
1044
else
1045
    PTHREAD_LIBS="-lpthread"
1046
    OPP_CHECK_LIB(PTHREAD, pthread.h, pthread_rwlock_rdlock(0), $CFLAGS_RELEASE $PTHREAD_CFLAGS, $PTHREAD_LIBS, pthread_ok)
1047
fi
1048
if test $pthread_ok = yes; then
1049
    HAVE_PTHREAD=yes
1050
    if test "$mingw" = yes; then
1051
        PTHREAD_CFLAGS="$PTHREAD_CFLAGS -mthreads"
1052
        PTHREAD_LIBS="$PTHREAD_LIBS -mthreads"
1053
    fi
1054
else
1055
    HAVE_PTHREAD=no
1056
    PTHREAD_CFLAGS=""
1057
    PTHREAD_LIBS=""
1058
fi
1059
1060
#----------------------
1061
# Check for XML parsers: EXPAT and/or LIBXML
1062
#----------------------
1063
if test -n "$LIBXML_LIBS"; then
1064
    OPP_CHECK_LIB(LibXML XML parser, libxml/parser.h, xmlInitParser(), $CFLAGS_RELEASE $LIBXML_CFLAGS, $LIBXML_LIBS, libxml_ok)
1065
else
1066
    OPP_CHECK_LIB(LibXML XML parser, libxml/parser.h, xmlInitParser(), $CFLAGS_RELEASE $LIBXML_CFLAGS, -lxml2,
1067
                  libxml_ok, LIBXML_LIBS="-lxml2")
1068
1069
    if test $libxml_ok = no; then
1070
        OPP_CHECK_LIB(LibXML XML parser, libxml/parser.h, xmlInitParser(), $CFLAGS_RELEASE -I/usr/include/libxml2, -lxml2,
1071
                      libxml_ok, LIBXML_CFLAGS="-I/usr/include/libxml2" LIBXML_LIBS="-lxml2")
1072
    fi
1073
fi
1074
if test -n "$EXPAT_LIBS"; then
1075
    OPP_CHECK_LIB(Expat XML parser, expat.h, XML_ParserCreate(0), $CFLAGS_RELEASE $EXPAT_CFLAGS, $EXPAT_LIBS, expat_ok)
1076
else
1077
    expatlibs="-lexpat"
1078
    OPP_CHECK_LIB(Expat XML parser, expat.h, XML_ParserCreate(0), $CFLAGS_RELEASE $EXPAT_CFLAGS, $expatlibs, expat_ok, EXPAT_LIBS=$expatlibs)
1079
fi
1080
1081
if test $libxml_ok = yes; then
1082
   AC_MSG_NOTICE([Using LibXML for XML parsing])
1083
   XMLPARSER=libxml
1084
   XML_CFLAGS=$LIBXML_CFLAGS
1085
   XML_LIBS=$LIBXML_LIBS
1086
elif test $expat_ok = yes; then
1087
   AC_MSG_NOTICE([Using Expat for XML parsing])
1088
   AC_MSG_WARN([DTD validation is not supported with Expat, only with LibXML!])
1089
   XMLPARSER=expat
1090
   XML_CFLAGS=$EXPAT_CFLAGS
1091
   XML_LIBS=$EXPAT_LIBS
1092
else
1093
   XMLPARSER=none
1094
   OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES  LibXML/Expat"
1095
   AC_MSG_WARN([No suitable XML parser found: no support for XML input])
1096
fi
1097
1098
CFLAGS_DEBUG="$CFLAGS_DEBUG -DXMLPARSER=$XMLPARSER"
1099
CFLAGS_RELEASE="$CFLAGS_RELEASE -DXMLPARSER=$XMLPARSER"
1100
1101
#----------------------
1102
# Check for Akaroa header and lib
1103
#----------------------
1104
if test -z "$AKAROA_CFLAGS"; then
1105
    AKAROA_CFLAGS="-I/usr/local/akaroa/include"
1106
fi
1107
if test -z "$AKAROA_LIBS"; then
1108
    AKAROA_LIBS="-L/usr/local/akaroa/lib -lakaroa -lfl"
1109
fi
1110
1111
OPP_CHECK_LIB(Akaroa, akaroa.H, AkObservation(0.0), $CFLAGS_RELEASE $AKAROA_CFLAGS, $AKAROA_LIBS, akaroa_ok)
1112
if test $akaroa_ok = yes; then
1113
   CFLAGS_DEBUG="$CFLAGS_DEBUG $AKAROA_CFLAGS -DWITH_AKAROA"
1114
   CFLAGS_RELEASE="$CFLAGS_RELEASE $AKAROA_CFLAGS -DWITH_AKAROA"
1115
   SYS_LIBS="$SYS_LIBS $AKAROA_LIBS"
1116
else
1117
   OPP_PROBLEM_PACKAGES="$OPP_PROBLEM_PACKAGES  Akaroa (optional)"
1118
   AC_MSG_WARN([Optional package Akaroa not found])
1119
fi
1120
1121
1122
#----------------------
1123
# #defines in CFLAGS
1124
#----------------------
1125
if test "$WITH_PARSIM" = yes; then
1126
   CFLAGS_DEBUG="$CFLAGS_DEBUG -DWITH_PARSIM"
1127
   CFLAGS_RELEASE="$CFLAGS_RELEASE -DWITH_PARSIM"
1128
fi
1129
if test "$WITH_NETBUILDER" = yes; then
1130
   CFLAGS_DEBUG="$CFLAGS_DEBUG -DWITH_NETBUILDER"
1131
   CFLAGS_RELEASE="$CFLAGS_RELEASE -DWITH_NETBUILDER"
1132
fi
1133
1134
if test "$WITH_MUTEXES" = yes; then
1135
   CFLAGS="$CFLAGS -DMUTEXES"
1136
   CFLAGS_DEBUG="$CFLAGS_DEBUG -DMUTEXES"
1137
   CFLAGS_RELEASE="$CFLAGS_RELEASE -DMUTEXES"
1138
fi
1139
if test "$NOBARRIER" = yes; then
1140
   CFLAGS_DEBUG="$CFLAGS_DEBUG -DNOBARRIER"
1141
   CFLAGS_RELEASE="$CFLAGS_RELEASE -DNOBARRIER"
1142
fi
1143
if test "$ENABLE_OWNERSHIP" = yes; then
1144
   CFLAGS_DEBUG="$CFLAGS_DEBUG -DENABLE_OWNERSHIP"
1145
   CFLAGS_RELEASE="$CFLAGS_RELEASE -DENABLE_OWNERSHIP"
1146
fi
1147
if test "$WITH_CACHE_LINE_SIZE" != 0; then
1148
   CFLAGS_DEBUG="$CFLAGS_DEBUG -DCACHE_LINE_SIZE=$WITH_CACHE_LINE_SIZE"
1149
   CFLAGS_RELEASE="$CFLAGS_RELEASE -DCACHE_LINE_SIZE=$WITH_CACHE_LINE_SIZE"
1150
fi
1151
if test "$ATOMIC_OPS_DEBUG" = yes; then
1152
   CFLAGS_DEBUG="$CFLAGS_DEBUG -DATOMIC_OPS_DEBUG"
1153
   CFLAGS_RELEASE="$CFLAGS_RELEASE -DATOMIC_OPS_DEBUG"
1154
fi
1155
if test "$ATOMIC_OPS_DEBUG_PLAIN" = yes; then
1156
   CFLAGS_DEBUG="$CFLAGS_DEBUG -DATOMIC_OPS_DEBUG_PLAIN"
1157
   CFLAGS_RELEASE="$CFLAGS_RELEASE -DATOMIC_OPS_DEBUG_PLAIN"
1158
fi
1159
1160
1161
#----------------------
1162
# Files to be generated
1163
#----------------------
1164
AC_CONFIG_FILES(
1165
  Makefile.inc
1166
)
1167
1168
#----------------------
1169
# Substitutions.
1170
#----------------------
1171
1172
AC_SUBST(OMNETPP_PRODUCT)
1173
AC_SUBST(OMNETPP_RELEASE)
1174
AC_SUBST(OMNETPP_VERSION)
1175
AC_SUBST(OMNETPP_BUILDID)
1176
AC_SUBST(OMNETPP_EDITION)
1177
1178
AC_SUBST(OMNETPP_ROOT)
1179
AC_SUBST(OMNETPP_BIN_DIR)
1180
AC_SUBST(OMNETPP_INCL_DIR)
1181
AC_SUBST(OMNETPP_OUT_DIR)
1182
AC_SUBST(OMNETPP_LIB_DIR)
1183
AC_SUBST(OMNETPP_IMAGE_PATH)
1184
1185
AC_SUBST(OMNETPP_SRC_DIR)
1186
AC_SUBST(OMNETPP_UI_DIR)
1187
AC_SUBST(OMNETPP_UTILS_DIR)
1188
AC_SUBST(OMNETPP_DOC_DIR)
1189
AC_SUBST(OMNETPP_TEST_DIR)
1190
1191
AC_SUBST(PERL)
1192
AC_SUBST(YACC)
1193
AC_SUBST(LEX)
1194
AC_SUBST(CC)
1195
AC_SUBST(CXX)
1196
AC_SUBST(CPPFLAGS)
1197
AC_SUBST(CFLAGS_DEBUG)
1198
AC_SUBST(CFLAGS_RELEASE)
1199
AC_SUBST(LDFLAGS)
1200
AC_SUBST(WHOLE_ARCHIVE_ON)
1201
AC_SUBST(WHOLE_ARCHIVE_OFF)
1202
AC_SUBST(TOOLCHAIN_NAME)
1203
AC_SUBST(MYPWD)
1204
AC_SUBST(MSGC)
1205
AC_SUBST(NEDTOOL)
1206
AC_SUBST(AS)
1207
AC_SUBST(AR)
1208
AC_SUBST(RANLIB)
1209
AC_SUBST(SHLIB_LD)
1210
AC_SUBST(DLLTOOL)
1211
AC_SUBST(STRIP)
1212 0c2704af Georg Kunz
AC_SUBST(TCLSH)
1213 01873262 Georg Kunz
AC_SUBST(MAKEDEPEND)
1214
AC_SUBST(LN)
1215
AC_SUBST(MKPATH)
1216
AC_SUBST(SHLIB_POSTPROCESS)
1217
1218
AC_SUBST(SHARED_LIBS)
1219
AC_SUBST(A_LIB_SUFFIX)
1220
AC_SUBST(SHARED_LIB_SUFFIX)
1221
AC_SUBST(JNI_LIB_SUFFIX)
1222
AC_SUBST(SO_LIB_SUFFIX)
1223
AC_SUBST(DLL_LIB_SUFFIX)
1224
AC_SUBST(EXE_SUFFIX)
1225
AC_SUBST(LIB_PREFIX)
1226
1227
AC_SUBST(NO_TCL)
1228
AC_SUBST(HAVE_DLOPEN)
1229
AC_SUBST(TK_CFLAGS)
1230
AC_SUBST(TK_LIBS)
1231
AC_SUBST(HAVE_BLT)
1232
AC_SUBST(BLT_LIBS)
1233
AC_SUBST(ZLIB_CFLAGS)
1234
AC_SUBST(ZLIB_LIBS)
1235
AC_SUBST(HAVE_MPI)
1236
AC_SUBST(MPI_CFLAGS)
1237
AC_SUBST(MPI_LIBS)
1238
AC_SUBST(HAVE_PCAP)
1239
AC_SUBST(PCAP_CFLAGS)
1240
AC_SUBST(PCAP_LIBS)
1241
AC_SUBST(SYS_LIBS)
1242
AC_SUBST(HAVE_PTHREAD)
1243
AC_SUBST(PTHREAD_CFLAGS)
1244
AC_SUBST(PTHREAD_LIBS)
1245
1246
AC_SUBST(XMLPARSER)
1247
AC_SUBST(XML_CFLAGS)
1248
AC_SUBST(XML_LIBS)
1249
1250
AC_SUBST(AKAROA_CFLAGS)
1251
AC_SUBST(AKAROA_LIBS)
1252
1253
AC_SUBST(TKENV_IF_POSSIBLE)
1254
AC_SUBST(JNILIBS_IF_POSSIBLE)
1255
1256
AC_SUBST(ALL_ENV_LIBS)
1257
1258
AC_SUBST(EMBED_TCL_CODE)
1259
AC_SUBST(OMNETPP_TKENV_DIR)
1260
1261
AC_SUBST(WITH_NETBUILDER)
1262
AC_SUBST(WITH_PARSIM)
1263
1264
AC_SUBST(JAVA_CFLAGS)
1265
AC_SUBST(JAVA_LIBS)
1266
AC_SUBST(SWIG)
1267
AC_SUBST(PLATFORM)
1268
1269
#
1270
# Generate files
1271
#
1272
AC_OUTPUT
1273
1274
chmod +x src/utils/opp_makemake
1275
chmod +x src/utils/opp_test
1276
chmod +x src/utils/opp_makedep
1277
chmod +x src/utils/omnest
1278
chmod +x src/utils/omnetpp
1279
chmod +x src/utils/opp_test
1280
1281
(
1282
cd src/common && cp ver.h.base ver.h && \
1283
echo "#define OMNETPP_PRODUCT \"$OMNETPP_PRODUCT\"" >>ver.h && \
1284
echo "#define OMNETPP_RELEASE \"$OMNETPP_RELEASE\"" >>ver.h && \
1285
echo "#define OMNETPP_VERSION_STR \"$OMNETPP_VERSION\"" >>ver.h && \
1286
echo "#define OMNETPP_BUILDID \"$OMNETPP_BUILDID\"" >>ver.h && \
1287
echo "#define OMNETPP_EDITION \"$OMNETPP_EDITION\"" >>ver.h
1288
)
1289
1290
# Test it the IDE was already configured. If not, copy the platform specific
1291
# files to the IDE root directory
1292
if test -d ide ; then
1293
  if test ! -d ide/configuration ; then
1294
    echo Configuring the IDE...
1295
    cp -r ide/linux/* ide
1296
    case $PLATFORM in
1297
    win32.x86)
1298
        cp -r ide/win32/* ide
1299
        echo osgi.instance.area.default=../samples >>ide/configuration/config.ini
1300
        ;;
1301
    linux.x86_64)
1302
        cp -r ide/linux64/* ide
1303
        echo osgi.instance.area.default=../samples >>ide/configuration/config.ini
1304
        ;;
1305
    linux.x86)
1306
        cp -r ide/linux/* ide
1307
        echo osgi.instance.area.default=../samples >>ide/configuration/config.ini
1308
        ;;
1309
    macosx)
1310
        cp -r ide/macosx/* ide
1311
        echo osgi.instance.area.default=../../../../samples >>ide/configuration/config.ini
1312
        ;;
1313
    *)
1314
        echo IDE is supported only on: Linux 32/64bit, Windows 32bit, MacOS X Intel. Not configured.
1315
        ;;
1316
    esac
1317
  fi
1318
fi
1319
1320
#----------------------
1321
# Check $OPP_PROBLEM_PACKAGES
1322
#----------------------
1323
1324
if test "$OPP_PROBLEM_PACKAGES" != ""; then
1325
  cat 1>&2 << EOT
1326
1327
WARNING: The configuration script could not detect the following packages:
1328
1329
  $OPP_PROBLEM_PACKAGES
1330
1331
Scroll up to see the warning messages (use shift+PgUp), and search config.log
1332
for more details. While you can use $OMNETPP_PRODUCT in the current configuration, 
1333
be aware that some functionality may be unavailable or incomplete.
1334
1335
EOT
1336
  if module avail >/dev/null 2>/dev/null; then
1337
    cat 1>&2 << EOT
1338
NOTE: Some packages like MPI may need to be loaded explicitly using a 
1339
"module load <MODULENAME>" command  prior to running ./configure. 
1340
Enter "module avail" to see the list of available modules on your system.
1341
1342
EOT
1343
  fi
1344
fi
1345
1346
1347
#----------------------
1348
# Check if the path contains omnetpp/bin (it should)
1349
# Note: the method used here also works with Cygwin, but requires
1350
# write permission to $OMNETPP_BIN_DIR.
1351
#----------------------
1352
1353
# first we need to expand the ${HOME} variable and make sure the dir exists..
1354
omnetpp_bin_dir=`eval echo $OMNETPP_BIN_DIR`
1355
if test ! -d $omnetpp_bin_dir; then
1356
   echo "PROBLEM: the $OMNETPP_BIN_DIR directory does not exist!"
1357
else
1358
  # ...then we create a small tmp file to check if the dir is in the path
1359
  probefile=__probe__
1360
  echo '' >$omnetpp_bin_dir/$probefile
1361
  chmod +x  $omnetpp_bin_dir/$probefile
1362
  if ($probefile) >/dev/null 2>/dev/null; then
1363
    echo "Your PATH contains $OMNETPP_BIN_DIR. Good!"
1364
  else
1365
    if test "$cygwin" = yes; then
1366
      opp_bin_dir=`cygpath -u $OMNETPP_BIN_DIR`
1367
      if test -z "$opp_bin_dir"; then opp_bin_dir=$OMNETPP_BIN_DIR; fi
1368
      cat 1>&2 << EOT
1369
1370
WARNING: your PATH doesn't contain $opp_bin_dir!
1371
Add the following line to your startup file, $HOME/.bash_profile:
1372
  export PATH=\$PATH:$opp_bin_dir
1373
1374
EOT
1375
    else
1376
      cat 1>&2 << EOT
1377
1378
WARNING: your PATH doesn't contain $OMNETPP_BIN_DIR!
1379
Add the following line to your .profile or .bash_profile (provided you use bash):
1380
  export PATH=\$PATH:$OMNETPP_BIN_DIR
1381
1382
EOT
1383
    fi
1384
  fi
1385
  rm $omnetpp_bin_dir/$probefile
1386
fi
1387
1388
#----------------------
1389
# Check if the rpath option is unsupported. in this warn the user to provide the LD_LIBRARY_PATH variable
1390
#----------------------
1391
if test -n "$RPATH_UNSUPPORTED"; then
1392
1393
    cat 1>&2 << EOT
1394
1395
WARNING: Your linker does not support the -rpath option.
1396
  You must set the LD_LIBRARY_PATH environment variable to point
1397
  to the directory where your shared libraries can be found.
1398
1399
Add the following line to your .profile or .bash_profile (provided you use bash):
1400
  export LD_LIBRARY_PATH=$OMNETPP_ROOT/lib:\$LD_LIBRARY_PATH
1401
EOT
1402
1403
fi
1404
1405
#----------------------
1406
# Check if TCL_LIBRARY is set.
1407
#----------------------
1408
1409
if test -n "$NO_TCL"; then
1410
1411
    cat << EOT
1412
1413
$OMNETPP_PRODUCT was configured without Tcl/Tk (\$NO_TCL set). Tkenv (the GUI
1414
runtime environment) will not be available, simulations need to be run
1415
under Cmdenv.
1416
EOT
1417
1418
elif test "$PLATFORM" = "macosx"; then
1419
    :
1420
elif test -z "$TCL_LIBRARY"; then
1421
1422
    cat 1>&2 << EOT
1423
1424
WARNING: The TCL_LIBRARY environment variable is not set, and without it
1425
Tkenv (the GUI runtime environment) may be unable to find the BLT library.
1426
1427
Add the following line to your .profile or .bash_profile (provided you use bash):
1428
  export TCL_LIBRARY=$tcl_library
1429
1430
For additional information, please visit the "Common installation problems"
1431
page on www.omnetpp.org.
1432
EOT
1433
1434
elif test ! -f "$TCL_LIBRARY/init.tcl" -a ! -f "$TCL_LIBRARY/tclConfig.sh"; then
1435
1436
    cat 1>&2 << EOT
1437
1438
WARNING: Your TCL_LIBRARY variable seems to be set incorrectly: there is no
1439
init.tcl or tclConfig.sh file in that directory. (Usual TCL_LIBRARY is /usr/lib/tcl8.4.)
1440
EOT
1441
1442
else
1443
    echo
1444
    echo "TCL_LIBRARY is set. Good!"
1445
fi