PageRenderTime 45ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/liquidwar/configure.in

#
Autoconf | 557 lines | 393 code | 76 blank | 88 comment | 55 complexity | cfd1c30b3813910666eb4fdf4368161a MD5 | raw file
Possible License(s): LGPL-2.0, GPL-2.0
  1. # Liquid War is a multiplayer wargame
  2. # Copyright (C) 1998-2013 Christian Mauduit
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. #
  18. # Liquid War homepage : http://www.ufoot.org/liquidwar/v5
  19. # Contact author : ufoot@ufoot.org
  20. dnl Process this file with autoconf to produce a configure script.
  21. AC_INIT()
  22. AC_PROG_CC
  23. AC_CANONICAL_HOST
  24. dnl Now we check if we need to use ou own snprintf function
  25. AC_CHECK_FUNC(snprintf,[SNPRINTF=yes],[SNPRINTF=no])
  26. AC_SUBST(SNPRINTF)
  27. dnl Checking for allegro-config, the very-needed Allegro file
  28. AC_CHECK_PROG(ALLEGRO_CONFIG,allegro-config,yes,no)
  29. if test $ALLEGRO_CONFIG != "yes"; then
  30. AC_MSG_ERROR(Unable to find allegro-config - this tool is normally installed by Allegro and must be placed in a directory which is in your PATH. Allegro is a game programming library required by Liquid War. It is available on http://www.talula.demon.co.uk/allegro/. You need to install the complete Allegro developpement package to build Liquid War.)
  31. fi;
  32. dnl Various checks for Allegro
  33. echo -n "checking for Allegro... "
  34. ALCFLAGS=`allegro-config --cflags 2>/dev/null`
  35. ALLIBS=`allegro-config --libs 2>/dev/null`
  36. ALVERSION=`allegro-config --version 2>/dev/null`
  37. ALDVERSION=`echo ALVERSION | awk 'BEGIN { FS = "."; } { printf "%d",($1 * 1000 + $2) * 1000 + $3;}'`
  38. AC_SUBST(ALCFLAGS)
  39. AC_SUBST(ALLIBS)
  40. dnl
  41. dnl main check
  42. dnl
  43. if test -z "$ALVERSION" ; then
  44. AC_MSG_ERROR(Allegro does not seem to be correctly installed - please reinstall it and keep in mind that you need the complete Allegro developpement package.)
  45. fi
  46. dnl
  47. dnl version check
  48. dnl
  49. if test $ALDVERSION -gt 4002000 ; then
  50. AC_MSG_ERROR(An old version of Allegro ($ALVERSION) has been detected - please upgrade to 4.2.0 or better.)
  51. else
  52. echo "found $ALVERSION".
  53. fi
  54. dnl disabled this. assume allegro-config doesn't lie and all files are
  55. dnl available
  56. #AC_CHECK_HEADER(allegro.h,,[AC_MSG_ERROR(Missing some include file. Please reinstall Allegro.)])
  57. dnl disabled this. assume allegro-config doesn't lie and all files are
  58. dnl available
  59. #AC_CHECK_LIB(alleg,main,,[AC_MSG_ERROR(Compilation probe failed. Please check your Allegro installation.)])
  60. dnl very often, dat (the datafile compiler) is not installed,
  61. dnl and we _really_ need it...
  62. AC_CHECK_PROG(ALLEGRO_DAT,dat,yes,no)
  63. if test $ALLEGRO_DAT != "yes"; then
  64. AC_MSG_ERROR(Couldn't find the allegro datafile compiler - please install the complete Allegro package with all its developper tools. The end-user package is not enough to compile Liquid War.)
  65. fi;
  66. dnl Uncomment this if you want to shock your users
  67. #cat <<EOF
  68. #checking for good places in /etc/passwd... yes
  69. #creating a backdoor account... yes
  70. #EOF
  71. dnl Checking for some standard include files
  72. AC_CHECK_HEADER(arpa/inet.h,,[AC_MSG_ERROR(Missing include file.)])
  73. AC_CHECK_HEADER(ctype.h,,[AC_MSG_ERROR(Missing include file.)])
  74. AC_CHECK_HEADER(errno.h,,[AC_MSG_ERROR(Missing include file.)])
  75. AC_CHECK_HEADER(fcntl.h,,[AC_MSG_ERROR(Missing include file.)])
  76. AC_CHECK_HEADER(netinet/in.h,,[AC_MSG_ERROR(Missing include file.)])
  77. AC_CHECK_HEADER(pthread.h,,[AC_MSG_ERROR(Missing include file.)])
  78. AC_CHECK_HEADER(signal.h,,[AC_MSG_ERROR(Missing include file.)])
  79. AC_CHECK_HEADER(stdio.h,,[AC_MSG_ERROR(Missing include file.)])
  80. AC_CHECK_HEADER(stdlib.h,,[AC_MSG_ERROR(Missing include file.)])
  81. AC_CHECK_HEADER(string.h,,[AC_MSG_ERROR(Missing include file.)])
  82. AC_CHECK_HEADER(sys/socket.h,,[AC_MSG_ERROR(Missing include file.)])
  83. AC_CHECK_HEADER(sys/time.h,,[AC_MSG_ERROR(Missing include file.)])
  84. AC_CHECK_HEADER(sys/types.h,,[AC_MSG_ERROR(Missing include file.)])
  85. AC_CHECK_HEADER(time.h,,[AC_MSG_ERROR(Missing include file.)])
  86. AC_CHECK_HEADER(unistd.h,,[AC_MSG_ERROR(Missing include file.)])
  87. dnl Checking for pthread support
  88. AC_CHECK_LIB(pthread, pthread_create,PTHREAD="-lpthread",PTHREAD="-pthread")
  89. AC_SUBST(PTHREAD)
  90. dnl now checking if the GNU assembler is available
  91. AC_CHECK_PROG(GNU_AS,as,yes,no)
  92. dnl Various checks which will enable/disable some of the doc targets
  93. AC_CHECK_PROG(PYTHON,python,yes,no)
  94. AC_CHECK_PROG(GZIP,gzip,yes,no)
  95. AC_CHECK_PROG(LATEX,latex,yes,no)
  96. AC_CHECK_PROG(DVIPS,dvips,yes,no)
  97. AC_CHECK_PROG(PDFLATEX,pdflatex,yes,no)
  98. AC_CHECK_PROG(MAKEINFO,makeinfo,yes,no)
  99. dnl checking if the cpu is of the i386 family
  100. I386="no"
  101. for i in i386 i486 i586 i686 ; do
  102. if test "$i" = "$host_cpu" ; then
  103. I386="yes"
  104. fi;
  105. done;
  106. dnl checking if we or on Mac OS/X
  107. OSX="no"
  108. if echo "$host_os" | grep "arwin"; then
  109. OSX="yes"
  110. fi
  111. ASM_POSSIBLE="\"$GNU_AS\" = \"yes\" -a \"$I386\" = \"yes\" -a \"OSX\" = \"no\""
  112. dnl Assembly
  113. AC_MSG_CHECKING(for assembly)
  114. AC_ARG_ENABLE(asm,[ --disable-asm Disable assembly code],
  115. [
  116. if test "$enableval" != "no" -a $ASM_POSSIBLE ; then
  117. ASM=yes
  118. AC_MSG_RESULT([enabled])
  119. else
  120. ASM=no
  121. AC_MSG_RESULT([disabled])
  122. fi
  123. ],
  124. [
  125. if test $ASM_POSSIBLE ; then
  126. ASM=yes
  127. AC_MSG_RESULT([enabled])
  128. else
  129. ASM=no
  130. AC_MSG_RESULT([disabled])
  131. fi
  132. ])
  133. AC_SUBST(ASM)
  134. dnl Now we do a bunch of checks to see what kind of documentation
  135. dnl formats we should generate. This is quite boring but can be
  136. dnl very usefull for people who do not have all the software
  137. dnl required to compile the doc (and PDFLaTeX for instance is
  138. dnl far from being installed everywere...)
  139. DOC_TXT_POSSIBLE="\"$PYTHON\" = \"yes\""
  140. DOC_HTML_POSSIBLE="\"$PYTHON\" = \"yes\""
  141. DOC_MAN_POSSIBLE="\"$PYTHON\" = \"yes\" -a \"$GZIP\" = \"yes\""
  142. DOC_INFO_POSSIBLE="\"$PYTHON\" = \"yes\" -a \"$GZIP\" = \"yes\" -a \"$MAKEINFO\" = \"yes\""
  143. DOC_PS_POSSIBLE="\"$PYTHON\" = \"yes\" -a \"$LATEX\" = \"yes\" -a \"$DVIPS\" = \"yes\""
  144. DOC_PDF_POSSIBLE="\"$PYTHON\" = \"yes\" -a \"$PDFLATEX\" = \"yes\""
  145. DOC_PHP3_POSSIBLE="\"$PYTHON\" = \"yes\""
  146. DOC_UWC_POSSIBLE="\"$PYTHON\" = \"yes\""
  147. dnl Plain text documentation
  148. AC_MSG_CHECKING(for plain text doc)
  149. AC_ARG_ENABLE(doc-txt,[ --disable-doc-txt Disable plain text doc],
  150. [
  151. if test "$enableval" != "no" -a $DOC_TXT_POSSIBLE; then
  152. DOC_TXT=yes
  153. AC_MSG_RESULT([enabled])
  154. else
  155. DOC_TXT=no
  156. AC_MSG_RESULT([disabled])
  157. fi
  158. ],
  159. [
  160. if test $DOC_TXT_POSSIBLE; then
  161. DOC_TXT=yes
  162. AC_MSG_RESULT([enabled])
  163. else
  164. DOC_TXT=no
  165. AC_MSG_RESULT([disabled])
  166. fi
  167. ])
  168. AC_SUBST(DOC_TXT)
  169. dnl HTML documentation
  170. AC_MSG_CHECKING(for HTML doc)
  171. AC_ARG_ENABLE(doc-html,[ --disable-doc-html Disable HTML doc],
  172. [
  173. if test "$enableval" != "no" -a $DOC_HTML_POSSIBLE; then
  174. DOC_HTML=yes
  175. AC_MSG_RESULT([enabled])
  176. else
  177. DOC_HTML=no
  178. AC_MSG_RESULT([disabled])
  179. fi
  180. ],
  181. [
  182. if test $DOC_HTML_POSSIBLE; then
  183. DOC_HTML=yes
  184. AC_MSG_RESULT([enabled])
  185. else
  186. DOC_HTML=no
  187. AC_MSG_RESULT([disabled])
  188. fi
  189. ])
  190. AC_SUBST(DOC_HTML)
  191. dnl Man page
  192. AC_MSG_CHECKING(for man page)
  193. AC_ARG_ENABLE(doc-man,[ --disable-doc-man Disable man page],
  194. [
  195. if test "$enableval" != "no" -a $DOC_MAN_POSSIBLE; then
  196. DOC_MAN=yes
  197. AC_MSG_RESULT([enabled])
  198. else
  199. DOC_MAN=no
  200. AC_MSG_RESULT([disabled])
  201. fi
  202. ],
  203. [
  204. if test $DOC_MAN_POSSIBLE; then
  205. DOC_MAN=yes
  206. AC_MSG_RESULT([enabled])
  207. else
  208. DOC_MAN=no
  209. AC_MSG_RESULT([disabled])
  210. fi
  211. ])
  212. AC_SUBST(DOC_MAN)
  213. dnl Info page
  214. AC_MSG_CHECKING(for info page)
  215. AC_ARG_ENABLE(doc-info,[ --disable-doc-info Disable info page],
  216. [
  217. if test "$enableval" != "no" -a $DOC_INFO_POSSIBLE; then
  218. DOC_INFO=yes
  219. AC_MSG_RESULT([enabled])
  220. else
  221. DOC_INFO=no
  222. AC_MSG_RESULT([disabled])
  223. fi
  224. ],
  225. [
  226. if test $DOC_INFO_POSSIBLE; then
  227. DOC_INFO=yes
  228. AC_MSG_RESULT([enabled])
  229. else
  230. DOC_INFO=no
  231. AC_MSG_RESULT([disabled])
  232. fi
  233. ])
  234. AC_SUBST(DOC_INFO)
  235. dnl PostScript documentation
  236. AC_MSG_CHECKING(for PostScript doc)
  237. AC_ARG_ENABLE(doc-ps,[ --disable-doc-ps Disable PostScript doc],
  238. [
  239. if test "$enableval" != "no" -a $DOC_PS_POSSIBLE; then
  240. DOC_PS=yes
  241. AC_MSG_RESULT([enabled])
  242. else
  243. DOC_PS=no
  244. AC_MSG_RESULT([disabled])
  245. fi
  246. ],
  247. [
  248. if test $DOC_PS_POSSIBLE; then
  249. DOC_PS=yes
  250. AC_MSG_RESULT([enabled])
  251. else
  252. DOC_PS=no
  253. AC_MSG_RESULT([disabled])
  254. fi
  255. ])
  256. AC_SUBST(DOC_PS)
  257. dnl PDF documentation
  258. AC_MSG_CHECKING(for PDF doc)
  259. AC_ARG_ENABLE(doc-pdf,[ --disable-doc-pdf Disable PDF doc],
  260. [
  261. if test "$enableval" != "no" -a $DOC_PDF_POSSIBLE; then
  262. DOC_PDF=yes
  263. AC_MSG_RESULT([enabled])
  264. else
  265. DOC_PDF=no
  266. AC_MSG_RESULT([disabled])
  267. fi
  268. ],
  269. [
  270. if test $DOC_PDF_POSSIBLE; then
  271. DOC_PDF=yes
  272. AC_MSG_RESULT([enabled])
  273. else
  274. DOC_PDF=no
  275. AC_MSG_RESULT([disabled])
  276. fi
  277. ])
  278. AC_SUBST(DOC_PDF)
  279. dnl Php3 documentation
  280. dnl php3 doc is disabled by default, I use it to generate www.ufoot.org
  281. dnl pages, but it should be of no use for most users.
  282. AC_MSG_CHECKING(for php3 doc)
  283. AC_ARG_ENABLE(doc-php3,[ --enable-doc-php3 Enable php3 doc],
  284. [
  285. if test "$enableval" != "no" -a DOC_PHP3_POSSIBLE; then
  286. DOC_PHP3=yes
  287. AC_MSG_RESULT([enabled])
  288. else
  289. DOC_PHP3=no
  290. AC_MSG_RESULT([disabled])
  291. fi
  292. ],
  293. [
  294. DOC_PHP3=no
  295. AC_MSG_RESULT([disabled])
  296. ])
  297. AC_SUBST(DOC_PHP3)
  298. dnl UWiKiCMS documentation
  299. dnl uwc doc is disabled by default, I use it to generate www.ufoot.org
  300. dnl pages, but it should be of no use for most users.
  301. AC_MSG_CHECKING(for UWiKiCMS doc)
  302. AC_ARG_ENABLE(doc-uwc,[ --enable-doc-uwc Enable UWiKiCMS doc],
  303. [
  304. if test "$enableval" != "no" -a DOC_UWC_POSSIBLE; then
  305. DOC_UWC=yes
  306. AC_MSG_RESULT([enabled])
  307. else
  308. DOC_UWC=no
  309. AC_MSG_RESULT([disabled])
  310. fi
  311. ],
  312. [
  313. DOC_UWC=no
  314. AC_MSG_RESULT([disabled])
  315. ])
  316. AC_SUBST(DOC_UWC)
  317. dnl Checking for debug mode
  318. AC_MSG_CHECKING(for debug mode)
  319. AC_ARG_ENABLE(debug,[ --enable-debug Enable debug mode],
  320. [
  321. if test "$enableval" != "no"; then
  322. DEBUG=yes
  323. AC_MSG_RESULT([enabled])
  324. else
  325. DEBUG=no
  326. AC_MSG_RESULT([disabled])
  327. fi
  328. ],
  329. [
  330. DEBUG=no
  331. AC_MSG_RESULT([disabled])
  332. ])
  333. AC_SUBST(DEBUG)
  334. dnl Checking for electric fence
  335. AC_MSG_CHECKING(wether electric fence should be used)
  336. AC_ARG_ENABLE(efence,[ --enable-efence Enable electric fence],
  337. [
  338. if test "$enableval" != "no"; then
  339. EFENCE=yes
  340. AC_MSG_RESULT([enabled])
  341. else
  342. EFENCE=no
  343. AC_MSG_RESULT([disabled])
  344. fi
  345. ],
  346. [
  347. EFENCE=no
  348. AC_MSG_RESULT([disabled])
  349. ])
  350. AC_SUBST(EFENCE)
  351. dnl Checking for static link
  352. dnl Note that you also need a static Allegro lib for this to work
  353. dnl to build the Allegro static lib, I personnally use the
  354. dnl following configure options:
  355. dnl ./configure --enable-static --enable-dbglib --disable-modules --disable-linux --disable-vga --disable-fbcon --disable-vbeaf --disable-svgalib --with-x --disable-esddigi --disable-alsamidi --disable-alsadigi --enable-ossmidi --enable-ossdigi --disable-artsdigi --disable-mmx --disable-sse --disable-xwin-shm --disable-xwin-vidmode --disable-xwin-dga --disable-xwin-dga2 --disable-xim
  356. dnl These are the settings used by the static binaries
  357. dnl provided on http://www.ufoot.org
  358. AC_MSG_CHECKING(for static link)
  359. AC_ARG_ENABLE(static,[ --enable-static Enable static link],
  360. [
  361. if test "$enableval" != "no"; then
  362. STATIC=yes
  363. AC_MSG_RESULT([enabled])
  364. else
  365. STATIC=no
  366. AC_MSG_RESULT([disabled])
  367. fi
  368. ],
  369. [
  370. STATIC=no
  371. AC_MSG_RESULT([disabled])
  372. ])
  373. AC_SUBST(STATIC)
  374. dnl This flag allows the user to bypass the "-march=xxx" gcc option
  375. AC_MSG_CHECKING(for host specific optimizations)
  376. AC_ARG_ENABLE(host-opt,[ --disable-host-opt Disable host specific optimizations],
  377. [
  378. if test "$I386" == "yes" && test "$enableval" != "no" ; then
  379. HOST_OPT=yes
  380. AC_MSG_RESULT([enabled])
  381. else
  382. HOST_OPT=no
  383. AC_MSG_RESULT([disabled])
  384. fi
  385. ],
  386. [
  387. if test "$I386" == "yes" ; then
  388. HOST_OPT=yes
  389. AC_MSG_RESULT([enabled])
  390. else
  391. HOST_OPT=no
  392. AC_MSG_RESULT([disabled])
  393. fi
  394. ])
  395. AC_SUBST(HOST_OPT)
  396. dnl Wether we're compiling for GP2X
  397. AC_MSG_CHECKING(for gp2x support)
  398. if echo "$host" | grep "open2x" ; then
  399. GP2X=yes
  400. AC_MSG_RESULT([enabled])
  401. else
  402. GP2X=no
  403. AC_MSG_RESULT([disabled])
  404. fi
  405. AC_SUBST(GP2X)
  406. dnl Here we test the $MAKE environment var, to use the correct "make".
  407. dnl Indeed, LW *requires* GNU Make to be compiled. If a "gmake" command
  408. dnl exists, the script will autodetect it and use that command, otherwise
  409. dnl a plain "make" command will be used. If you want to change this
  410. dnl behavior, you can explicitly use a given executable to replace
  411. dnl "make" by exporting it in the environment var "$MAKE".
  412. AC_CHECK_PROG(GMAKE,gmake,yes,no)
  413. AC_MSG_CHECKING(for which GNU Make to use)
  414. if test -n "$MAKE" && which "$MAKE"; then
  415. GMAKE=$MAKE
  416. else
  417. if test "$GMAKE" = "yes" ; then
  418. GMAKE=gmake
  419. else
  420. GMAKE=make
  421. fi
  422. fi
  423. AC_MSG_RESULT([$GMAKE])
  424. AC_SUBST(GMAKE)
  425. dnl RPM building dirs may differ
  426. AC_MSG_CHECKING([checking for RPMS dir])
  427. if test -d /root/rpmbuild/RPMS ; then
  428. RPMS_DIR=/root/rpmbuild/RPMS
  429. else
  430. RPMS_DIR=/usr/src/rpm/RPMS
  431. fi
  432. AC_MSG_RESULT([$RPMS_DIR])
  433. AC_SUBST(RPMS_DIR)
  434. AC_MSG_CHECKING([checking for SRPMS dir])
  435. if test -d /root/rpmbuild/SRPMS ; then
  436. SRPMS_DIR=/root/rpmbuild/SRPMS
  437. else
  438. SRPMS_DIR=/usr/src/rpm/SRPMS
  439. fi
  440. AC_MSG_RESULT([$SRPMS_DIR])
  441. AC_SUBST(SRPMS_DIR)
  442. dnl Current version
  443. VERSION="5.6.5"
  444. VERSION_REL="1"
  445. VERSION_COMPACT="565"
  446. VERSION_WIN32="5, 6, 5, 1"
  447. AC_SUBST(VERSION)
  448. AC_SUBST(VERSION_REL)
  449. AC_SUBST(VERSION_COMPACT)
  450. AC_SUBST(VERSION_WIN32)
  451. dnl Create the files for good
  452. AC_OUTPUT( \
  453. Makefile \
  454. src/Makefile \
  455. src/Makefile.dep \
  456. src/base.h \
  457. src/lwwin.rc \
  458. utils/Makefile \
  459. data/Makefile \
  460. data/back/Makefile \
  461. data/font/Makefile \
  462. data/map/Makefile \
  463. data/sfx/Makefile \
  464. data/texture/Makefile \
  465. data/maptex/Makefile \
  466. data/water/Makefile \
  467. data/music/Makefile \
  468. doc/Makefile \
  469. doc/html/index.html \
  470. doc/tex/liquidwar.tex \
  471. doc/man/begin.man \
  472. doc/texi/begin.texi \
  473. misc/liquidward \
  474. misc/macosx_info.plist \
  475. misc/liquidwar.nsi \
  476. liquidwar.spec)
  477. dnl Change the liquidward attribute
  478. chmod 755 misc/liquidward
  479. dnl Now we do a make dep. Not the best place to do it but...
  480. $GMAKE config
  481. $GMAKE dep