Template.autoconf.pp 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  1. //
  2. // Template.autoconf.pp
  3. //
  4. // This file defines the set of output files that will be generated to
  5. // support an autoconf/automake style build. This works particularly
  6. // well when gcc/g++ will be used to compile, for instance on Linux.
  7. //
  8. #defer get_sys_libs $[wordsubst -ldl,@libdl@,$[patsubst %,-l%,$[UNIX_SYS_LIBS]]]
  9. // First, check to see if the entire directory has been switched out.
  10. #define omit
  11. #if $[DIRECTORY_IF_GL]
  12. #set omit $[not $[HAVE_GL]]
  13. #endif
  14. #if $[DIRECTORY_IF_CHROMIUM]
  15. #set omit $[not $[HAVE_CHROMIUM]]
  16. #endif
  17. #if $[DIRECTORY_IF_GLX]
  18. #set omit $[not $[HAVE_GLX]]
  19. #endif
  20. #if $[DIRECTORY_IF_WGL]
  21. #set omit $[not $[HAVE_WGL]]
  22. #endif
  23. #if $[DIRECTORY_IF_GLUT]
  24. #set omit $[not $[HAVE_GLUT]]
  25. #endif
  26. #if $[DIRECTORY_IF_SGIGL]
  27. #set omit $[not $[HAVE_SGIGL]]
  28. #endif
  29. #if $[DIRECTORY_IF_DX]
  30. #set omit $[not $[HAVE_DX]]
  31. #endif
  32. #if $[DIRECTORY_IF_PS2]
  33. #set omit $[not $[HAVE_PS2]]
  34. #endif
  35. #if $[DIRECTORY_IF_RIB]
  36. #set omit $[not $[HAVE_RIB]]
  37. #endif
  38. #if $[DIRECTORY_IF_VRPN]
  39. #set omit $[not $[HAVE_VRPN]]
  40. #endif
  41. //////////////////////////////////////////////////////////////////////
  42. #if $[eq $[DIR_TYPE], src]
  43. //////////////////////////////////////////////////////////////////////
  44. // For a source directory, build a Makefile.am with a number of targets.
  45. #output Makefile.am
  46. #format makefile
  47. # Makefile.am generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  48. #if $[omit]
  49. // If we're omitting the directory, everything becomes an extra_dist.
  50. EXTRA_DIST = Sources.pp $[EXTRA_DIST] $[SOURCES(static_lib_target noinst_lib_target lib_target noinst_bin_target bin_target test_bin_target)]
  51. #else // $[omit]
  52. // We define a map variable that allows us to look up all the libs in
  53. // the various directories by target name. With this map variable, we
  54. // can translate the list of local_libs (which is simply a list of
  55. // library names, with no directory information), into a list of
  56. // relative filenames to each library.
  57. #map local_libs TARGET(*/static_lib_target */lib_target */noinst_lib_target)
  58. #define all_include_dirs
  59. lib_LTLIBRARIES = $[TARGET(static_lib_target lib_target):%=lib%.la]
  60. noinst_LTLIBRARIES = $[TARGET(noinst_lib_target):%=lib%.la]
  61. bin_PROGRAMS = $[TARGET(bin_target)]
  62. noinst_PROGRAMS = $[TARGET(noinst_bin_target)]
  63. EXTRA_PROGRAMS = $[TARGET(test_bin_target)]
  64. #if $[ne $[YACC_PREFIX],]
  65. YFLAGS = -d --name-prefix=$[YACC_PREFIX] $[YFLAGS]
  66. LFLAGS = -P$[YACC_PREFIX] -olex.yy.c $[LFLAGS]
  67. #else
  68. YFLAGS = -d $[YFLAGS]
  69. LFLAGS = $[LFLAGS]
  70. #endif
  71. #define alt_cflags @nspr_cflags@ @python_cflags@
  72. #define alt_lflags @nspr_lflags@
  73. #define alt_libs @nspr_libs@
  74. #if $[ne $[USE_ZLIB],]
  75. #define alt_cflags $[alt_cflags] @zlib_cflags@
  76. #define alt_lflags $[alt_lflags] @zlib_lflags@
  77. #define alt_libs $[alt_libs] @zlib_libs@
  78. #endif
  79. #if $[ne $[USE_GL],]
  80. #define alt_cflags $[alt_cflags] @gl_cflags@ @glut_cflags@
  81. #define alt_lflags $[alt_lflags] @gl_lflags@ @glut_lflags@
  82. #define alt_libs $[alt_libs] @gl_libs@ @glut_libs@
  83. #endif
  84. #define built_sources
  85. #define install_data
  86. #forscopes static_lib_target lib_target noinst_lib_target
  87. // This map variable lets us identify which metalib, if any, is
  88. // including this particular library.
  89. #map module LOCAL_LIBS(*/metalib_target)
  90. // And this defines the complete set of libs we depend on: the
  91. // LOCAL_LIBS we listed as directly depending on, plus all of the
  92. // LOCAL_LIBS *those* libraries listed, and so on.
  93. #define complete_local_libs $[closure local_libs,$[LOCAL_LIBS]]
  94. #if $[ne $[IF_ZLIB_SOURCES],]
  95. if HAVE_ZLIB
  96. EXTRA_ZLIB = $[IF_ZLIB_SOURCES]
  97. else
  98. EXTRA_ZLIB =
  99. endif
  100. #define SOURCES $[SOURCES] $(EXTRA_ZLIB)
  101. #endif
  102. #define local_incs $[local_libs $[RELDIR],$[complete_local_libs]] $[RELDIR($[LOCAL_INCS:%=%/])]
  103. // Check for interrogate.
  104. #if $[eq $[IGATESCAN], all]
  105. #define IGATESCAN $[filter-out %.I %.T %.lxx %.yxx %.N,$[SOURCES]]
  106. #endif
  107. #if $[ne $[IGATESCAN],]
  108. #define IGATEFILE $[TARGET].in.cxx
  109. #define IGATEDBFILE lib$[TARGET].in
  110. #define IGATELIBRARY lib$[TARGET]
  111. #define IGATEMODULE lib$[module $[TARGET],$[TARGET]]
  112. #if $[eq $[IGATEMODULE], lib]
  113. #define IGATEMODULE $[IGATELIBRARY]
  114. #endif
  115. IGATESCAN = $[IGATESCAN]
  116. $[IGATEFILE] : $(IGATESCAN)
  117. @dtool@/bin/interrogate $[IGATEFLAGS] @system_igate@ -DCPPPARSER -D__cplusplus -I@dtool@/include/parser-inc @trees_inc@ $[local_incs:%=-I%] $[alt_cflags] $[CDEFINES] -module "$[IGATEMODULE]" -library "$[IGATELIBRARY]" -oc $[IGATEFILE] -od $[IGATEDBFILE] -fnames -string -refcount -assert -promiscuous -python $(IGATESCAN)
  118. #set built_sources $[built_sources] $[IGATEFILE]
  119. #set install_data $[install_data] $[IGATEDBFILE]
  120. #endif
  121. #define SOURCES $[SOURCES] $[IGATEFILE]
  122. lib$[TARGET]_la_SOURCES = $[SOURCES]
  123. lib$[TARGET]_la_LIBADD = $[OTHER_LIBS:%=-l%] $[alt_libs] $[get_sys_libs]
  124. #set all_include_dirs $[all_include_dirs] $[local_incs]
  125. #end static_lib_target lib_target noinst_lib_target
  126. #forscopes bin_target noinst_bin_target test_bin_target
  127. #if $[ne $[IF_ZLIB_SOURCES],]
  128. if HAVE_ZLIB
  129. EXTRA_ZLIB = $[IF_ZLIB_SOURCES]
  130. else
  131. EXTRA_ZLIB =
  132. endif
  133. #define $[SOURCES] $(EXTRA_ZLIB)
  134. #endif
  135. // This defines the complete set of libs we depend on: the LOCAL_LIBS
  136. // we listed as directly depending on, plus all of the LOCAL_LIBS
  137. // *those* libraries listed, and so on.
  138. #define complete_local_libs $[closure local_libs,$[LOCAL_LIBS]]
  139. $[TARGET]_SOURCES = $[SOURCES]
  140. $[TARGET]_LDADD = $[local_libs $[RELDIR]/lib$[TARGET].la,$[complete_local_libs]] $[OTHER_LIBS:%=-l%] $[alt_libs] $[get_sys_libs]
  141. #set all_include_dirs $[all_include_dirs] $[local_libs $[RELDIR],$[complete_local_libs]]
  142. #set all_include_dirs $[all_include_dirs] $[RELDIR($[LOCAL_INCS:%=%/])]
  143. #end bin_target noinst_bin_target test_bin_target
  144. include_HEADERS = $[sort $[INSTALL_HEADERS(static_lib_target lib_target bin_target)] $[INSTALL_HEADERS]]
  145. #set install_data $[install_data] $[INSTALL_DATA]
  146. #if $[ne $[INSTALL_PARSER_INC],]
  147. parserincdir = @includedir@/parser-inc
  148. parserinc_HEADERS = $[INSTALL_PARSER_INC]
  149. #endif
  150. INCLUDES = $[patsubst %,-I%,$[sort $[all_include_dirs]]] @trees_inc@ $[alt_cflags]
  151. LDFLAGS = @ldflags@ @trees_lflags@ $[alt_lflags]
  152. EXTRA_DIST = Sources.pp $[EXTRA_DIST] $[INSTALL_LIBS] $[INSTALL_SCRIPTS]$[install_data]
  153. BUILT_SOURCES =$[built_sources]
  154. data_DATA =$[install_data]
  155. #endif // $[omit]
  156. #end Makefile.am
  157. //////////////////////////////////////////////////////////////////////
  158. #elif $[eq $[DIR_TYPE], metalib]
  159. //////////////////////////////////////////////////////////////////////
  160. // A metalib directory is similar to a regular source directory,
  161. // but a little simpler.
  162. #output Makefile.am
  163. #format makefile
  164. # Makefile.am generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  165. #if $[omit]
  166. // If we're omitting the directory, everything becomes an extra_dist.
  167. EXTRA_DIST = Sources.pp $[EXTRA_DIST] $[SOURCES(static_lib_target noinst_lib_target lib_target noinst_bin_target bin_target test_bin_target)]
  168. #else // $[omit]
  169. // We define a map variable that allows us to look up all the libs in
  170. // the various directories by target name. With this map variable, we
  171. // can translate the list of local_libs (which is simply a list of
  172. // library names, with no directory information), into a list of
  173. // relative filenames to each library.
  174. #map local_libs TARGET(*/static_lib_target */lib_target */noinst_lib_target)
  175. #define all_include_dirs $(includedir)
  176. lib_LTLIBRARIES = $[TARGET(metalib_target):%=lib%.la]
  177. #define alt_cflags @nspr_cflags@ @python_cflags@
  178. #define alt_lflags @nspr_lflags@
  179. #define alt_libs @nspr_libs@
  180. #if $[ne $[USE_ZLIB],]
  181. #define alt_cflags $[alt_cflags] @zlib_cflags@
  182. #define alt_lflags $[alt_lflags] @zlib_lflags@
  183. #define alt_libs $[alt_libs] @zlib_libs@
  184. #endif
  185. #if $[ne $[USE_GL],]
  186. #define alt_cflags $[alt_cflags] @gl_cflags@
  187. #define alt_lflags $[alt_lflags] @gl_lflags@
  188. #define alt_libs $[alt_libs] @gl_libs@
  189. #endif
  190. #forscopes metalib_target
  191. #if $[ne $[IF_PYTHON_SOURCES],]
  192. if HAVE_PYTHON
  193. EXTRA_PYTHON = $[IF_PYTHON_SOURCES]
  194. else
  195. EXTRA_PYTHON =
  196. endif
  197. #define SOURCES $[SOURCES] $(EXTRA_PYTHON)
  198. #endif
  199. // This defines the complete set of libs we depend on: the LOCAL_LIBS
  200. // we listed as directly depending on, plus all of the LOCAL_LIBS
  201. // *those* libraries listed, and so on.
  202. #define complete_local_libs $[closure local_libs,$[LOCAL_LIBS]]
  203. lib$[TARGET]_la_SOURCES = $[SOURCES]
  204. lib$[TARGET]_la_LIBADD = $[complete_local_libs:%=-l%] $[get_sys_libs]
  205. #end metalib_target
  206. INCLUDES = $[patsubst %,-I%,$[sort $[all_include_dirs]]] @trees_inc@ $[alt_cflags]
  207. LDFLAGS = @ldflags@ -L$(libdir) -rpath $(libdir) @trees_lflags@ $[alt_lflags]
  208. EXTRA_DIST = Sources.pp $[EXTRA_DIST]
  209. #endif // $[omit]
  210. #end Makefile.am
  211. //////////////////////////////////////////////////////////////////////
  212. #elif $[eq $[DIR_TYPE], group]
  213. //////////////////////////////////////////////////////////////////////
  214. #output Makefile.am
  215. #format makefile
  216. # Makefile.am generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  217. SUBDIRS = $[SUBDIRS]
  218. EXTRA_DIST = Sources.pp $[EXTRA_DIST]
  219. #end Makefile.am
  220. //////////////////////////////////////////////////////////////////////
  221. #elif $[eq $[DIR_TYPE], toplevel]
  222. //////////////////////////////////////////////////////////////////////
  223. #output Makefile.am
  224. #format makefile
  225. # Makefile.am generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  226. FIRSTBUILD_SUBDIRS = $[filter_out metalibs,$[SUBDIRS]]
  227. SUBDIRS = $[SUBDIRS]
  228. #define INSTALL_HEADERS $[INSTALL_HEADERS] $[CONFIG_HEADER]
  229. include_HEADERS = $[INSTALL_HEADERS]
  230. EXTRA_DIST = Sources.pp Config.pp $[EXTRA_DIST]
  231. # We define this custom rule for all-recursive as an ordering hack.
  232. # It's just like the default rule, except that it traverses through
  233. # only FIRSTBUILD_SUBDIRS, instead of all of SUBDIRS. The idea is
  234. # that first we build everything in FIRSTBUILD_SUBDIRS, and then when
  235. # we're installing, we build everything in SUBDIRS as well. This hack
  236. # is necessary to build targets in metalibs that link directly with
  237. # installed shared libraries.
  238. all-recursive:
  239. @set fnord $(MAKEFLAGS); amf=$$2; \
  240. dot_seen=no; \
  241. target=`echo $@ | sed s/-recursive//`; \
  242. list='$(FIRSTBUILD_SUBDIRS)'; for subdir in $$list; do \
  243. echo "Making $$target in $$subdir"; \
  244. if test "$$subdir" = "."; then \
  245. dot_seen=yes; \
  246. local_target="$$target-am"; \
  247. else \
  248. local_target="$$target"; \
  249. fi; \
  250. (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
  251. || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
  252. done; \
  253. if test "$$dot_seen" = "no"; then \
  254. $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
  255. fi; test -z "$$fail"
  256. #end Makefile.am
  257. #output configure.in
  258. #format straight
  259. dnl configure.in generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  260. dnl Process this file with autoconf to produce a configure script.
  261. AC_INIT($[SAMPLE_SOURCE_FILE])
  262. AM_INIT_AUTOMAKE($[PACKAGE], $[VERSION])
  263. #if $[eq $[CONFIG_HEADER],]
  264. dnl This package doesn't care about a generated config.h file. This causes
  265. dnl a few problems with automake, so we fake it out with this hack.
  266. AM_CONFIG_HEADER(ignore_config.h)
  267. #else
  268. AM_CONFIG_HEADER($[CONFIG_HEADER])
  269. #endif
  270. if test "${CTPROJS+set}" = set; then
  271. if test "${$[upcase $[PACKAGE]]+set}" != set; then
  272. echo ""
  273. echo "The environment variable CTPROJS is currently set, indicating"
  274. echo "you are attached to one or more trees, but you are not attached"
  275. echo "to $[upcase $[PACKAGE]]. Either unattach from everything, or attach to $[upcase $[PACKAGE]]."
  276. echo ""
  277. exit 1
  278. fi
  279. # If we're currently attached, the install directory is the same as
  280. # the source directory.
  281. if test "$prefix" != "NONE"; then
  282. echo ""
  283. echo The environment variable CTPROJS is currently set, indicating
  284. echo you are attached to one or more trees. When you configure the
  285. echo package while attached, you cannot specify a --prefix to install
  286. echo the built sources--it always installs in the source directory.
  287. echo ""
  288. exit 1
  289. fi
  290. prefix=$$[upcase $[PACKAGE]]
  291. fi
  292. AC_PREFIX_DEFAULT($[INSTALL_DIR])
  293. AC_PROG_MAKE_SET
  294. AC_CANONICAL_HOST
  295. # If we have a CFLAGS variable but not a CXXFLAGS variable, let them
  296. # be the same.
  297. if test "${CXXFLAGS+set}" != set -a "${CFLAGS+set}" = set; then
  298. CXXFLAGS=$CFLAGS
  299. fi
  300. # Save these variables for later, so we can easily append to them or
  301. # change them.
  302. user_ldflags=${LDFLAGS-}
  303. user_cflags=${CFLAGS-}
  304. user_cxxflags=${CXXFLAGS-}
  305. dnl Choose a suitable set of system-dependent interrogate flags.
  306. case "$host_os" in
  307. irix*) system_igate="-D__mips__ -D__MIPSEB__";;
  308. linux-gnu*) system_igate="-D__i386__";;
  309. esac
  310. AC_SUBST(system_igate)
  311. dnl Checks for programs.
  312. AC_PROG_CC
  313. AC_PROG_CXX
  314. AM_PROG_LEX
  315. AM_DISABLE_STATIC
  316. AM_PROG_LIBTOOL
  317. AC_PATH_XTRA
  318. dnl We require specifically Bison, not any other flavor of Yacc.
  319. AC_CHECK_PROGS(YACC, 'bison -y')
  320. AC_ARG_WITH(optimize,
  321. [ --with-optimize=LEVEL Specify the optimization/debug symbol level (1-4, default 1)])
  322. if test "${with_optimize-no}" = "no"; then
  323. with_optimize=$[OPTIMIZE]
  324. fi
  325. if test "$with_optimize" = "1"; then
  326. # Optimize level 1: No optimizations, and full debug symbols.
  327. if test "${ac_cv_prog_gcc}" = "yes"; then
  328. CFLAGS="$user_cflags -g -Wall"
  329. CXXFLAGS="$user_cxxflags -g -Wall"
  330. else
  331. CFLAGS="$user_cflags -g"
  332. CXXFLAGS="$user_cxxflags -g"
  333. fi
  334. elif test "$with_optimize" = "2"; then
  335. # Optimize level 2: Compiler optimizations, and full debug if supported.
  336. if test "${ac_cv_prog_gcc}" = "yes"; then
  337. CFLAGS="$user_cflags -O2 -g -Wall"
  338. CXXFLAGS="$user_cxxflags -O2 -g -Wall"
  339. else
  340. CFLAGS="$user_cflags -O"
  341. CXXFLAGS="$user_cxxflags -O"
  342. fi
  343. elif test "$with_optimize" = "3"; then
  344. # Optimize level 3: Compiler optimizations, without debug symbols.
  345. if test "${ac_cv_prog_gcc}" = "yes"; then
  346. CFLAGS="$user_cflags -O2 -Wall"
  347. CXXFLAGS="$user_cxxflags -O2 -Wall"
  348. else
  349. CFLAGS="$user_cflags -O"
  350. CXXFLAGS="$user_cxxflags -O"
  351. fi
  352. elif test "$with_optimize" = "4"; then
  353. # Optimize level 4: As above, with asserts removed.
  354. if test "${ac_cv_prog_gcc}" = "yes"; then
  355. CFLAGS="$user_cflags -O2 -Wall -DNDEBUG"
  356. CXXFLAGS="$user_cxxflags -O2 -Wall -DNDEBUG"
  357. else
  358. CFLAGS="$user_cflags -O -DNDEBUG"
  359. CXXFLAGS="$user_cxxflags -O -DNDEBUG"
  360. fi
  361. else
  362. echo "Invalid optimize level: $with_optimize"
  363. exit 0
  364. fi
  365. trees_inc=
  366. trees_lflags=
  367. #foreach require $[REQUIRED_TREES]
  368. AC_ARG_WITH($[require],
  369. [ --with-$[require]=DIR Prefix where $[upcase $[require]] is installed (same as --prefix)])
  370. if test "${CTPROJS+set}" = set; then
  371. if test "$with_$[require]" != ""; then
  372. echo ""
  373. echo "The environment variable CTPROJS is currently set, indicating"
  374. echo "you are attached to one or more trees. When you configure the"
  375. echo "package while attached, you cannot specify a directory to search"
  376. echo "for --$[require]; it will always search in the currently attached $[upcase $[require]]."
  377. echo ""
  378. exit 1
  379. fi
  380. if test "${$[upcase $[require]]+set}" != set; then
  381. echo ""
  382. echo "The environment variable CTPROJS is currently set, indicating"
  383. echo "you are attached to one or more trees, but you are not attached"
  384. echo "to $[upcase $[require]]. Either unattach from everything, or attach to $[upcase $[require]]."
  385. echo ""
  386. exit 1
  387. fi
  388. $[require]='${$[upcase $[require]]}'
  389. else
  390. # No attachments--respect the --with-$[require] parameter.
  391. if test "$with_$[require]" != "" -a "$with_$[require]" != "no" -a "$with_$[require]" != "yes"; then
  392. $[require]=$with_$[require]
  393. else
  394. $[require]='${prefix}'
  395. fi
  396. trees_inc="$trees_inc -I"'$($[require])/include'
  397. trees_lflags="$trees_lflags -L"'$($[require])/lib'
  398. fi
  399. AC_SUBST($[require])
  400. #end require
  401. AC_SUBST(trees_inc)
  402. AC_SUBST(trees_lflags)
  403. dnl First, we'll test for C-specific features.
  404. AC_LANG_C
  405. dnl Checks for libraries.
  406. libdl=
  407. libm=
  408. AC_CHECK_LIB(dl, dlopen, libdl=-ldl)
  409. AC_CHECK_LIB(m, sin, libm=-lm)
  410. AC_SUBST(libdl)
  411. AC_SUBST(libm)
  412. // Only bother to make the following tests if we're actually building
  413. // a config.h.
  414. #if $[ne $[CONFIG_HEADER],]
  415. dnl Checks for header files.
  416. AC_HEADER_STDC
  417. AC_CHECK_HEADERS(malloc.h alloca.h unistd.h io.h minmax.h sys/types.h)
  418. dnl Checks for typedefs, structures, and compiler characteristics.
  419. AC_C_BIGENDIAN
  420. AC_GETTIMEOFDAY
  421. dnl Checks for library functions.
  422. AC_CHECK_FUNCS(getopt getopt_long_only)
  423. dnl Now we can test some C++-specific features.
  424. AC_LANG_CPLUSPLUS
  425. AC_HEADER_IOSTREAM
  426. AC_CHECK_HEADERS(sstream)
  427. AC_NAMESPACE
  428. AC_IOS_BINARY
  429. #endif
  430. AC_LANG_C
  431. AC_ARG_WITH(python,
  432. [ --with-python=DIR Prefix where Python is installed (usually /usr/local)])
  433. have_python=no
  434. include_python=
  435. if test "$with_python" != "no"; then
  436. if test "$with_python" = "yes" -o "$with_python" = ""; then
  437. AC_SEARCH_HPACKAGE(/usr/local /usr,
  438. python1.6 python,
  439. Python.h, python)
  440. else
  441. AC_SEARCH_HPACKAGE($with_python,
  442. python1.6 python,
  443. Python.h, python)
  444. fi
  445. if test "$with_python" != ""; then
  446. if test "$python_PKG" != "yes"; then
  447. dnl If the user specified to search for python but we didn't find it,
  448. dnl abort now.
  449. echo ""
  450. echo "**** Could not locate Python package. Use --with-python=directory,"
  451. echo " e.g. --with-python=/usr/local, or just --with-python."
  452. echo " If Python is not installed, specify --without-python."
  453. echo ""
  454. exit 1
  455. fi
  456. fi
  457. if test "$python_PKG" = "yes"; then
  458. #if $[ne $[CONFIG_HEADER],]
  459. AC_DEFINE(HAVE_PYTHON)
  460. #endif
  461. have_python=yes
  462. python_cflags=-I$python_INCLUDE
  463. fi
  464. fi
  465. AC_SUBST(have_python)
  466. AC_SUBST(python_cflags)
  467. AM_CONDITIONAL(HAVE_PYTHON, test "$have_python" = "yes")
  468. AC_ARG_WITH(nspr,
  469. [ --with-nspr=DIR Prefix where NSPR is installed (usually /usr/local/mozilla)])
  470. have_nspr=no
  471. include_nspr=
  472. if test "$with_nspr" != "no"; then
  473. if test "$with_nspr" = "yes" -o "$with_nspr" = ""; then
  474. AC_SEARCH_PACKAGE(/usr/local/mozilla /usr/local/mozilla/dist/*,,
  475. nspr.h, nspr3, PR_Init, nspr)
  476. else
  477. AC_SEARCH_PACKAGE($with_nspr $with_nspr/dist/*,,
  478. nspr.h, nspr3, PR_Init, nspr)
  479. fi
  480. if test "$with_nspr" != ""; then
  481. if test "$nspr_PKG" != "yes"; then
  482. dnl If the user specified to search for NSPR but we didn't find it,
  483. dnl abort now.
  484. echo ""
  485. echo "**** Could not locate NSPR package. Use --with-nspr=directory,"
  486. echo " e.g. --with-nspr=/usr/local, or just --with-nspr."
  487. echo " If NSPR is not installed, specify --without-nspr."
  488. echo ""
  489. exit 1
  490. fi
  491. fi
  492. if test "$nspr_PKG" = "yes"; then
  493. #if $[ne $[CONFIG_HEADER],]
  494. AC_DEFINE(HAVE_NSPR)
  495. #endif
  496. have_nspr=yes
  497. nspr_cflags="-I$nspr_INCLUDE"
  498. nspr_ldflags="-L$nspr_LIB"
  499. nspr_libs="-lnspr3"
  500. fi
  501. fi
  502. AC_SUBST(have_nspr)
  503. AC_SUBST(nspr_cflags)
  504. AC_SUBST(nspr_lflags)
  505. AC_SUBST(nspr_libs)
  506. AM_CONDITIONAL(HAVE_NSPR, test "$have_nspr" = "yes")
  507. AC_ARG_WITH(zlib,
  508. [ --with-zlib=DIR Prefix where zlib is installed (usually /usr)])
  509. have_zlib=no
  510. include_zlib=
  511. if test "$with_zlib" != "no"; then
  512. if test "$with_zlib" = "yes" -o "$with_zlib" = ""; then
  513. AC_SEARCH_PACKAGE(/usr /usr/local,,
  514. zlib.h, z, gzopen, zlib)
  515. else
  516. AC_SEARCH_PACKAGE($with_zlib,,
  517. zlib.h, z, gzopen, zlib)
  518. fi
  519. if test "$with_zlib" != ""; then
  520. if test "$zlib_PKG" != "yes"; then
  521. dnl If the user specified to search for zlib but we didn't find it,
  522. dnl abort now.
  523. echo ""
  524. echo "**** Could not locate zlib package. Use --with-zlib=directory,"
  525. echo " e.g. --with-zlib=/usr/local, or just --with-zlib."
  526. echo " If zlib is not installed, specify --without-zlib."
  527. echo ""
  528. exit 1
  529. fi
  530. fi
  531. if test "$zlib_PKG" = "yes"; then
  532. #if $[ne $[CONFIG_HEADER],]
  533. AC_DEFINE(HAVE_ZLIB)
  534. #endif
  535. have_zlib=yes
  536. if test "$zlib_INCLUDE" != ""; then
  537. zlib_cflags="-I$zlib_INCLUDE"
  538. fi
  539. if test "$zlib_LIB" != ""; then
  540. zlib_lflags="-L$zlib_LIB"
  541. fi
  542. zlib_libs="-lz"
  543. fi
  544. fi
  545. AC_SUBST(have_zlib)
  546. AC_SUBST(zlib_cflags)
  547. AC_SUBST(zlib_lflags)
  548. AC_SUBST(zlib_libs)
  549. AM_CONDITIONAL(HAVE_ZLIB, test "$have_zlib" = "yes")
  550. AC_ARG_WITH(gl,
  551. [ --with-gl=DIR Prefix where OpenGL is installed (usually /usr)])
  552. have_gl=no
  553. include_gl=
  554. if test "$with_gl" != "no"; then
  555. if test "$with_gl" = "yes" -o "$with_gl" = ""; then
  556. AC_SEARCH_PACKAGE(/usr /usr/local,,
  557. GL/gl.h, GL, glVertex3f, gl)
  558. else
  559. AC_SEARCH_PACKAGE($with_gl,,
  560. GL/gl.h, GL, glVertex3f, gl)
  561. fi
  562. if test "$with_gl" != ""; then
  563. if test "$gl_PKG" != "yes"; then
  564. dnl If the user specified to search for OpenGL but we didn't find it,
  565. dnl abort now.
  566. echo ""
  567. echo "**** Could not locate OpenGL package. Use --with-gl=directory,"
  568. echo " e.g. --with-gl=/usr/local, or just --with-gl."
  569. echo " If OpenGL is not installed, specify --without-gl."
  570. echo ""
  571. exit 1
  572. fi
  573. fi
  574. if test "$gl_PKG" = "yes"; then
  575. #if $[ne $[CONFIG_HEADER],]
  576. AC_DEFINE(HAVE_GL)
  577. #endif
  578. have_gl=yes
  579. if test "$gl_INCLUDE" != ""; then
  580. gl_cflags="-I$gl_INCLUDE"
  581. fi
  582. if test "$gl_LIB" != ""; then
  583. gl_lflags="-L$gl_LIB"
  584. fi
  585. gl_libs="-lGL -lGLU"
  586. fi
  587. fi
  588. AC_SUBST(have_gl)
  589. AC_SUBST(gl_cflags)
  590. AC_SUBST(gl_lflags)
  591. AC_SUBST(gl_libs)
  592. AM_CONDITIONAL(HAVE_GL, test "$have_gl" = "yes")
  593. AC_ARG_WITH(glu,
  594. [ --with-glu=DIR Prefix where GL util library is installed (usually /usr)])
  595. have_glu=no
  596. include_glu=
  597. if test "$with_glu" != "no"; then
  598. if test "$with_glu" = "yes" -o "$with_glu" = ""; then
  599. AC_SEARCH_PACKAGE($gl_INCLUDE /usr /usr/local,,
  600. GL/glu.h, GLU, gluSphere, glu)
  601. else
  602. AC_SEARCH_PACKAGE($with_glu,,
  603. GL/glu.h, GLU, gluSphere, glu)
  604. fi
  605. if test "$with_glu" != ""; then
  606. if test "$glu_PKG" != "yes"; then
  607. dnl If the user specified to search for GL util library but we didn't find it,
  608. dnl abort now.
  609. echo ""
  610. echo "**** Could not locate GL util library. Use --with-glu=directory,"
  611. echo " e.g. --with-glu=/usr/local, or just --with-glu."
  612. echo " If GL util library is not installed, specify --without-glu."
  613. echo ""
  614. exit 1
  615. fi
  616. fi
  617. if test "$glu_PKG" = "yes"; then
  618. #if $[ne $[CONFIG_HEADER],]
  619. AC_DEFINE(HAVE_GLU)
  620. #endif
  621. have_glu=yes
  622. if test "$glu_INCLUDE" != ""; then
  623. glu_cflags="-I$glu_INCLUDE"
  624. fi
  625. if test "$glu_LIB" != ""; then
  626. glu_lflags="-L$glu_LIB"
  627. fi
  628. glu_libs="-lGLU -lGLUU"
  629. fi
  630. fi
  631. AC_SUBST(have_glu)
  632. AC_SUBST(glu_cflags)
  633. AC_SUBST(glu_lflags)
  634. AC_SUBST(glu_libs)
  635. AM_CONDITIONAL(HAVE_GLU, test "$have_glu" = "yes")
  636. AC_ARG_WITH(glx,
  637. [ --with-glx=DIR Prefix where GLX is installed (usually /usr)])
  638. have_glx=no
  639. include_glx=
  640. if test "$with_glx" != "no"; then
  641. if test "$with_glx" = "yes" -o "$with_glx" = ""; then
  642. AC_SEARCH_HPACKAGE($gl_INCLUDE /usr /usr/local $x_libraries,,
  643. GL/glx.h, glx)
  644. else
  645. AC_SEARCH_HPACKAGE($with_glx,,
  646. GL/glx.h, glx)
  647. fi
  648. if test "$with_glx" != ""; then
  649. if test "$glx_PKG" != "yes"; then
  650. dnl If the user specified to search for GLX but we didn't find it,
  651. dnl abort now.
  652. echo ""
  653. echo "**** Could not locate GLX package. Use --with-glx=directory,"
  654. echo " e.g. --with-glx=/usr/local, or just --with-glx."
  655. echo " If GLX is not installed, specify --without-glx."
  656. echo ""
  657. exit 1
  658. fi
  659. fi
  660. if test "$glx_PKG" = "yes"; then
  661. #if $[ne $[CONFIG_HEADER],]
  662. AC_DEFINE(HAVE_GLX)
  663. #endif
  664. have_glx=yes
  665. if test "$glx_INCLUDE" != ""; then
  666. glx_cflags="-I$glx_INCLUDE"
  667. fi
  668. fi
  669. fi
  670. AC_SUBST(have_glx)
  671. AC_SUBST(glx_cflags)
  672. AM_CONDITIONAL(HAVE_GLX, test "$have_glx" = "yes")
  673. AC_ARG_WITH(glut,
  674. [ --with-glut=DIR Prefix where glut is installed (usually /usr)])
  675. have_glut=no
  676. include_glut=
  677. if test "$with_glut" != "no"; then
  678. if test "$with_glut" = "yes" -o "$with_glut" = ""; then
  679. AC_SEARCH_PACKAGE($gl_INCLUDE /usr /usr/local $x_libraries,,
  680. GL/glut.h, glut, glutInit, glut, -lGL -lGLU)
  681. else
  682. AC_SEARCH_PACKAGE($with_glut,,
  683. GLUT/glut.h, glut, glutInit, glut, -lGL -lGLU)
  684. fi
  685. if test "$with_glut" != ""; then
  686. if test "$glut_PKG" != "yes"; then
  687. dnl If the user specified to search for glut but we didn't find it,
  688. dnl abort now.
  689. echo ""
  690. echo "**** Could not locate glut package. Use --with-glut=directory,"
  691. echo " e.g. --with-glut=/usr/local, or just --with-glut."
  692. echo " If glut is not installed, specify --without-glut."
  693. echo ""
  694. exit 1
  695. fi
  696. fi
  697. if test "$glut_PKG" = "yes"; then
  698. #if $[ne $[CONFIG_HEADER],]
  699. AC_DEFINE(HAVE_GLUT)
  700. #endif
  701. have_glut=yes
  702. if test "$glut_INCLUDE" != ""; then
  703. glut_cflags="-I$glut_INCLUDE"
  704. fi
  705. if test "$glut_LIB" != ""; then
  706. glut_lflags="-L$glut_LIB"
  707. fi
  708. glut_libs="-lglut"
  709. fi
  710. fi
  711. AC_SUBST(have_glut)
  712. AC_SUBST(glut_cflags)
  713. AC_SUBST(glut_lflags)
  714. AC_SUBST(glut_libs)
  715. AM_CONDITIONAL(HAVE_GLUT, test "$have_glut" = "yes")
  716. AC_ARG_WITH(rib,
  717. [ --with-rib Compile in the Renderman interface.])
  718. have_rib=no
  719. if test "$with_rib" = "yes"; then
  720. have_rib=yes
  721. fi
  722. AC_SUBST(have_rib)
  723. #if $[ne $[CONFIG_HEADER],]
  724. if test "$have_rib" = "yes"; then
  725. AC_DEFINE(HAVE_RIB)
  726. fi
  727. #endif
  728. AM_CONDITIONAL(HAVE_RIB, test "$have_rib" = "yes")
  729. AC_ARG_WITH(mikmod,
  730. [ --with-mikmod[=libmikmod-config] Use the mikmod interface for audio.])
  731. have_mikmod=no
  732. include_mikmod=
  733. if test "$with_mikmod" != "no"; then
  734. if test "$with_mikmod" = "" -o "$with_mikmod" = "yes"; then
  735. dnl search for the libmikmod-config program on the path.
  736. AC_CHECK_PROG(with_mikmod, libmikmod-config, libmikmod-config, "no")
  737. fi
  738. fi
  739. if test "$with_mikmod" != "no"; then
  740. have_mikmod=yes
  741. CFLAGS="$CFLAGS "`$with_mikmod --cflags`
  742. CXXFLAGS="$CXXFLAGS "`$with_mikmod --cflags`
  743. LDFLAGS="$LDFLAGS "`$with_mikmod --libs`
  744. #if $[ne $[CONFIG_HEADER],]
  745. AC_DEFINE(HAVE_MIKMOD)
  746. #endif
  747. fi
  748. AC_SUBST(have_mikmod)
  749. AM_CONDITIONAL(HAVE_MIKMOD, test "$have_mikmod" = "yes")
  750. ldflags=$LDFLAGS
  751. AC_SUBST(ldflags)
  752. AC_OUTPUT([$[TREE:%=%/Makefile]])
  753. #end configure.in
  754. //////////////////////////////////////////////////////////////////////
  755. #endif // DIR_TYPE