FIX: stupid pb fixed (close to being medieval'ed by The Ken)
[cmake.git] / Templates / cconfigure.in
blob6edc469e010b60470e25da45409de1f0f3df2a27
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 AC_CHECK_SIZEOF(int, 4)
24 CMAKE_SIZEOF_INT=$ac_cv_sizeof_int
25 AC_SUBST(CMAKE_SIZEOF_INT)
26 AC_CHECK_SIZEOF(long, 4)
27 CMAKE_SIZEOF_LONG=$ac_cv_sizeof_long
28 AC_SUBST(CMAKE_SIZEOF_LONG)
29 AC_CHECK_SIZEOF(void *, 4)
30 CMAKE_SIZEOF_VOID_P=$ac_cv_sizeof_void_p
31 AC_SUBST(CMAKE_SIZEOF_VOID_P)
32 AC_CHECK_SIZEOF(char, 1)
33 CMAKE_SIZEOF_CHAR=$ac_cv_sizeof_char
34 AC_SUBST(CMAKE_SIZEOF_CHAR)
35 AC_CHECK_SIZEOF(short, 2)
36 CMAKE_SIZEOF_SHORT=$ac_cv_sizeof_short
37 AC_SUBST(CMAKE_SIZEOF_SHORT)
38 AC_CHECK_SIZEOF(float, 4)
39 CMAKE_SIZEOF_FLOAT=$ac_cv_sizeof_float
40 AC_SUBST(CMAKE_SIZEOF_FLOAT)
41 AC_CHECK_SIZEOF(double, 8)
42 CMAKE_SIZEOF_DOUBLE=$ac_cv_sizeof_double
43 AC_SUBST(CMAKE_SIZEOF_DOUBLE)
45 # check for X11 support
46 AC_PATH_XTRA
47 CMAKE_HAS_X=0
48 if test "$no_x"a = a; then
49 CMAKE_HAS_X=1
51 AC_SUBST(CMAKE_HAS_X)
53 # get byte swapping info
54 AC_C_BIGENDIAN
55 if test $ac_cv_c_bigendian = yes; then
56   CMAKE_WORDS_BIGENDIAN=1
58 AC_SUBST(CMAKE_WORDS_BIGENDIAN)
61 # some stuff Tcl uses
63 AC_CHECK_HEADER(limits.h, HAVE_LIMITS_H=-DHAVE_LIMITS_H,HAVE_LIMITS_H="")
64 AC_SUBST(CMAKE_HAVE_LIMITS_H)
65 AC_HAVE_HEADERS(unistd.h, HAVE_UNISTD_H=-DHAVE_UNISTD_H,HAVE_UNISTD_H="")
66 AC_SUBST(CMAKE_HAVE_UNISTD_H)
68 # Step 1: set the variable "system" to hold the name and version number
69 # for the system.  This can usually be done via the "uname" command, but
70 # there are a few systems, like Next, where this doesn't work.
72 AC_MSG_CHECKING([system version (for dynamic loading)])
73 if test -f /usr/lib/NextStep/software_version; then
74   system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
75 else
76     system=`uname -s`-`uname -r`
77     if test "$?" -ne 0 ; then
78         AC_MSG_RESULT([unknown (can't find uname command)])
79         system=unknown
80     else
81         # Special check for weird MP-RAS system (uname returns weird
82         # results, and the version is kept in special file).
83     
84         if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
85             system=MP-RAS-`awk '{print $3}' /etc/.relid'`
86         fi
87         AC_MSG_RESULT($system)
88     fi
92 # use shared libs
96 CMAKE_shared_ok="yes"
97 # the following is an excerpt from the tcl7.5b2 configure.in
98 #--------------------------------------------------------------------
99 #       The statements below define a collection of symbols related to
100 #       dynamic loading and shared libraries:
102 #       CMAKE_SHLIB_CFLAGS -    Flags to pass to cc when compiling the components
103 #                       of a shared library (may request position-independent
104 #                       code, among other things).
105 #       CMAKE_SHLIB_LD_LIBS -   Dependent libraries for the linker to scan when
106 #                       creating shared libraries.  This symbol typically
107 #                       goes at the end of the "ld" commands that build
108 #                       shared libraries. The value of the symbol if
109 #                       "${LIBS}" if all of the dependent libraries should
110 #                       be specified when creating a shared library.  If
111 #                       dependent libraries should not be specified (as on
112 #                       SunOS 4.x, where they cause the link to fail, or in
113 #                       general if Tcl and Tk aren't themselves shared
114 #                       libraries), then this symbol has an empty string
115 #                       as its value.
116 #       CMAKE_SHLIB_SUFFIX -    Suffix to use for the name of the shared library.  An
117 #                       empty string means we don't know how to use shared
118 #                       libraries on this platform.
119 #       CMAKE_SHLIB_BUILD_FLAGS -
120 #                       Flags to use when building a shared library.    
121 #       CMAKE_SHLIB_LINK_FLAGS -        
122 #                       Flags to pass to the compiler when linking object
123 #                       files into an executable application binary such
124 #                       as tclsh.
125 #       CMAKE_SHLIB_RUNTIME_FLAG -
126 #                       Flag used to specify the runtime directories (e.g. "-R" or
127 #                       "-Wl,-rpath,"). If null, no attempt is make to specify the
128 #                       runtime paths.
129 #       CMAKE_SHLIB_RUNTIME_SEP -
130 #                       If null, then each path is a separate argument. If not null,
131 #                       then all the directories are joined together, separated by
132 #                       $(CMAKE_SHLIB_RUNTIME_SEP) and appended to
133 #                       $(CMAKE_SHLIB_RUNTIME_FLAG). When not null, this is
134 #                       typically a colon ":".
135 #--------------------------------------------------------------------
138 # Step 2: check for existence of -ldl library.  This is needed because
139 # Linux can use either -ldl or -ldld for dynamic loading.
141 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
143 # Step 4: set configuration options based on system name and version.
145 CMAKE_C_LINK_SHARED=${CC}
146 fullSrcDir=`cd $srcdir; pwd`
147 AC_SUBST(fullSrcDir)
148 case $system in
149     AIX-*)
150         # AIX: can't link shared library extensions unless Tcl and Tk are
151         # also shared libraries.
152         CMAKE_SHLIB_CFLAGS=""
153         CMAKE_SHLIB_LD_LIBS='${LIBS}'
154         CMAKE_SHLIB_SUFFIX="..o"
155         CMAKE_MODULE_SUFFIX="..o"
156         CMAKE_DL_LIBS=""
157         AC_CHECK_LIB(ld,printf, CMAKE_DL_LIBS="-lld")
158         CMAKE_SHLIB_LINK_FLAGS=""
159         CMAKE_MODULE_LINK_FLAGS=""
160         CMAKE_SHLIB_RUNTIME_FLAG=""
161         CMAKE_SHLIB_RUNTIME_SEP=""  
162         if test $ac_cv_prog_gcc = yes; then
163           CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-G'
164           CMAKE_MODULE_BUILD_FLAGS='-shared -Wl,-G'
165           CMAKE_SHLIB_LINK_FLAGS='-Wl,-brtl'
166           CMAKE_MODULE_LINK_FLAGS='-Wl,-brtl'
167           CMAKE_MODULE_SUFFIX=".so"
168           CMAKE_SHLIB_SUFFIX=".so"
169         fi
170         ;;
171     Darwin-*)
172         CMAKE_SHLIB_CFLAGS=""
173         CMAKE_SHLIB_LD_LIBS=""
174         CMAKE_SHLIB_SUFFIX=".dylib"
175         CMAKE_MODULE_SUFFIX=".so"
176         CMAKE_DL_LIBS=""
177         CMAKE_SHLIB_BUILD_FLAGS="-dynamiclib"
178         CMAKE_SHLIB_LINK_FLAGS=""
179         CMAKE_MODULE_BUILD_FLAGS="-bundle -flat_namespace -undefined suppress"
180         CMAKE_MODULE_LINK_FLAGS=""
181         CMAKE_SHLIB_RUNTIME_FLAG=""
182         CMAKE_SHLIB_RUNTIME_SEP=":"
183         ;;
184     HP-UX-*)
185         CMAKE_C_LINK_SHARED=ld
186         CMAKE_SHLIB_CFLAGS="+Z"
187         CMAKE_SHLIB_LD_LIBS=""
188         CMAKE_SHLIB_SUFFIX=".sl"
189         CMAKE_MODULE_SUFFIX=".sl"
190         CMAKE_DL_LIBS="-ldld"
191         CMAKE_SHLIB_BUILD_FLAGS='-E -b -L/usr/lib'
192         CMAKE_SHLIB_LINK_FLAGS='+s'
193         CMAKE_MODULE_BUILD_FLAGS='-E -b -L/usr/lib'
194         CMAKE_MODULE_LINK_FLAGS='+s'
195         CMAKE_SHLIB_RUNTIME_FLAG='+b,'
196         CMAKE_SHLIB_RUNTIME_SEP=':'
197         if test $ac_cv_prog_gcc = yes; then
198           CMAKE_C_LINK_SHARED=${CC}
199           CMAKE_SHLIB_CFLAGS="-fPIC"
200           CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-E -Wl,-b'
201           CMAKE_SHLIB_LINK_FLAGS='-Wl,+s'
202           CMAKE_MODULE_BUILD_FLAGS='-shared -Wl,-E -Wl,-b'
203           CMAKE_MODULE_LINK_FLAGS='-Wl,+s'
204           CMAKE_SHLIB_RUNTIME_FLAG='-Wl,+b,'
205           CMAKE_SHLIB_RUNTIME_SEP=':'
206         fi
207         ;;
208     IRIX-5.*)
209         CMAKE_SHLIB_CFLAGS=""
210         CMAKE_SHLIB_LD_LIBS=""
211         CMAKE_SHLIB_SUFFIX=".so"
212         CMAKE_MODULE_SUFFIX=".so"
213         CMAKE_DL_LIBS=""
214         CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared"
215         CMAKE_MODULE_BUILD_FLAGS="-shared -rdata_shared"
216         CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
217         CMAKE_SHLIB_RUNTIME_SEP=""
218         ;;
219     IRIX-6* | IRIX64-6* | IRIX-64-6*)
220         CMAKE_SHLIB_CFLAGS=""
221         CMAKE_SHLIB_LD_LIBS=""
222         CMAKE_SHLIB_SUFFIX=".so"
223         CMAKE_MODULE_SUFFIX=".so"
224         CMAKE_DL_LIBS=""
225         CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared"
226         CMAKE_MODULE_BUILD_FLAGS="-shared -rdata_shared"
227         CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
228         CMAKE_SHLIB_RUNTIME_SEP=""
229         ;;
230     Linux*)
231         CMAKE_SHLIB_CFLAGS="-fPIC"
232         CMAKE_SHLIB_LD_LIBS=""
233         CMAKE_SHLIB_SUFFIX=".so"
234         CMAKE_MODULE_SUFFIX=".so"
235         CMAKE_SHLIB_BUILD_FLAGS="-shared"
236         CMAKE_MODULE_BUILD_FLAGS="-shared"
237         if test "$have_dl" = yes; then
238             CMAKE_DL_LIBS="-ldl"
239             CMAKE_SHLIB_LINK_FLAGS="-rdynamic"
240             CMAKE_MODULE_LINK_FLAGS="-rdynamic"
241             CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
242             CMAKE_SHLIB_RUNTIME_SEP=":"
243         else
244             AC_CHECK_HEADER(dld.h, [
245                 CMAKE_DL_LIBS="-ldld"
246                 CMAKE_SHLIB_LINK_FLAGS=""
247                 CMAKE_MODULE_LINK_FLAGS=""
248                 CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
249                 CMAKE_SHLIB_RUNTIME_SEP=""])
250         fi
251         ;;
252     CYGWIN_NT*)
253         CMAKE_SHLIB_CFLAGS=""
254         CMAKE_DL_LIBS="-lgdi32" 
255         CMAKE_SHLIB_BUILD_FLAGS="-shared"
256         CMAKE_MODULE_BUILD_FLAGS="-shared"
257         CMAKE_SHLIB_SUFFIX=".dll"
258         CMAKE_MODULE_SUFFIX=".dll"
259         CMAKE_SHLIB_LINK_FLAGS=""
260         CMAKE_MODULE_LINK_FLAGS=""
261         CMAKE_SHLIB_RUNTIME_FLAG=""
262         CMAKE_SHLIB_RUNTIME_SEP=""
263         ;;
264     MP-RAS-02*)
265         CMAKE_SHLIB_CFLAGS="-K PIC"
266         CMAKE_SHLIB_LD_LIBS=""
267         CMAKE_SHLIB_SUFFIX=".so"
268         CMAKE_MODULE_SUFFIX=".so"
269         CMAKE_DL_LIBS="-ldl"
270         CMAKE_SHLIB_LINK_FLAGS=""
271         CMAKE_MODULE_LINK_FLAGS=""
272         CMAKE_SHLIB_RUNTIME_FLAG=""
273         CMAKE_SHLIB_RUNTIME_SEP=""
274         ;;
275     MP-RAS-*)
276         CMAKE_SHLIB_CFLAGS="-K PIC"
277         CMAKE_SHLIB_LD_LIBS=""
278         CMAKE_SHLIB_SUFFIX=".so"
279         CMAKE_MODULE_SUFFIX=".so"
280         CMAKE_DL_LIBS="-ldl"
281         CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport"
282         CMAKE_MODULE_LINK_FLAGS="-Wl,-Bexport"
283         CMAKE_SHLIB_RUNTIME_FLAG=""
284         CMAKE_SHLIB_RUNTIME_SEP=""
285         ;;
286     NetBSD-*|FreeBSD-*)
287         # Not available on all versions:  check for include file.
288         if test -f /usr/include/dlfcn.h; then
289             CMAKE_SHLIB_CFLAGS="-fPIC"
290             CMAKE_SHLIB_LD_LIBS=""
291             CMAKE_SHLIB_SUFFIX=".so"
292             CMAKE_MODULE_SUFFIX=".so"
293             CMAKE_DL_LIBS=""
294             CMAKE_SHLIB_BUILD_FLAGS="-shared"
295             CMAKE_SHLIB_LINK_FLAGS=""
296             CMAKE_MODULE_BUILD_FLAGS="-shared"
297             CMAKE_MODULE_LINK_FLAGS=""
298             CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
299             CMAKE_SHLIB_RUNTIME_SEP=":"
300         else
301             CMAKE_SHLIB_CFLAGS=""
302             CMAKE_SHLIB_LD_LIBS=""
303             CMAKE_SHLIB_SUFFIX="..o"
304             CMAKE_MODULE_SUFFIX="..o"
305             CMAKE_DL_LIBS=""
306             CMAKE_SHLIB_LINK_FLAGS=""
307             CMAKE_MODULE_LINK_FLAGS=""
308             CMAKE_SHLIB_RUNTIME_FLAG=""
309             CMAKE_SHLIB_RUNTIME_SEP=""
310         fi
311         ;;
312     NEXTSTEP-*)
313         CMAKE_SHLIB_CFLAGS=""
314         CMAKE_SHLIB_LD_LIBS=""
315         CMAKE_SHLIB_SUFFIX=".so"
316         CMAKE_MODULE_SUFFIX=".so"
317         CMAKE_DL_LIBS=""
318         CMAKE_SHLIB_LINK_FLAGS=""
319         CMAKE_MODULE_LINK_FLAGS=""
320         CMAKE_SHLIB_RUNTIME_FLAG=""
321         CMAKE_SHLIB_RUNTIME_SEP=""
322         ;;
323     OSF1-1.[012])
324         # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
325         CMAKE_SHLIB_CFLAGS=""
326         # Hack: make package name same as library name
327         CMAKE_SHLIB_LD_LIBS=""
328         CMAKE_SHLIB_SUFFIX=".so"
329         CMAKE_MODULE_SUFFIX=".so"
330         CMAKE_DL_LIBS=""
331         CMAKE_SHLIB_LINK_FLAGS=""
332         CMAKE_MODULE_LINK_FLAGS=""
333         CMAKE_SHLIB_RUNTIME_FLAG=""
334         CMAKE_SHLIB_RUNTIME_SEP=""
335         ;;
336     OSF1-1.*)
337         # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
338         CMAKE_SHLIB_CFLAGS="-fpic"
339         CMAKE_SHLIB_LD_LIBS=""
340         CMAKE_SHLIB_SUFFIX=".so"
341         CMAKE_MODULE_SUFFIX=".so"
342         CMAKE_DL_LIBS=""
343         CMAKE_SHLIB_LINK_FLAGS=""
344         CMAKE_MODULE_LINK_FLAGS=""
345         CMAKE_SHLIB_RUNTIME_FLAG=""
346         CMAKE_SHLIB_RUNTIME_SEP=""
347         ;;
348     OSF1-V*)
349         # Digital OSF/1
350         CMAKE_SHLIB_CFLAGS=""
351         CMAKE_SHLIB_LD_LIBS=""
352         CMAKE_SHLIB_SUFFIX=".so"
353         CMAKE_MODULE_SUFFIX=".so"
354         CMAKE_DL_LIBS=""
355         CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,\\*'
356         CMAKE_SHLIB_LINK_FLAGS=''
357         CMAKE_MODULE_BUILD_FLAGS='-shared -Wl,-expect_unresolved,\\*'
358         CMAKE_MODULE_LINK_FLAGS=''
359         if test $ac_cv_prog_gcc = yes; then
360           CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
361         else
362           CMAKE_SHLIB_RUNTIME_FLAG="-rpath "
363         fi
364         CMAKE_SHLIB_RUNTIME_SEP=":"
365         ;;
366     RISCos-*)
367         CMAKE_SHLIB_CFLAGS="-G 0"
368         CMAKE_SHLIB_LD_LIBS=""
369         CMAKE_SHLIB_SUFFIX="..o"
370         CMAKE_MODULE_SUFFIX="..o"
371         CMAKE_DL_LIBS=""
372         CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000"
373         CMAKE_MODULE_LINK_FLAGS="-Wl,-D,08000000"
374         CMAKE_SHLIB_RUNTIME_FLAG=""
375         CMAKE_SHLIB_RUNTIME_SEP=""
376         ;;
377     SCO_SV-3.2*)
378         # Note, dlopen is available only on SCO 3.2.5 and greater.  However,
379         # this test works, since "uname -s" was non-standard in 3.2.4 and
380         # below.
381         CMAKE_SHLIB_CFLAGS="-Kpic -belf"
382         CMAKE_SHLIB_LD_LIBS=""
383         CMAKE_SHLIB_SUFFIX=".so"
384         CMAKE_MODULE_SUFFIX=".so"
385         CMAKE_DL_LIBS=""
386         CMAKE_SHLIB_LINK_FLAGS="-belf -Wl,-Bexport"
387         CMAKE_SHLIB_MODULE_FLAGS="-belf -Wl,-Bexport"
388         CMAKE_SHLIB_RUNTIME_FLAG=""
389         CMAKE_SHLIB_RUNTIME_SEP=""
390         ;;
391      SINIX*5.4*)
392         CMAKE_SHLIB_CFLAGS="-K PIC"
393         CMAKE_SHLIB_LD_LIBS=""
394         CMAKE_SHLIB_SUFFIX=".so"
395         CMAKE_MODULE_SUFFIX=".so"
396         CMAKE_DL_LIBS="-ldl"
397         CMAKE_SHLIB_LINK_FLAGS=""
398         CMAKE_MODULE_LINK_FLAGS=""
399         CMAKE_SHLIB_RUNTIME_FLAG=""
400         CMAKE_SHLIB_RUNTIME_SEP=""
401         ;;
402     SunOS-4*)
403         CMAKE_SHLIB_CFLAGS="-PIC"
404         CMAKE_SHLIB_LD_LIBS=""
405         CMAKE_SHLIB_SUFFIX=".so"
406         CMAKE_MODULE_SUFFIX=".so"
407         CMAKE_DL_LIBS="-ldl"
408         CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-r -nostdlib'
409         CMAKE_SHLIB_LINK_FLAGS=''
410         CMAKE_MODULE_BUILD_FLAGS='-shared -Wl,-r -nostdlib'
411         CMAKE_MODULE_LINK_FLAGS=''
412         CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-R,"
413         CMAKE_SHLIB_RUNTIME_SEP=":"
414         ;;
415     SunOS-5*)
416         CMAKE_SHLIB_CFLAGS="-KPIC"
417         CMAKE_SHLIB_LD_LIBS='${LIBS}'
418         CMAKE_SHLIB_SUFFIX=".so"
419         CMAKE_MODULE_SUFFIX=".so"
420         CMAKE_DL_LIBS="-ldl"
421         CMAKE_SHLIB_BUILD_FLAGS='-G'
422         CMAKE_SHLIB_LINK_FLAGS=''
423         CMAKE_MODULE_BUILD_FLAGS='-G'
424         CMAKE_MODULE_LINK_FLAGS=''
425         CMAKE_SHLIB_RUNTIME_FLAG="-R "
426         CMAKE_SHLIB_RUNTIME_SEP=":"
427         if test $ac_cv_prog_gcc = yes; then
428           CMAKE_SHLIB_BUILD_FLAGS='-shared -nostdlib'
429           CMAKE_SHLIB_LINK_FLAGS=''
430           CMAKE_MODULE_BUILD_FLAGS='-shared -nostdlib'
431           CMAKE_MODULE_LINK_FLAGS=''
432           CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-R,"
433           CMAKE_SHLIB_RUNTIME_SEP=":"
434         fi
435         ;;
436     ULTRIX-4.*)
437         CMAKE_SHLIB_CFLAGS="-G 0"
438         CMAKE_SHLIB_SUFFIX="..o"
439         CMAKE_MODULE_SUFFIX="..o"
440         CMAKE_SHLIB_LD_LIBS=""
441         CMAKE_DL_LIBS=""
442         CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000"
443         CMAKE_MODULE_LINK_FLAGS="-Wl,-D,08000000"
444         CMAKE_SHLIB_RUNTIME_FLAG=""
445         CMAKE_SHLIB_RUNTIME_SEP=""
446         ;;
447     UNIX_SV*)
448         CMAKE_SHLIB_CFLAGS="-K PIC"
449         CMAKE_SHLIB_LD_LIBS=""
450         CMAKE_SHLIB_SUFFIX=".so"
451         CMAKE_MODULE_SUFFIX=".so"
452         CMAKE_DL_LIBS="-ldl"
453         CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport"
454         CMAKE_MODULE_LINK_FLAGS="-Wl,-Bexport"
455         CMAKE_SHLIB_RUNTIME_FLAG=""
456         CMAKE_SHLIB_RUNTIME_SEP=""
457         ;;
458 esac
459 export CMAKE_SHLIB_SUFFIX
460 export CMAKE_MODULE_SUFFIX
462 # If we're running gcc, then change the C flags for compiling shared
463 # libraries to the right flags for gcc, instead of those for the
464 # standard manufacturer compiler.
465 if test $ac_cv_prog_gcc = yes; then
466   CMAKE_SHLIB_CFLAGS="-fPIC"
468 # if running on cygwin, AIX, or Darwin remove -fPIC flag
469 case $system in 
470   AIX-*)
471     CMAKE_SHLIB_CFLAGS=""
472     ;;
473   CYGWIN_NT*)
474     CMAKE_SHLIB_CFLAGS=""
475     ;;
476   Darwin*) #don't need -fPIC on Darwin (on by default)
477     CMAKE_SHLIB_CFLAGS=""
478     ;;
479 esac
481 # If the user has supplied C flags for compiling shared objects, use
482 # those instead
483 if test "${SHLIB_CFLAGS}" != ""; then
484   CMAKE_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
486 CMAKE_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
488 AC_SUBST(CMAKE_C_LINK_SHARED)
489 AC_SUBST(CMAKE_SHLIB_LINK_FLAGS)
490 AC_SUBST(CMAKE_SHLIB_BUILD_FLAGS)
491 AC_SUBST(CMAKE_MODULE_LINK_FLAGS)
492 AC_SUBST(CMAKE_MODULE_BUILD_FLAGS)
493 AC_SUBST(CMAKE_SHLIB_CFLAGS)
494 AC_SUBST(CMAKE_DL_LIBS)
495 AC_SUBST(CMAKE_SHLIB_LD_LIBS)
496 AC_SUBST(CMAKE_SHLIB_SUFFIX)
497 AC_SUBST(CMAKE_MODULE_SUFFIX)
498 AC_SUBST(CMAKE_SHLIB_RUNTIME_FLAG)
499 AC_SUBST(CMAKE_SHLIB_RUNTIME_SEP)
502 ##########################
503 ##                      ##
504 ## Check thread support ##
505 ##                      ##
506 ##########################
507 # initialize thread vars
508 CMAKE_THREAD_LIBS=""
509 use_sproc=no
510 CMAKE_USE_SPROC=0
511 CMAKE_USE_PTHREADS=0
512 CMAKE_HP_PTHREADS=0
514 ##########################
515 ##                      ##
516 ##      sproc           ##
517 ##                      ##
518 ##########################
519 # check for sproc
520 force_sproc=no
521 AC_ARG_WITH(sproc,
522          [  --with-sproc           use sproc instead of pthreads if possible],
523          if test "$withval" = yes; then
524          force_sproc=yes
525          fi,)
529 AC_CHECK_HEADERS(sys/prctl.h, [use_sproc=yes])
530 if test "$use_sproc" = "yes"; then
531 case $system in
532     Linux* | IRIX64-6.5 | IRIX-6.5) 
533         if test "$force_sproc" = "yes"; then
534            CMAKE_USE_SPROC=1
535         else
536           use_sproc=no
537         fi
538         ;;
539     IRIX*)
540         CMAKE_USE_SPROC=1
541         ;;
542 esac
544 use_pthreads=no
545 AC_CHECK_HEADERS(pthread.h, [use_pthreads=yes])
546 if test "$use_pthreads" = "yes"; then
547   if test "$use_sproc" = "no"; then
548     AC_CHECK_LIB(pthreads, pthread_create, CMAKE_THREAD_LIBS="-lpthreads")
549     AC_CHECK_LIB(pthread, pthread_create, CMAKE_THREAD_LIBS="-lpthread")
550 # Work around Solaris 5.6 and 5.7 bug:
551     if test "`uname -s -r`" = "SunOS 5.6"; then
552       AC_CHECK_LIB(thread, thr_create, CMAKE_THREAD_LIBS="$CMAKE_THREAD_LIBS -lthread")
553     fi
554     if test "`uname -s -r`" = "SunOS 5.7"; then
555       AC_CHECK_LIB(thread, thr_create, CMAKE_THREAD_LIBS="$CMAKE_THREAD_LIBS -lthread")
556     fi
557         CMAKE_USE_PTHREADS=1
558   fi
561 # on an HP with pthread we need to use -lcma
562 # on dec alphas we have had problems as well
563 if test "$use_pthreads" = "yes"; then
564 case $system in
565     HP-UX-*)
566         CMAKE_THREAD_LIBS="-lcma"
567         CMAKE_USE_PTHREADS=1 
568         CMAKE_HP_PTHREADS=1
569         ;;
570     OSF1-V*)
571         CMAKE_USE_PTHREADS=0
572         CMAKE_THREAD_LIBS=""
573         ;;
574     FreeBSD*)
575         CMAKE_USE_PTHREADS=0
576         CMAKE_THREAD_LIBS=""
577         ;;   
578     CYGWIN_NT*)
579         CMAKE_THREAD_LIBS=""
580         CMAKE_USE_WIN32_THREADS=0
581         CMAKE_USE_PTHREADS=1
582         ;;
583 esac
586 AC_SUBST(CMAKE_USE_SPROC)
587 AC_SUBST(CMAKE_USE_PTHREADS)
588 AC_SUBST(CMAKE_USE_WIN32_THREADS)
589 AC_SUBST(CMAKE_HP_PTHREADS)
590 AC_SUBST(CMAKE_THREAD_LIBS)
593 CMAKE_ANSI_CFLAGS=""
594 # on hp use -Aa for ansi
595 if test $ac_cv_prog_gcc = no; then
596 case $system in
597     HP-UX-*)
598         echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
599         echo 'void f(){}' > conftest.c
600         if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
601           echo "$ac_t""yes" 1>&6
602           CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
603         else
604           echo "$ac_t""no" 1>&6
605         fi
606         echo $ac_n "checking whether ${CC} accepts -Ae""... $ac_c" 1>&6
607         if test -z "`${CC} -Ae -c conftest.c 2>&1`"; then
608           echo "$ac_t""yes" 1>&6
609           CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Ae"
610         else
611           echo "$ac_t""no" 1>&6
612         fi
613         rm -f conftest*
614         ;;   
615 esac
617 AC_SUBST(CMAKE_ANSI_CFLAGS)
620 if test $ac_cv_prog_gcc = yes; then
621   SHLIB_CFLAGS="-fPIC"
624 # find make to use to build cmake, prefer gmake
625 AC_PATH_PROGS(CMAKE_AR_TMP, ar)
626 CMAKE_AR="$CMAKE_AR_TMP"
627 CMAKE_AR_ARGS="cr"
628 AC_SUBST(CMAKE_AR)
629 AC_SUBST(CMAKE_AR_ARGS)
632 CMAKE_SYSTEM="$system"
633 AC_SUBST(CMAKE_SYSTEM)
634 # generate output files.
635 # create mkdir files just to make some of the directories
637 AC_OUTPUT( CCMakeSystemConfig.cmake )