Template.autoconf.pp 26 KB

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