1 # Process this file with autoconf to produce a configure script.
6 # check for some programs we use
9 # save the CFLAGS and CXXFLAGS specified by the user
15 # restore the flags specified by the user and get rid of any flags
16 # found by autoconf (we do not want -02 -g by default)
23 # check for X11 support
26 if test "$no_x"a = a; then
31 # get byte swapping info
33 if test $ac_cv_c_bigendian = yes; then
34 CMAKE_WORDS_BIGENDIAN=1
36 AC_SUBST(CMAKE_WORDS_BIGENDIAN)
39 # Step 1: set the variable "system" to hold the name and version number
40 # for the system. This can usually be done via the "uname" command, but
41 # there are a few systems, like Next, where this doesn't work.
43 AC_MSG_CHECKING([system version (for dynamic loading)])
44 if test -f /usr/lib/NextStep/software_version; then
45 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
47 system=`uname -s`-`uname -r`
48 if test "$?" -ne 0 ; then
49 AC_MSG_RESULT([unknown (can't find uname command)])
52 # Special check for weird MP-RAS system (uname returns weird
53 # results, and the version is kept in special file).
55 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
56 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
58 AC_MSG_RESULT($system)
68 # the following is an excerpt from the tcl7.5b2 configure.in
69 #--------------------------------------------------------------------
70 # The statements below define a collection of symbols related to
71 # dynamic loading and shared libraries:
73 # CMAKE_SHLIB_CFLAGS - Flags to pass to cc when compiling the components
74 # of a shared library (may request position-independent
75 # code, among other things).
76 # CMAKE_SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
77 # creating shared libraries. This symbol typically
78 # goes at the end of the "ld" commands that build
79 # shared libraries. The value of the symbol if
80 # "${LIBS}" if all of the dependent libraries should
81 # be specified when creating a shared library. If
82 # dependent libraries should not be specified (as on
83 # SunOS 4.x, where they cause the link to fail, or in
84 # general if Tcl and Tk aren't themselves shared
85 # libraries), then this symbol has an empty string
87 # CMAKE_SHLIB_SUFFIX - Suffix to use for the name of the shared library. An
88 # empty string means we don't know how to use shared
89 # libraries on this platform.
90 # CMAKE_SHLIB_BUILD_FLAGS -
91 # Flags to use when building a shared library.
92 # CMAKE_SHLIB_LINK_FLAGS -
93 # Flags to pass to the compiler when linking object
94 # files into an executable application binary such
96 # CMAKE_SHLIB_RUNTIME_FLAG -
97 # Flag used to specify the runtime directories (e.g. "-R" or
98 # "-Wl,-rpath,"). If null, no attempt is make to specify the
100 # CMAKE_SHLIB_RUNTIME_SEP -
101 # If null, then each path is a separate argument. If not null,
102 # then all the directories are joined together, separated by
103 # $(CMAKE_SHLIB_RUNTIME_SEP) and appended to
104 # $(CMAKE_SHLIB_RUNTIME_FLAG). When not null, this is
105 # typically a colon ":".
106 #--------------------------------------------------------------------
109 # Step 2: check for existence of -ldl library. This is needed because
110 # Linux can use either -ldl or -ldld for dynamic loading.
112 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
114 # Step 4: set configuration options based on system name and version.
116 CMAKE_C_LINK_SHARED=${CC}
117 fullSrcDir=`cd $srcdir; pwd`
121 # AIX: can't link shared library extensions unless Tcl and Tk are
122 # also shared libraries.
123 CMAKE_SHLIB_CFLAGS=""
124 CMAKE_SHLIB_LD_LIBS='${LIBS}'
125 CMAKE_SHLIB_SUFFIX="..o"
126 CMAKE_MODULE_SUFFIX="..o"
128 AC_CHECK_LIB(ld,printf, CMAKE_DL_LIBS="-lld")
129 CMAKE_SHLIB_LINK_FLAGS=""
130 CMAKE_MODULE_LINK_FLAGS=""
131 CMAKE_SHLIB_RUNTIME_FLAG=""
132 CMAKE_SHLIB_RUNTIME_SEP=""
133 if test $ac_cv_prog_gcc = yes; then
134 CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-G'
135 CMAKE_MODULE_BUILD_FLAGS='-shared -Wl,-G'
136 CMAKE_SHLIB_LINK_FLAGS='-Wl,-brtl'
137 CMAKE_MODULE_LINK_FLAGS='-Wl,-brtl'
138 CMAKE_MODULE_SUFFIX=".so"
139 CMAKE_SHLIB_SUFFIX=".so"
143 CMAKE_SHLIB_CFLAGS=""
144 CMAKE_SHLIB_LD_LIBS=""
145 CMAKE_SHLIB_SUFFIX=".dylib"
146 CMAKE_MODULE_SUFFIX=".so"
148 CMAKE_SHLIB_BUILD_FLAGS="-dynamiclib"
149 CMAKE_SHLIB_LINK_FLAGS=""
150 CMAKE_MODULE_BUILD_FLAGS="-bundle -flat_namespace -undefined suppress"
151 CMAKE_MODULE_LINK_FLAGS=""
152 CMAKE_SHLIB_RUNTIME_FLAG=""
153 CMAKE_SHLIB_RUNTIME_SEP=":"
156 CMAKE_C_LINK_SHARED=ld
157 CMAKE_SHLIB_CFLAGS="+Z"
158 CMAKE_SHLIB_LD_LIBS=""
159 CMAKE_SHLIB_SUFFIX=".sl"
160 CMAKE_MODULE_SUFFIX=".sl"
161 CMAKE_DL_LIBS="-ldld"
162 CMAKE_SHLIB_BUILD_FLAGS='-E -b -L/usr/lib'
163 CMAKE_SHLIB_LINK_FLAGS='+s'
164 CMAKE_MODULE_BUILD_FLAGS='-E -b -L/usr/lib'
165 CMAKE_MODULE_LINK_FLAGS='+s'
166 CMAKE_SHLIB_RUNTIME_FLAG='+b,'
167 CMAKE_SHLIB_RUNTIME_SEP=':'
168 if test $ac_cv_prog_gcc = yes; then
169 CMAKE_C_LINK_SHARED=${CC}
170 CMAKE_SHLIB_CFLAGS="-fPIC"
171 CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-E -Wl,-b'
172 CMAKE_SHLIB_LINK_FLAGS='-Wl,+s'
173 CMAKE_MODULE_BUILD_FLAGS='-shared -Wl,-E -Wl,-b'
174 CMAKE_MODULE_LINK_FLAGS='-Wl,+s'
175 CMAKE_SHLIB_RUNTIME_FLAG='-Wl,+b,'
176 CMAKE_SHLIB_RUNTIME_SEP=':'
180 CMAKE_SHLIB_CFLAGS=""
181 CMAKE_SHLIB_LD_LIBS=""
182 CMAKE_SHLIB_SUFFIX=".so"
183 CMAKE_MODULE_SUFFIX=".so"
185 CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared"
186 CMAKE_MODULE_BUILD_FLAGS="-shared -rdata_shared"
187 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
188 CMAKE_SHLIB_RUNTIME_SEP=""
190 IRIX-6* | IRIX64-6* | IRIX-64-6*)
191 CMAKE_SHLIB_CFLAGS=""
192 CMAKE_SHLIB_LD_LIBS=""
193 CMAKE_SHLIB_SUFFIX=".so"
194 CMAKE_MODULE_SUFFIX=".so"
196 CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared"
197 CMAKE_MODULE_BUILD_FLAGS="-shared -rdata_shared"
198 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
199 CMAKE_SHLIB_RUNTIME_SEP=""
202 CMAKE_SHLIB_CFLAGS="-fPIC"
203 CMAKE_SHLIB_LD_LIBS=""
204 CMAKE_SHLIB_SUFFIX=".so"
205 CMAKE_MODULE_SUFFIX=".so"
206 CMAKE_SHLIB_BUILD_FLAGS="-shared"
207 CMAKE_MODULE_BUILD_FLAGS="-shared"
208 if test "$have_dl" = yes; then
210 CMAKE_SHLIB_LINK_FLAGS="-rdynamic"
211 CMAKE_MODULE_LINK_FLAGS="-rdynamic"
212 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
213 CMAKE_SHLIB_RUNTIME_SEP=":"
215 AC_CHECK_HEADER(dld.h, [
216 CMAKE_DL_LIBS="-ldld"
217 CMAKE_SHLIB_LINK_FLAGS=""
218 CMAKE_MODULE_LINK_FLAGS=""
219 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
220 CMAKE_SHLIB_RUNTIME_SEP=""])
224 CMAKE_SHLIB_CFLAGS=""
225 CMAKE_DL_LIBS="-lgdi32"
226 CMAKE_SHLIB_BUILD_FLAGS="-shared"
227 CMAKE_MODULE_BUILD_FLAGS="-shared"
228 CMAKE_SHLIB_SUFFIX=".dll"
229 CMAKE_MODULE_SUFFIX=".dll"
230 CMAKE_SHLIB_LINK_FLAGS=""
231 CMAKE_MODULE_LINK_FLAGS=""
232 CMAKE_SHLIB_RUNTIME_FLAG=""
233 CMAKE_SHLIB_RUNTIME_SEP=""
236 CMAKE_SHLIB_CFLAGS="-K PIC"
237 CMAKE_SHLIB_LD_LIBS=""
238 CMAKE_SHLIB_SUFFIX=".so"
239 CMAKE_MODULE_SUFFIX=".so"
241 CMAKE_SHLIB_LINK_FLAGS=""
242 CMAKE_MODULE_LINK_FLAGS=""
243 CMAKE_SHLIB_RUNTIME_FLAG=""
244 CMAKE_SHLIB_RUNTIME_SEP=""
247 CMAKE_SHLIB_CFLAGS="-K PIC"
248 CMAKE_SHLIB_LD_LIBS=""
249 CMAKE_SHLIB_SUFFIX=".so"
250 CMAKE_MODULE_SUFFIX=".so"
252 CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport"
253 CMAKE_MODULE_LINK_FLAGS="-Wl,-Bexport"
254 CMAKE_SHLIB_RUNTIME_FLAG=""
255 CMAKE_SHLIB_RUNTIME_SEP=""
258 # Not available on all versions: check for include file.
259 if test -f /usr/include/dlfcn.h; then
260 CMAKE_SHLIB_CFLAGS="-fPIC"
261 CMAKE_SHLIB_LD_LIBS=""
262 CMAKE_SHLIB_SUFFIX=".so"
263 CMAKE_MODULE_SUFFIX=".so"
265 CMAKE_SHLIB_BUILD_FLAGS="-shared"
266 CMAKE_SHLIB_LINK_FLAGS=""
267 CMAKE_MODULE_BUILD_FLAGS="-shared"
268 CMAKE_MODULE_LINK_FLAGS=""
269 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
270 CMAKE_SHLIB_RUNTIME_SEP=":"
272 CMAKE_SHLIB_CFLAGS=""
273 CMAKE_SHLIB_LD_LIBS=""
274 CMAKE_SHLIB_SUFFIX="..o"
275 CMAKE_MODULE_SUFFIX="..o"
277 CMAKE_SHLIB_LINK_FLAGS=""
278 CMAKE_MODULE_LINK_FLAGS=""
279 CMAKE_SHLIB_RUNTIME_FLAG=""
280 CMAKE_SHLIB_RUNTIME_SEP=""
284 CMAKE_SHLIB_CFLAGS=""
285 CMAKE_SHLIB_LD_LIBS=""
286 CMAKE_SHLIB_SUFFIX=".so"
287 CMAKE_MODULE_SUFFIX=".so"
289 CMAKE_SHLIB_LINK_FLAGS=""
290 CMAKE_MODULE_LINK_FLAGS=""
291 CMAKE_SHLIB_RUNTIME_FLAG=""
292 CMAKE_SHLIB_RUNTIME_SEP=""
295 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
296 CMAKE_SHLIB_CFLAGS=""
297 # Hack: make package name same as library name
298 CMAKE_SHLIB_LD_LIBS=""
299 CMAKE_SHLIB_SUFFIX=".so"
300 CMAKE_MODULE_SUFFIX=".so"
302 CMAKE_SHLIB_LINK_FLAGS=""
303 CMAKE_MODULE_LINK_FLAGS=""
304 CMAKE_SHLIB_RUNTIME_FLAG=""
305 CMAKE_SHLIB_RUNTIME_SEP=""
308 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
309 CMAKE_SHLIB_CFLAGS="-fpic"
310 CMAKE_SHLIB_LD_LIBS=""
311 CMAKE_SHLIB_SUFFIX=".so"
312 CMAKE_MODULE_SUFFIX=".so"
314 CMAKE_SHLIB_LINK_FLAGS=""
315 CMAKE_MODULE_LINK_FLAGS=""
316 CMAKE_SHLIB_RUNTIME_FLAG=""
317 CMAKE_SHLIB_RUNTIME_SEP=""
321 CMAKE_SHLIB_CFLAGS=""
322 CMAKE_SHLIB_LD_LIBS=""
323 CMAKE_SHLIB_SUFFIX=".so"
324 CMAKE_MODULE_SUFFIX=".so"
326 CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,\\*'
327 CMAKE_SHLIB_LINK_FLAGS=''
328 CMAKE_MODULE_BUILD_FLAGS='-shared -Wl,-expect_unresolved,\\*'
329 CMAKE_MODULE_LINK_FLAGS=''
330 if test $ac_cv_prog_gcc = yes; then
331 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
333 CMAKE_SHLIB_RUNTIME_FLAG="-rpath "
335 CMAKE_SHLIB_RUNTIME_SEP=":"
338 CMAKE_SHLIB_CFLAGS="-G 0"
339 CMAKE_SHLIB_LD_LIBS=""
340 CMAKE_SHLIB_SUFFIX="..o"
341 CMAKE_MODULE_SUFFIX="..o"
343 CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000"
344 CMAKE_MODULE_LINK_FLAGS="-Wl,-D,08000000"
345 CMAKE_SHLIB_RUNTIME_FLAG=""
346 CMAKE_SHLIB_RUNTIME_SEP=""
349 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
350 # this test works, since "uname -s" was non-standard in 3.2.4 and
352 CMAKE_SHLIB_CFLAGS="-Kpic -belf"
353 CMAKE_SHLIB_LD_LIBS=""
354 CMAKE_SHLIB_SUFFIX=".so"
355 CMAKE_MODULE_SUFFIX=".so"
357 CMAKE_SHLIB_LINK_FLAGS="-belf -Wl,-Bexport"
358 CMAKE_SHLIB_MODULE_FLAGS="-belf -Wl,-Bexport"
359 CMAKE_SHLIB_RUNTIME_FLAG=""
360 CMAKE_SHLIB_RUNTIME_SEP=""
363 CMAKE_SHLIB_CFLAGS="-K PIC"
364 CMAKE_SHLIB_LD_LIBS=""
365 CMAKE_SHLIB_SUFFIX=".so"
366 CMAKE_MODULE_SUFFIX=".so"
368 CMAKE_SHLIB_LINK_FLAGS=""
369 CMAKE_MODULE_LINK_FLAGS=""
370 CMAKE_SHLIB_RUNTIME_FLAG=""
371 CMAKE_SHLIB_RUNTIME_SEP=""
374 CMAKE_SHLIB_CFLAGS="-PIC"
375 CMAKE_SHLIB_LD_LIBS=""
376 CMAKE_SHLIB_SUFFIX=".so"
377 CMAKE_MODULE_SUFFIX=".so"
379 CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-r -nostdlib'
380 CMAKE_SHLIB_LINK_FLAGS=''
381 CMAKE_MODULE_BUILD_FLAGS='-shared -Wl,-r -nostdlib'
382 CMAKE_MODULE_LINK_FLAGS=''
383 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-R,"
384 CMAKE_SHLIB_RUNTIME_SEP=":"
387 CMAKE_SHLIB_CFLAGS="-KPIC"
388 CMAKE_SHLIB_LD_LIBS='${LIBS}'
389 CMAKE_SHLIB_SUFFIX=".so"
390 CMAKE_MODULE_SUFFIX=".so"
392 CMAKE_SHLIB_BUILD_FLAGS='-G'
393 CMAKE_SHLIB_LINK_FLAGS=''
394 CMAKE_MODULE_BUILD_FLAGS='-G'
395 CMAKE_MODULE_LINK_FLAGS=''
396 CMAKE_SHLIB_RUNTIME_FLAG="-R "
397 CMAKE_SHLIB_RUNTIME_SEP=":"
398 if test $ac_cv_prog_gcc = yes; then
399 CMAKE_SHLIB_BUILD_FLAGS='-shared -nostdlib'
400 CMAKE_SHLIB_LINK_FLAGS=''
401 CMAKE_MODULE_BUILD_FLAGS='-shared -nostdlib'
402 CMAKE_MODULE_LINK_FLAGS=''
403 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-R,"
404 CMAKE_SHLIB_RUNTIME_SEP=":"
408 CMAKE_SHLIB_CFLAGS="-G 0"
409 CMAKE_SHLIB_SUFFIX="..o"
410 CMAKE_MODULE_SUFFIX="..o"
411 CMAKE_SHLIB_LD_LIBS=""
413 CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000"
414 CMAKE_MODULE_LINK_FLAGS="-Wl,-D,08000000"
415 CMAKE_SHLIB_RUNTIME_FLAG=""
416 CMAKE_SHLIB_RUNTIME_SEP=""
419 CMAKE_SHLIB_CFLAGS="-K PIC"
420 CMAKE_SHLIB_LD_LIBS=""
421 CMAKE_SHLIB_SUFFIX=".so"
422 CMAKE_MODULE_SUFFIX=".so"
424 CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport"
425 CMAKE_MODULE_LINK_FLAGS="-Wl,-Bexport"
426 CMAKE_SHLIB_RUNTIME_FLAG=""
427 CMAKE_SHLIB_RUNTIME_SEP=""
430 export CMAKE_SHLIB_SUFFIX
431 export CMAKE_MODULE_SUFFIX
433 # If we're running gcc, then change the C flags for compiling shared
434 # libraries to the right flags for gcc, instead of those for the
435 # standard manufacturer compiler.
436 if test $ac_cv_prog_gcc = yes; then
437 CMAKE_SHLIB_CFLAGS="-fPIC"
439 # if running on cygwin, AIX, or Darwin remove -fPIC flag
442 CMAKE_SHLIB_CFLAGS=""
445 CMAKE_SHLIB_CFLAGS=""
447 Darwin*) #don't need -fPIC on Darwin (on by default)
448 CMAKE_SHLIB_CFLAGS=""
452 # If the user has supplied C flags for compiling shared objects, use
454 if test "${SHLIB_CFLAGS}" != ""; then
455 CMAKE_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
457 CMAKE_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
459 AC_SUBST(CMAKE_C_LINK_SHARED)
460 AC_SUBST(CMAKE_SHLIB_LINK_FLAGS)
461 AC_SUBST(CMAKE_SHLIB_BUILD_FLAGS)
462 AC_SUBST(CMAKE_MODULE_LINK_FLAGS)
463 AC_SUBST(CMAKE_MODULE_BUILD_FLAGS)
464 AC_SUBST(CMAKE_SHLIB_CFLAGS)
465 AC_SUBST(CMAKE_DL_LIBS)
466 AC_SUBST(CMAKE_SHLIB_LD_LIBS)
467 AC_SUBST(CMAKE_SHLIB_SUFFIX)
468 AC_SUBST(CMAKE_MODULE_SUFFIX)
469 AC_SUBST(CMAKE_SHLIB_RUNTIME_FLAG)
470 AC_SUBST(CMAKE_SHLIB_RUNTIME_SEP)
473 ##########################
475 ## Check thread support ##
477 ##########################
478 # initialize thread vars
485 ##########################
489 ##########################
493 [ --with-sproc use sproc instead of pthreads if possible],
494 if test "$withval" = yes; then
500 AC_CHECK_HEADERS(sys/prctl.h, [use_sproc=yes])
501 if test "$use_sproc" = "yes"; then
503 Linux* | IRIX64-6.5 | IRIX-6.5)
504 if test "$force_sproc" = "yes"; then
516 AC_CHECK_HEADERS(pthread.h, [use_pthreads=yes])
517 if test "$use_pthreads" = "yes"; then
518 if test "$use_sproc" = "no"; then
519 AC_CHECK_LIB(pthreads, pthread_create, CMAKE_THREAD_LIBS="-lpthreads")
520 AC_CHECK_LIB(pthread, pthread_create, CMAKE_THREAD_LIBS="-lpthread")
521 # Work around Solaris 5.6 and 5.7 bug:
522 if test "`uname -s -r`" = "SunOS 5.6"; then
523 AC_CHECK_LIB(thread, thr_create, CMAKE_THREAD_LIBS="$CMAKE_THREAD_LIBS -lthread")
525 if test "`uname -s -r`" = "SunOS 5.7"; then
526 AC_CHECK_LIB(thread, thr_create, CMAKE_THREAD_LIBS="$CMAKE_THREAD_LIBS -lthread")
532 # on an HP with pthread we need to use -lcma
533 # on dec alphas we have had problems as well
534 if test "$use_pthreads" = "yes"; then
537 CMAKE_THREAD_LIBS="-lcma"
551 CMAKE_USE_WIN32_THREADS=0
557 AC_SUBST(CMAKE_USE_SPROC)
558 AC_SUBST(CMAKE_USE_PTHREADS)
559 AC_SUBST(CMAKE_USE_WIN32_THREADS)
560 AC_SUBST(CMAKE_HP_PTHREADS)
561 AC_SUBST(CMAKE_THREAD_LIBS)
565 # on hp use -Aa for ansi
566 if test $ac_cv_prog_gcc = no; then
571 AC_MSG_CHECKING([whether ${CC} accepts -Aa])
576 CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
580 CFLAGS="$CFLAGS_ORIG"
584 AC_MSG_CHECKING([whether ${CC} accepts -Ae])
589 CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Ae"
593 CFLAGS="$CFLAGS_ORIG"
597 AC_SUBST(CMAKE_ANSI_CFLAGS)
600 if test $ac_cv_prog_gcc = yes; then
604 # find make to use to build cmake, prefer gmake
605 AC_PATH_PROGS(CMAKE_AR_TMP, ar)
606 CMAKE_AR="$CMAKE_AR_TMP"
609 AC_SUBST(CMAKE_AR_ARGS)
612 CMAKE_SYSTEM="$system"
613 AC_SUBST(CMAKE_SYSTEM)
614 # generate output files.
615 # create mkdir files just to make some of the directories
617 AC_OUTPUT( CCMakeSystemConfig.cmake )