ENH: mark some vars as advanced (and resort the list)
[cmake.git] / Templates / cconfigure.in
blobffdbe4f94281649d009142afc24faf14dd8117d4
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT()
6 # check for some programs we use
9 # save the CFLAGS and CXXFLAGS specified by the user
10 save_CFLAGS=$CFLAGS
12 AC_PROG_CC
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)
17 CFLAGS=$save_CFLAGS
20 AC_PROG_RANLIB
21 AC_PROG_INSTALL
23 # check for X11 support
24 AC_PATH_XTRA
25 CMAKE_HAS_X=0
26 if test "$no_x"a = a; then
27 CMAKE_HAS_X=1
29 AC_SUBST(CMAKE_HAS_X)
31 # get byte swapping info
32 AC_C_BIGENDIAN
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`
46 else
47     system=`uname -s`-`uname -r`
48     if test "$?" -ne 0 ; then
49         AC_MSG_RESULT([unknown (can't find uname command)])
50         system=unknown
51     else
52         # Special check for weird MP-RAS system (uname returns weird
53         # results, and the version is kept in special file).
54     
55         if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
56             system=MP-RAS-`awk '{print $3}' /etc/.relid'`
57         fi
58         AC_MSG_RESULT($system)
59     fi
63 # use shared libs
67 CMAKE_shared_ok="yes"
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
86 #                       as its value.
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
95 #                       as tclsh.
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
99 #                       runtime paths.
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`
118 AC_SUBST(fullSrcDir)
119 case $system in
120     AIX-*)
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"
127         CMAKE_DL_LIBS=""
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"
140         fi
141         ;;
142     Darwin-*)
143         CMAKE_SHLIB_CFLAGS=""
144         CMAKE_SHLIB_LD_LIBS=""
145         CMAKE_SHLIB_SUFFIX=".dylib"
146         CMAKE_MODULE_SUFFIX=".so"
147         CMAKE_DL_LIBS=""
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=":"
154         ;;
155     HP-UX-*)
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=':'
177         fi
178         ;;
179     IRIX-5.*)
180         CMAKE_SHLIB_CFLAGS=""
181         CMAKE_SHLIB_LD_LIBS=""
182         CMAKE_SHLIB_SUFFIX=".so"
183         CMAKE_MODULE_SUFFIX=".so"
184         CMAKE_DL_LIBS=""
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=""
189         ;;
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"
195         CMAKE_DL_LIBS=""
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=""
200         ;;
201     Linux*)
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
209             CMAKE_DL_LIBS="-ldl"
210             CMAKE_SHLIB_LINK_FLAGS="-rdynamic"
211             CMAKE_MODULE_LINK_FLAGS="-rdynamic"
212             CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
213             CMAKE_SHLIB_RUNTIME_SEP=":"
214         else
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=""])
221         fi
222         ;;
223     CYGWIN_NT*)
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=""
234         ;;
235     MP-RAS-02*)
236         CMAKE_SHLIB_CFLAGS="-K PIC"
237         CMAKE_SHLIB_LD_LIBS=""
238         CMAKE_SHLIB_SUFFIX=".so"
239         CMAKE_MODULE_SUFFIX=".so"
240         CMAKE_DL_LIBS="-ldl"
241         CMAKE_SHLIB_LINK_FLAGS=""
242         CMAKE_MODULE_LINK_FLAGS=""
243         CMAKE_SHLIB_RUNTIME_FLAG=""
244         CMAKE_SHLIB_RUNTIME_SEP=""
245         ;;
246     MP-RAS-*)
247         CMAKE_SHLIB_CFLAGS="-K PIC"
248         CMAKE_SHLIB_LD_LIBS=""
249         CMAKE_SHLIB_SUFFIX=".so"
250         CMAKE_MODULE_SUFFIX=".so"
251         CMAKE_DL_LIBS="-ldl"
252         CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport"
253         CMAKE_MODULE_LINK_FLAGS="-Wl,-Bexport"
254         CMAKE_SHLIB_RUNTIME_FLAG=""
255         CMAKE_SHLIB_RUNTIME_SEP=""
256         ;;
257     NetBSD-*|FreeBSD-*)
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"
264             CMAKE_DL_LIBS=""
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=":"
271         else
272             CMAKE_SHLIB_CFLAGS=""
273             CMAKE_SHLIB_LD_LIBS=""
274             CMAKE_SHLIB_SUFFIX="..o"
275             CMAKE_MODULE_SUFFIX="..o"
276             CMAKE_DL_LIBS=""
277             CMAKE_SHLIB_LINK_FLAGS=""
278             CMAKE_MODULE_LINK_FLAGS=""
279             CMAKE_SHLIB_RUNTIME_FLAG=""
280             CMAKE_SHLIB_RUNTIME_SEP=""
281         fi
282         ;;
283     NEXTSTEP-*)
284         CMAKE_SHLIB_CFLAGS=""
285         CMAKE_SHLIB_LD_LIBS=""
286         CMAKE_SHLIB_SUFFIX=".so"
287         CMAKE_MODULE_SUFFIX=".so"
288         CMAKE_DL_LIBS=""
289         CMAKE_SHLIB_LINK_FLAGS=""
290         CMAKE_MODULE_LINK_FLAGS=""
291         CMAKE_SHLIB_RUNTIME_FLAG=""
292         CMAKE_SHLIB_RUNTIME_SEP=""
293         ;;
294     OSF1-1.[012])
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"
301         CMAKE_DL_LIBS=""
302         CMAKE_SHLIB_LINK_FLAGS=""
303         CMAKE_MODULE_LINK_FLAGS=""
304         CMAKE_SHLIB_RUNTIME_FLAG=""
305         CMAKE_SHLIB_RUNTIME_SEP=""
306         ;;
307     OSF1-1.*)
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"
313         CMAKE_DL_LIBS=""
314         CMAKE_SHLIB_LINK_FLAGS=""
315         CMAKE_MODULE_LINK_FLAGS=""
316         CMAKE_SHLIB_RUNTIME_FLAG=""
317         CMAKE_SHLIB_RUNTIME_SEP=""
318         ;;
319     OSF1-V*)
320         # Digital OSF/1
321         CMAKE_SHLIB_CFLAGS=""
322         CMAKE_SHLIB_LD_LIBS=""
323         CMAKE_SHLIB_SUFFIX=".so"
324         CMAKE_MODULE_SUFFIX=".so"
325         CMAKE_DL_LIBS=""
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,"
332         else
333           CMAKE_SHLIB_RUNTIME_FLAG="-rpath "
334         fi
335         CMAKE_SHLIB_RUNTIME_SEP=":"
336         ;;
337     RISCos-*)
338         CMAKE_SHLIB_CFLAGS="-G 0"
339         CMAKE_SHLIB_LD_LIBS=""
340         CMAKE_SHLIB_SUFFIX="..o"
341         CMAKE_MODULE_SUFFIX="..o"
342         CMAKE_DL_LIBS=""
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=""
347         ;;
348     SCO_SV-3.2*)
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
351         # below.
352         CMAKE_SHLIB_CFLAGS="-Kpic -belf"
353         CMAKE_SHLIB_LD_LIBS=""
354         CMAKE_SHLIB_SUFFIX=".so"
355         CMAKE_MODULE_SUFFIX=".so"
356         CMAKE_DL_LIBS=""
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=""
361         ;;
362      SINIX*5.4*)
363         CMAKE_SHLIB_CFLAGS="-K PIC"
364         CMAKE_SHLIB_LD_LIBS=""
365         CMAKE_SHLIB_SUFFIX=".so"
366         CMAKE_MODULE_SUFFIX=".so"
367         CMAKE_DL_LIBS="-ldl"
368         CMAKE_SHLIB_LINK_FLAGS=""
369         CMAKE_MODULE_LINK_FLAGS=""
370         CMAKE_SHLIB_RUNTIME_FLAG=""
371         CMAKE_SHLIB_RUNTIME_SEP=""
372         ;;
373     SunOS-4*)
374         CMAKE_SHLIB_CFLAGS="-PIC"
375         CMAKE_SHLIB_LD_LIBS=""
376         CMAKE_SHLIB_SUFFIX=".so"
377         CMAKE_MODULE_SUFFIX=".so"
378         CMAKE_DL_LIBS="-ldl"
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=":"
385         ;;
386     SunOS-5*)
387         CMAKE_SHLIB_CFLAGS="-KPIC"
388         CMAKE_SHLIB_LD_LIBS='${LIBS}'
389         CMAKE_SHLIB_SUFFIX=".so"
390         CMAKE_MODULE_SUFFIX=".so"
391         CMAKE_DL_LIBS="-ldl"
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=":"
405         fi
406         ;;
407     ULTRIX-4.*)
408         CMAKE_SHLIB_CFLAGS="-G 0"
409         CMAKE_SHLIB_SUFFIX="..o"
410         CMAKE_MODULE_SUFFIX="..o"
411         CMAKE_SHLIB_LD_LIBS=""
412         CMAKE_DL_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=""
417         ;;
418     UNIX_SV*)
419         CMAKE_SHLIB_CFLAGS="-K PIC"
420         CMAKE_SHLIB_LD_LIBS=""
421         CMAKE_SHLIB_SUFFIX=".so"
422         CMAKE_MODULE_SUFFIX=".so"
423         CMAKE_DL_LIBS="-ldl"
424         CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport"
425         CMAKE_MODULE_LINK_FLAGS="-Wl,-Bexport"
426         CMAKE_SHLIB_RUNTIME_FLAG=""
427         CMAKE_SHLIB_RUNTIME_SEP=""
428         ;;
429 esac
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
440 case $system in 
441   AIX-*)
442     CMAKE_SHLIB_CFLAGS=""
443     ;;
444   CYGWIN_NT*)
445     CMAKE_SHLIB_CFLAGS=""
446     ;;
447   Darwin*) #don't need -fPIC on Darwin (on by default)
448     CMAKE_SHLIB_CFLAGS=""
449     ;;
450 esac
452 # If the user has supplied C flags for compiling shared objects, use
453 # those instead
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 ##########################
474 ##                      ##
475 ## Check thread support ##
476 ##                      ##
477 ##########################
478 # initialize thread vars
479 CMAKE_THREAD_LIBS=""
480 use_sproc=no
481 CMAKE_USE_SPROC=0
482 CMAKE_USE_PTHREADS=0
483 CMAKE_HP_PTHREADS=0
485 ##########################
486 ##                      ##
487 ##      sproc           ##
488 ##                      ##
489 ##########################
490 # check for sproc
491 force_sproc=no
492 AC_ARG_WITH(sproc,
493          [  --with-sproc           use sproc instead of pthreads if possible],
494          if test "$withval" = yes; then
495          force_sproc=yes
496          fi,)
500 AC_CHECK_HEADERS(sys/prctl.h, [use_sproc=yes])
501 if test "$use_sproc" = "yes"; then
502 case $system in
503     Linux* | IRIX64-6.5 | IRIX-6.5) 
504         if test "$force_sproc" = "yes"; then
505            CMAKE_USE_SPROC=1
506         else
507           use_sproc=no
508         fi
509         ;;
510     IRIX*)
511         CMAKE_USE_SPROC=1
512         ;;
513 esac
515 use_pthreads=no
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")
524     fi
525     if test "`uname -s -r`" = "SunOS 5.7"; then
526       AC_CHECK_LIB(thread, thr_create, CMAKE_THREAD_LIBS="$CMAKE_THREAD_LIBS -lthread")
527     fi
528         CMAKE_USE_PTHREADS=1
529   fi
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
535 case $system in
536     HP-UX-*)
537         CMAKE_THREAD_LIBS="-lcma"
538         CMAKE_USE_PTHREADS=1 
539         CMAKE_HP_PTHREADS=1
540         ;;
541     OSF1-V*)
542         CMAKE_USE_PTHREADS=0
543         CMAKE_THREAD_LIBS=""
544         ;;
545     FreeBSD*)
546         CMAKE_USE_PTHREADS=0
547         CMAKE_THREAD_LIBS=""
548         ;;   
549     CYGWIN_NT*)
550         CMAKE_THREAD_LIBS=""
551         CMAKE_USE_WIN32_THREADS=0
552         CMAKE_USE_PTHREADS=1
553         ;;
554 esac
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)
564 CMAKE_ANSI_CFLAGS=""
565 # on hp use -Aa for ansi
566 if test $ac_cv_prog_gcc = no; then
567 case $system in
568     HP-UX-*)
569         CFLAGS_ORIG="$FLAGS"
570         CFLAGS="-Aa $CFLAGS"
571         AC_MSG_CHECKING([whether ${CC} accepts -Aa])
572         AC_TRY_COMPILE([
573         void foo() {}
574         ],,[
575         AC_MSG_RESULT(yes)
576         CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
577         ],[
578         AC_MSG_RESULT(no)
579         ])
580         CFLAGS="$CFLAGS_ORIG"
582         CFLAGS_ORIG="$FLAGS"
583         CFLAGS="-Ae $CFLAGS"
584         AC_MSG_CHECKING([whether ${CC} accepts -Ae])
585         AC_TRY_COMPILE([
586         void foo() {}
587         ],,[
588         AC_MSG_RESULT(yes)
589         CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Ae"
590         ],[
591         AC_MSG_RESULT(no)
592         ])
593         CFLAGS="$CFLAGS_ORIG"
594         ;;   
595 esac
597 AC_SUBST(CMAKE_ANSI_CFLAGS)
600 if test $ac_cv_prog_gcc = yes; then
601   SHLIB_CFLAGS="-fPIC"
604 # find make to use to build cmake, prefer gmake
605 AC_PATH_PROGS(CMAKE_AR_TMP, ar)
606 CMAKE_AR="$CMAKE_AR_TMP"
607 CMAKE_AR_ARGS="cr"
608 AC_SUBST(CMAKE_AR)
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 )