configure.in.sample 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT()
  3. AC_CONFIG_HEADER(CMake/Source/cmConfigure.h)
  4. CMAKE_CONFIG_DIR=`pwd`
  5. AC_SUBST(CMAKE_CONFIG_DIR)
  6. #
  7. # check for some programs we use
  8. #
  9. AC_PROG_CC
  10. AC_PROG_CXX
  11. AC_PROG_RANLIB
  12. AC_PROG_INSTALL
  13. AC_PATH_XTRA
  14. # get byte swapping info
  15. AC_C_BIGENDIAN
  16. if test $ac_cv_c_bigendian = yes; then
  17. AC_DEFINE(CMAKE_WORDS_BIGENDIAN)
  18. fi
  19. # some stuff Tcl uses
  20. #
  21. AC_CHECK_HEADER(limits.h, HAVE_LIMITS_H=-DHAVE_LIMITS_H,HAVE_LIMITS_H="")
  22. AC_SUBST(HAVE_LIMITS_H)
  23. AC_HAVE_HEADERS(unistd.h, HAVE_UNISTD_H=-DHAVE_UNISTD_H,HAVE_UNISTD_H="")
  24. AC_SUBST(HAVE_UNISTD_H)
  25. # Step 1: set the variable "system" to hold the name and version number
  26. # for the system. This can usually be done via the "uname" command, but
  27. # there are a few systems, like Next, where this doesn't work.
  28. AC_MSG_CHECKING([system version (for dynamic loading)])
  29. if test -f /usr/lib/NextStep/software_version; then
  30. system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  31. else
  32. system=`uname -s`-`uname -r`
  33. if test "$?" -ne 0 ; then
  34. AC_MSG_RESULT([unknown (can't find uname command)])
  35. system=unknown
  36. else
  37. # Special check for weird MP-RAS system (uname returns weird
  38. # results, and the version is kept in special file).
  39. if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  40. system=MP-RAS-`awk '{print $3}' /etc/.relid'`
  41. fi
  42. AC_MSG_RESULT($system)
  43. fi
  44. fi
  45. #
  46. # use shared libs
  47. #
  48. AC_ARG_WITH(shared,
  49. [ --with-shared create shared libraries],
  50. [CMAKE_shared_ok=$withval], [CMAKE_shared_ok=no])
  51. INSTALL_TARGET="install"
  52. AC_SUBST(INSTALL_TARGET)
  53. BUILD_TOOLKITS=""
  54. CLEAN_TOOLKITS=""
  55. DEPEND_TOOLKITS=""
  56. INSTALL_TOOLKITS=""
  57. # --with-kits goes here
  58. AC_SUBST(BUILD_TOOLKITS)
  59. AC_SUBST(INSTALL_TOOLKITS)
  60. AC_SUBST(DEPEND_TOOLKITS)
  61. AC_SUBST(CLEAN_TOOLKITS)
  62. # option for handling BSD style makefile includes
  63. #
  64. AC_ARG_WITH(bsdmake,
  65. [ --with-bsdmake uses bsd style makefile includes],
  66. if test "$withval" = yes; then
  67. MAKEINCLUDE=".include"
  68. MAKEQUOTE='"'
  69. fi,
  70. MAKEINCLUDE="include"
  71. MAKEQUOTE='')
  72. AC_SUBST(MAKEINCLUDE)
  73. AC_SUBST(MAKEQUOTE)
  74. # the following is an excerpt from the tcl7.5b2 configure.in
  75. #--------------------------------------------------------------------
  76. # The statements below define a collection of symbols related to
  77. # dynamic loading and shared libraries:
  78. #
  79. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
  80. # of a shared library (may request position-independent
  81. # code, among other things).
  82. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
  83. # creating shared libraries. This symbol typically
  84. # goes at the end of the "ld" commands that build
  85. # shared libraries. The value of the symbol if
  86. # "${LIBS}" if all of the dependent libraries should
  87. # be specified when creating a shared library. If
  88. # dependent libraries should not be specified (as on
  89. # SunOS 4.x, where they cause the link to fail, or in
  90. # general if Tcl and Tk aren't themselves shared
  91. # libraries), then this symbol has an empty string
  92. # as its value.
  93. # SHLIB_SUFFIX - Suffix to use for the name of the shared library. An
  94. # empty string means we don't know how to use shared
  95. # libraries on this platform.
  96. # CMAKE_SHLIB_BUILD_FLAGS -
  97. # Flags to use when building a shared library.
  98. # CMAKE_SHLIB_LINK_FLAGS -
  99. # Flags to pass to the compiler when linking object
  100. # files into an executable application binary such
  101. # as tclsh.
  102. #--------------------------------------------------------------------
  103. # Step 2: check for existence of -ldl library. This is needed because
  104. # Linux can use either -ldl or -ldld for dynamic loading.
  105. AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
  106. # Step 4: set configuration options based on system name and version.
  107. fullSrcDir=`cd $srcdir; pwd`
  108. AC_SUBST(fullSrcDir)
  109. case $system in
  110. AIX-*)
  111. # AIX: can't link shared library extensions unless Tcl and Tk are
  112. # also shared libraries.
  113. SHLIB_CFLAGS=""
  114. SHLIB_LD_LIBS='${LIBS}'
  115. SHLIB_SUFFIX="..o"
  116. DL_LIBS=""
  117. AC_CHECK_LIB(ld,printf, DL_LIBS="-lld")
  118. CMAKE_SHLIB_LINK_FLAGS=""
  119. ;;
  120. HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  121. SHLIB_CFLAGS="+z"
  122. SHLIB_LD_LIBS=""
  123. SHLIB_SUFFIX=".sl"
  124. DL_LIBS="-ldld"
  125. CMAKE_SHLIB_BUILD_FLAGS='+Z -Wl,-E -Wl,-b'
  126. CMAKE_SHLIB_LINK_FLAGS='-Wl,+s -Wl,+b,${LIB_RUNTIME_DIR}'
  127. if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
  128. CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-E -Wl,-b'
  129. CMAKE_SHLIB_LINK_FLAGS='-Wl,+s -Wl,+b,${LIB_RUNTIME_DIR}'
  130. fi
  131. ;;
  132. IRIX-5.*)
  133. SHLIB_CFLAGS=""
  134. SHLIB_LD_LIBS=""
  135. SHLIB_SUFFIX=".so"
  136. DL_LIBS=""
  137. CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared"
  138. ;;
  139. IRIX-6* | IRIX64-6* | IRIX-64-6*)
  140. SHLIB_CFLAGS=""
  141. SHLIB_LD_LIBS=""
  142. SHLIB_SUFFIX=".so"
  143. DL_LIBS=""
  144. CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared"
  145. ;;
  146. Linux*)
  147. SHLIB_CFLAGS="-fPIC"
  148. SHLIB_LD_LIBS=""
  149. SHLIB_SUFFIX=".so"
  150. CMAKE_SHLIB_BUILD_FLAGS="-shared"
  151. if test "$have_dl" = yes; then
  152. DL_LIBS="-ldl"
  153. CMAKE_SHLIB_LINK_FLAGS="-rdynamic"
  154. else
  155. AC_CHECK_HEADER(dld.h, [
  156. DL_LIBS="-ldld"
  157. CMAKE_SHLIB_LINK_FLAGS=""])
  158. fi
  159. ;;
  160. CYGWIN_NT*)
  161. DL_LIBS="-lgdi32"
  162. ;;
  163. MP-RAS-02*)
  164. SHLIB_CFLAGS="-K PIC"
  165. SHLIB_LD_LIBS=""
  166. SHLIB_SUFFIX=".so"
  167. DL_LIBS="-ldl"
  168. CMAKE_SHLIB_LINK_FLAGS=""
  169. ;;
  170. MP-RAS-*)
  171. SHLIB_CFLAGS="-K PIC"
  172. SHLIB_LD_LIBS=""
  173. SHLIB_SUFFIX=".so"
  174. DL_LIBS="-ldl"
  175. CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport"
  176. ;;
  177. NetBSD-*|FreeBSD-*)
  178. # Not available on all versions: check for include file.
  179. if test -f /usr/include/dlfcn.h; then
  180. SHLIB_CFLAGS="-fpic"
  181. SHLIB_LD_LIBS=""
  182. SHLIB_SUFFIX=".so"
  183. DL_LIBS=""
  184. CMAKE_SHLIB_LINK_FLAGS="-shared"
  185. else
  186. SHLIB_CFLAGS=""
  187. SHLIB_LD_LIBS=""
  188. SHLIB_SUFFIX="..o"
  189. DL_LIBS=""
  190. CMAKE_SHLIB_LINK_FLAGS=""
  191. fi
  192. ;;
  193. NEXTSTEP-*)
  194. SHLIB_CFLAGS=""
  195. SHLIB_LD_LIBS=""
  196. SHLIB_SUFFIX=".so"
  197. DL_LIBS=""
  198. CMAKE_SHLIB_LINK_FLAGS=""
  199. ;;
  200. OSF1-1.[012])
  201. # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
  202. SHLIB_CFLAGS=""
  203. # Hack: make package name same as library name
  204. SHLIB_LD_LIBS=""
  205. SHLIB_SUFFIX=".so"
  206. DL_LIBS=""
  207. CMAKE_SHLIB_LINK_FLAGS=""
  208. ;;
  209. OSF1-1.*)
  210. # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
  211. SHLIB_CFLAGS="-fpic"
  212. SHLIB_LD_LIBS=""
  213. SHLIB_SUFFIX=".so"
  214. DL_LIBS=""
  215. CMAKE_SHLIB_LINK_FLAGS=""
  216. ;;
  217. OSF1-V*)
  218. # Digital OSF/1
  219. SHLIB_CFLAGS=""
  220. SHLIB_LD_LIBS=""
  221. SHLIB_SUFFIX=".so"
  222. DL_LIBS=""
  223. CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,"*"'
  224. CMAKE_SHLIB_LINK_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  225. ;;
  226. RISCos-*)
  227. SHLIB_CFLAGS="-G 0"
  228. SHLIB_LD_LIBS=""
  229. SHLIB_SUFFIX="..o"
  230. DL_LIBS=""
  231. CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000"
  232. ;;
  233. SCO_SV-3.2*)
  234. # Note, dlopen is available only on SCO 3.2.5 and greater. However,
  235. # this test works, since "uname -s" was non-standard in 3.2.4 and
  236. # below.
  237. SHLIB_CFLAGS="-Kpic -belf"
  238. SHLIB_LD_LIBS=""
  239. SHLIB_SUFFIX=".so"
  240. DL_LIBS=""
  241. CMAKE_SHLIB_LINK_FLAGS="-belf -Wl,-Bexport"
  242. ;;
  243. SINIX*5.4*)
  244. SHLIB_CFLAGS="-K PIC"
  245. SHLIB_LD_LIBS=""
  246. SHLIB_SUFFIX=".so"
  247. DL_LIBS="-ldl"
  248. CMAKE_SHLIB_LINK_FLAGS=""
  249. ;;
  250. SunOS-4*)
  251. SHLIB_CFLAGS="-PIC"
  252. SHLIB_LD_LIBS=""
  253. SHLIB_SUFFIX=".so"
  254. DL_LIBS="-ldl"
  255. CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-r -nostdlib'
  256. CMAKE_SHLIB_LINK_FLAGS='-Wl,-L${LIB_RUNTIME_DIR}'
  257. ;;
  258. SunOS-5*)
  259. SHLIB_CFLAGS="-KPIC"
  260. SHLIB_LD_LIBS='${LIBS}'
  261. SHLIB_SUFFIX=".so"
  262. DL_LIBS="-ldl"
  263. CMAKE_SHLIB_BUILD_FLAGS='-G'
  264. CMAKE_SHLIB_LINK_FLAGS='-R ${LIB_RUNTIME_DIR}'
  265. if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
  266. CMAKE_SHLIB_BUILD_FLAGS='-Wl,-G'
  267. CMAKE_SHLIB_LINK_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  268. fi
  269. ;;
  270. ULTRIX-4.*)
  271. SHLIB_CFLAGS="-G 0"
  272. SHLIB_SUFFIX="..o"
  273. SHLIB_LD_LIBS=""
  274. DL_LIBS=""
  275. CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000"
  276. ;;
  277. UNIX_SV*)
  278. SHLIB_CFLAGS="-K PIC"
  279. SHLIB_LD_LIBS=""
  280. SHLIB_SUFFIX=".so"
  281. DL_LIBS="-ldl"
  282. CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport"
  283. ;;
  284. esac
  285. export SHLIB_SUFFIX
  286. # If we're running gcc, then change the C flags for compiling shared
  287. # libraries to the right flags for gcc, instead of those for the
  288. # standard manufacturer compiler.
  289. if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
  290. SHLIB_CFLAGS="-fPIC"
  291. fi
  292. if test "$CMAKE_shared_ok" = "yes"; then
  293. CMAKE_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
  294. CMAKE_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
  295. CMAKE_TCL_SHLIB_TARGET="CMAKEtcl"
  296. RANLIB=":"
  297. TOOLKIT_DEPENDS=""
  298. CMAKE_LIB_EXT="${SHLIB_SUFFIX}"
  299. else
  300. CMAKE_LIB_EXT=".a"
  301. SHLIB_LD_LIBS=""
  302. CMAKE_SHLIB_CFLAGS=""
  303. CMAKE_LD_SEARCH_FLAGS=""
  304. fi
  305. export CMAKE_LIB_EXT
  306. AC_SUBST(CMAKE_TCL_SHLIB_TARGET)
  307. AC_SUBST(TOOLKIT_DEPENDS)
  308. AC_SUBST(CMAKE_SHLIB_LINK_FLAGS)
  309. AC_SUBST(CMAKE_SHLIB_BUILD_FLAGS)
  310. AC_SUBST(CMAKE_SHLIB_CFLAGS)
  311. AC_SUBST(CMAKE_LIB_EXT)
  312. AC_SUBST(DL_LIBS)
  313. AC_SUBST(SHLIB_LD_LIBS)
  314. AC_SUBST(SHLIB_SUFFIX)
  315. #--------------------------------------------------------------------
  316. # Include sys/select.h if it exists and if it supplies things
  317. # that appear to be useful and aren't already in sys/types.h.
  318. # This appears to be true only on the RS/6000 under AIX. Some
  319. # systems like OSF/1 have a sys/select.h that's of no use, and
  320. # other systems like SCO UNIX have a sys/select.h that's
  321. # pernicious. If "fd_set" isn't defined anywhere then set a
  322. # special flag.
  323. #--------------------------------------------------------------------
  324. AC_MSG_CHECKING([fd_set and sys/select])
  325. AC_TRY_COMPILE([#include <sys/types.h>],
  326. [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
  327. if test $tk_ok = no; then
  328. AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
  329. if test $tk_ok = yes; then
  330. AC_DEFINE(HAVE_SYS_SELECT_H)
  331. fi
  332. fi
  333. AC_MSG_RESULT($tk_ok)
  334. if test $tk_ok = no; then
  335. AC_DEFINE(NO_FD_SET)
  336. fi
  337. ##########################
  338. ## ##
  339. ## Check thread support ##
  340. ## ##
  341. ##########################
  342. # initialize thread vars
  343. THREAD_LIBS=""
  344. THREAD_FLAGS=""
  345. use_sproc=no
  346. CMAKE_USE_SPROC=0
  347. CMAKE_USE_PTHREADS=0
  348. CMAKE_HP_PTHREADS=0
  349. ##########################
  350. ## ##
  351. ## sproc ##
  352. ## ##
  353. ##########################
  354. # check for sproc
  355. force_sproc=no
  356. AC_ARG_WITH(sproc,
  357. [ --with-sproc use sproc instead of pthreads if possible],
  358. if test "$withval" = yes; then
  359. force_sproc=yes
  360. fi,)
  361. AC_CHECK_HEADERS(sys/prctl.h, [use_sproc=yes])
  362. if test "$use_sproc" = "yes"; then
  363. case $system in
  364. Linux* | IRIX64-6.5 | IRIX-6.5)
  365. if test "$force_sproc" = "yes"; then
  366. CMAKE_USE_SPROC=1
  367. else
  368. use_sproc=no
  369. fi
  370. ;;
  371. IRIX*)
  372. CMAKE_USE_SPROC=1
  373. ;;
  374. esac
  375. fi
  376. use_pthreads=no
  377. AC_CHECK_HEADERS(pthread.h, [use_pthreads=yes])
  378. if test "$use_pthreads" = "yes"; then
  379. if test "$use_sproc" = "no"; then
  380. AC_CHECK_LIB(pthreads, pthread_create, THREAD_LIBS="-lpthreads")
  381. AC_CHECK_LIB(pthread, pthread_create, THREAD_LIBS="-lpthread")
  382. # Work around Solaris 5.6 and 5.7 bug:
  383. if test "`uname -s -r`" = "SunOS 5.6"; then
  384. AC_CHECK_LIB(thread, thr_create, THREAD_LIBS="$THREAD_LIBS -lthread")
  385. fi
  386. if test "`uname -s -r`" = "SunOS 5.7"; then
  387. AC_CHECK_LIB(thread, thr_create, THREAD_LIBS="$THREAD_LIBS -lthread")
  388. fi
  389. CMAKE_USE_PTHREADS=1
  390. fi
  391. fi
  392. # on an HP with pthread we need to use -lcma
  393. # on dec alphas we have had problems as well
  394. if test "$use_pthreads" = "yes"; then
  395. case $system in
  396. HP-UX-*.10.*)
  397. THREAD_LIBS="-lcma"
  398. CMAKE_USE_PTHREADS=1
  399. CMAKE_HP_PTHREADS=1
  400. ;;
  401. OSF1-V*)
  402. CMAKE_USE_PTHREADS=0
  403. THREAD_LIBS=""
  404. ;;
  405. FreeBSD*)
  406. CMAKE_USE_PTHREADS=0
  407. THREAD_LIBS=""
  408. ;;
  409. esac
  410. fi
  411. if test $CMAKE_USE_SPROC = 1; then
  412. AC_DEFINE(CMAKE_USE_SPROC)
  413. fi
  414. if test $CMAKE_USE_PTHREADS = 1; then
  415. AC_DEFINE(CMAKE_USE_PTHREADS)
  416. fi
  417. if test $CMAKE_HP_PTHREADS = 1; then
  418. AC_DEFINE(CMAKE_HP_PTHREADS)
  419. fi
  420. AC_SUBST(THREAD_LIBS)
  421. # on hp use -Aa for ansi
  422. if test $ac_cv_prog_gxx = no; then
  423. case $system in
  424. HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  425. echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
  426. echo 'void f(){}' > conftest.c
  427. if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
  428. echo "$ac_t""yes" 1>&6
  429. ANSI_CFLAGS="-Aa"
  430. else
  431. echo "$ac_t""no" 1>&6
  432. fi
  433. rm -f conftest*
  434. ;;
  435. esac
  436. fi
  437. AC_SUBST(ANSI_CFLAGS)
  438. # if we are not running g++ then we might need some other flags
  439. # to get the templates compiled correctly
  440. CMAKE_TEMPLATE_FLAGS=""
  441. if test $ac_cv_prog_gxx = no; then
  442. echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6
  443. echo 'void f(){}' > conftest.cc
  444. if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then
  445. echo "$ac_t""yes" 1>&6
  446. CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
  447. else
  448. echo "$ac_t""no" 1>&6
  449. fi
  450. rm -f conftest*
  451. echo $ac_n "checking whether ${CXX} accepts -instances=semiexplicit""... $ac_c" 1>&6
  452. echo 'void f(){}' > conftest.cc
  453. if test -z "`${CXX} -instances=static -c conftest.cc 2>&1`"; then
  454. echo "$ac_t""yes" 1>&6
  455. CMAKE_TEMPLATE_FLAGS="-instances=static"
  456. else
  457. echo "$ac_t""no" 1>&6
  458. fi
  459. fi
  460. AC_SUBST(CMAKE_TEMPLATE_FLAGS)
  461. # check no g++ compilers to see if they have the standard
  462. # ansi stream files (without the .h)
  463. if test $ac_cv_prog_gxx = no; then
  464. AC_MSG_CHECKING( ansi standard C++ stream headers )
  465. echo "******"
  466. rm -rf conftest.*
  467. cat > conftest.cc <<!
  468. #include <iostream>
  469. !
  470. if test -z "`${CXX} -c conftest.cc 2>&1`"; then
  471. echo "$ac_t""yes" 1>&6
  472. else
  473. AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
  474. echo "$ac_t""no" 1>&6
  475. fi
  476. fi
  477. # check to see if stl is in the std namespace
  478. if test $ac_cv_prog_gxx = no; then
  479. echo "******"
  480. AC_MSG_CHECKING( ansi standard namespace support )
  481. rm -rf conftest.*
  482. cat > conftest.cc <<!
  483. #include <list>
  484. void foo() { std::list<int> l; }
  485. !
  486. if test -z "`${CXX} -c conftest.cc 2>&1`"; then
  487. echo "$ac_t""yes" 1>&6
  488. else
  489. AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS)
  490. echo "$ac_t""no" 1>&6
  491. fi
  492. fi
  493. if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
  494. SHLIB_CFLAGS="-fPIC"
  495. fi
  496. if test -f $CMAKE_CONFIG_DIR/CMakeLocal.make.in; then
  497. echo "create CMakeLocal.make from $CMAKE_CONFIG_DIR/CMakeLocal.make.in"
  498. rm -f local.make
  499. cp $CMAKE_CONFIG_DIR/local.make.in local.make
  500. else
  501. echo "no $CMAKE_CONFIG_DIR/CMakeLocal.make.in creating an empty CMakeLocal.make file"
  502. rm -f CMakeLocal.make
  503. touch CMakeLocal.make
  504. fi
  505. AC_SUBST(EXTRA_GCC_FLAG)
  506. AC_CONFIG_SUBDIRS(Code/Numerics/vxl)
  507. AC_CONFIG_SUBDIRS(Code/Numerics/vxl/vcl)
  508. # *****************************************
  509. #
  510. # This next section extracts the sub-directories from
  511. # the CMakeLists.txt file in the current directory,
  512. # and any sub directories recursivley
  513. #
  514. echo "Searching CMakeLists.txt files for all sub directories"
  515. # the result of a the directories found is stored in allDirs
  516. allDirs=
  517. # start looking in the current directory .
  518. searchDirs=$srcdir
  519. # loop until the flag dirHasListsFile is set to falls
  520. dirHasListsFile=:
  521. while $dirHasListsFile; do
  522. # reset the varible used to store the full paths to the directory
  523. # outside the for loop
  524. fullPathDirs=
  525. # loop over all directorirs in the current searchDirs varible
  526. for currentDir in $searchDirs;do
  527. # look for a CMakeLists.txt file in the current directory
  528. if test -e$currentDir/CMakeLists.txt; then
  529. # extract the SUBDIRS varible from the CMakeLists.txt file
  530. dirsInListsFile=`cat $currentDir/CMakeLists.txt | sed -e :a -e '/SUBDIRS.*\\\\$/N; s/\\\\\\n//; ta' | grep SUBDIRS | sed -e "s/SUBDIRS//g; s/(//g;s/)//g" `
  531. # add the current directory to any sub dirs found
  532. # in the above search of CMakeLists.txt
  533. for subdir in $dirsInListsFile;do
  534. fullPathDirs="$fullPathDirs $currentDir/$subdir"
  535. allDirs="$allDirs $currentDir/$subdir"
  536. done
  537. fi
  538. done
  539. # now get ready to search any directories found in the above for loop
  540. searchDirs=$fullPathDirs
  541. # check to see if searchDirs is emtpy
  542. if test "x$searchDirs" = x; then
  543. dirHasListsFile=false
  544. fi
  545. done # continue while loop until dirHasListsFile=false
  546. if test "x$srcdir" = x.; then
  547. allDirs=`echo $allDirs | sed -e "s|\./||g"`
  548. else
  549. allDirs=`echo $allDirs | sed -e "s|$srcdir/||g"`
  550. fi
  551. SUBDIR_MAKEFILES=`echo $allDirs | sed -e 's|\\([[A-Za-z0-9_/]][[A-Za-z0-9_/]]*\\)|\1/Makefile:CMake/CMakeMakefileTemplate.in|g'`
  552. SUBDIR_CMAKE_TARGETS=`echo $allDirs | sed -e 's|\\([[A-Za-z0-9_/]][[A-Za-z0-9_/]]*\\)|\1/CMakeTargets.make:CMake/CMakeTargets.make.in|g'`
  553. #
  554. # *****************************************
  555. # end of extract SUBDIRS out of CMakeLists.txt files
  556. #
  557. #
  558. # Build two variables (SITE, INSTANCE) used for setting up testing
  559. #
  560. AC_ARG_WITH(site,
  561. [ --with-site sitename used for testing],
  562. [site_specified=$withval], [site_specified=none])
  563. AC_ARG_WITH(buildname,
  564. [ --with-buildname name of build used for testing],
  565. [buildname_specified=$withval], [buildname_specified=none])
  566. # Determine the site (domain) name
  567. AC_PATH_PROG(HOSTNAME, hostname, hostname, $PATH:/usr/bsd:/usr/sbin:/usr/bin:/bin:/sbin)
  568. AC_PATH_PROG(NSLOOKUP, nslookup, nslookup, $PATH:/usr/bin:/usr/sbin:/usr/local/bin)
  569. # Fallback site
  570. myhostname=`$HOSTNAME`
  571. SITE=`$NSLOOKUP $myhostname | grep \^Name: | cut -d. -f2- | tr [A-Z] [a-z]`
  572. if test ! "$site_specified" = none; then
  573. SITE=$site_specified
  574. fi
  575. if test -z "$SITE"; then
  576. SITE=nosite
  577. fi
  578. AC_SUBST(SITE)
  579. # Setup the instance name (OS, Revision, Compiler, and someday Compiler Revision)
  580. COMPILER=`echo $CXX | cut -d ' ' -f1`
  581. COMPILER=`basename $COMPILER`
  582. BUILDNAME=$system-$COMPILER
  583. BUILDNAME=`echo $BUILDNAME | tr [\(\/] _ | tr -d \)`
  584. if test ! "$buildname_specified" = none; then
  585. BUILDNAME=$buildname_specified
  586. fi
  587. AC_SUBST(BUILDNAME)
  588. # output to the top level Makefile, which must be present
  589. # create the toplevel CMakeTargets.make file
  590. # Create all the make file fragments in CMake
  591. # Create the Makefile in CMake/Source
  592. # Create all the Makefiles and CMakeTargets.make files for
  593. # sub directories found in CMakeLists.txt files
  594. AC_OUTPUT(
  595. Makefile:CMake/CMakeTopMakefileTemplate.in
  596. CMakeTargets.make:CMake/CMakeTargets.make.in
  597. CMake/CMakeSimpleRules.make
  598. CMake/CMakeMaster.make
  599. CMake/CMakeVariables.make
  600. CMake/CMakeRules.make
  601. CMake/Source/CMakeTargets.make:CMake/dummy.in
  602. CMake/Source/Makefile
  603. $SUBDIR_MAKEFILES
  604. $SUBDIR_CMAKE_TARGETS
  605. )
  606. # force a rebuild of rulesgen which will rebuild CMakeTargets.make
  607. # this has to be done because configure generates empty CMakeTargets.make files
  608. # for makes other than gnu.
  609. rm -f CMake/Source/CMakeBuildTargets
  610. rm -f CMake/Source/CMakeBuildTargets.exe
  611. # build the CMakeBuildTargets program
  612. (cd CMake/Source; make CMakeBuildTargets)
  613. # if there is no cache file then create one
  614. if test ! -f $CMAKE_CONFIG_DIR/CMakeCache.txt; then
  615. echo CMake/Source/CMakeBuildTargets.exe ${fullSrcDir}/CMakeLists.txt -MakeCache -S${fullSrcDir} -O${CMAKE_CONFIG_DIR} -H${fullSrcDir} -B${CMAKE_CONFIG_DIR}
  616. CMake/Source/CMakeBuildTargets.exe ${fullSrcDir}/CMakeLists.txt -MakeCache -S${fullSrcDir} -O${CMAKE_CONFIG_DIR} -H${fullSrcDir} -B${CMAKE_CONFIG_DIR}
  617. fi
  618. echo CMakeCache.txt location: ${CMAKE_CONFIG_DIR}/CMakeCache.txt