1#!/bin/sh
2#
3# Do not edit!
4# This file was generated from configure.in by BSDBuild 3.0.
5#
6# To regenerate this file, get the latest BSDBuild release from
7# http://hypertriton.com/bsdbuild/, and use the command:
8#
9#     $ cat configure.in | mkconfigure > configure
10#
11# Copyright (c) 2001-2012 Hypertriton, Inc. <http://hypertriton.com/>
12# All rights reserved.
13#
14# Redistribution and use in source and binary forms, with or without
15# modification, are permitted provided that the following conditions
16# are met:
17# 1. Redistributions of source code must retain the above copyright
18#    notice, this list of conditions and the following disclaimer.
19# 2. Redistributions in binary form must reproduce the above copyright
20#    notice, this list of conditions and the following disclaimer in the
21#    documentation and/or other materials provided with the distribution.
22#
23# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
27# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28# DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
32# USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33#
34PACKAGE="Untitled"
35VERSION=""
36RELEASE=""
37
38optarg=
39for arg
40do
41	case "$arg" in
42	-*=*)
43	    optarg=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'`
44	    ;;
45	*)
46	    optarg=
47	    ;;
48	esac
49
50	case "$arg" in
51	--build=*)
52	    build_arg=$optarg
53	    ;;
54	--host=*)
55	    host_arg=$optarg
56	    ;;
57	--target=*)
58	    target=$optarg
59	    ;;
60	--emul-os=*)
61	    PROJ_TARGET=$optarg
62	    ;;
63	--byte-order=*)
64	    byte_order=$optarg
65	    ;;
66	--prefix=*)
67	    prefix=$optarg
68	    ;;
69	--exec-prefix=*)
70	    exec_prefix=$optarg
71	    ;;
72	--sysconfdir=*)
73	    sysconfdir=$optarg
74	    ;;
75	--bindir=*)
76	    bindir=$optarg
77	    ;;
78	--libdir=*)
79	    libdir=$optarg
80	    ;;
81	--moduledir=*)
82	    moduledir=$optarg
83	    ;;
84	--libexecdir=*)
85	    libexecdir=$optarg
86	    ;;
87	--datadir=*)
88	    datadir=$optarg
89	    ;;
90	--statedir=* | --localstatedir=*)
91	    statedir=$optarg
92	    ;;
93	--localedir=*)
94	    localedir=$optarg
95	    ;;
96	--mandir=*)
97	    mandir=$optarg
98	    ;;
99	--infodir=* | --datarootdir=* | --docdir=* | --htmldir=* | --dvidir=* | --pdfdir=* | --psdir=* | --sharedstatedir=* | --sbindir=*)
100	    ;;
101	--enable-*)
102	    option=`echo $arg | sed -e 's/--enable-//' -e 's/=.*//'`
103	    option=`echo $option | sed 's/-/_/g'`
104	    case "$arg" in
105	        *=*)
106	            eval "enable_${option}='$optarg'"
107	            eval "prefix_${option}='$optarg'"
108		    ;;
109		*)
110	            eval "enable_${option}=yes"
111		    ;;
112	    esac
113	    ;;
114	--disable-*)
115	    option=`echo $arg | sed -e 's/--disable-//'`;
116	    option=`echo $option | sed 's/-/_/g'`
117	    eval "enable_${option}=no"
118	    ;;
119	--with-*)
120	    option=`echo $arg | sed -e 's/--with-//' -e 's/=.*//'`
121	    option=`echo $option | sed 's/-/_/g'`
122	    case "$arg" in
123	        *=*)
124	            eval "with_${option}='$optarg'"
125	            eval "prefix_${option}='$optarg'"
126		    ;;
127		*)
128	            eval "with_${option}=yes"
129		    ;;
130	    esac
131	    ;;
132	--without-*)
133	    option=`echo $arg | sed -e 's/--without-//'`;
134	    option=`echo $option | sed 's/-/_/g'`
135	    eval "with_${option}=no"
136	    ;;
137	--help)
138	    show_help=yes
139	    ;;
140	--version)
141	    show_version=yes
142	    ;;
143	--srcdir=*)
144	    srcdir=$optarg
145	    ;;
146	--testdir=*)
147	    testdir=$optarg
148	    ;;
149	--cache=*)
150	    cache=$optarg
151	    ;;
152	--includes=*)
153	    includes=$optarg
154	    ;;
155	--cache-file=*)
156	    ;;
157	--config-cache | -C)
158	    ;;
159	*)
160	    echo "invalid argument: $arg"
161	    echo "try ./configure --help"
162	    exit 1
163	    ;;
164	esac
165done
166if [ -e "/bin/echo" ]; then
167    /bin/echo -n ""
168    if [ $? = 0 ]; then
169    	ECHO_N="/bin/echo -n"
170    else
171    	ECHO_N="echo -n"
172    fi
173else
174    ECHO_N="echo -n"
175fi
176PERL=""
177for path in `echo $PATH | sed 's/:/ /g'`; do
178	if [ -x "${path}" ]; then
179		if [ -e "${path}/perl" ]; then
180			PERL="${path}/perl"
181			break
182		fi
183	fi
184done
185PKGCONFIG=""
186for path in `echo $PATH | sed 's/:/ /g'`; do
187	if [ -x "${path}" ]; then
188		if [ -e "${path}/pkg-config" ]; then
189			PKGCONFIG="${path}/pkg-config"
190			break
191		fi
192	fi
193done
194if [ "${prefix}" != "" ]; then
195    PREFIX="$prefix"
196else
197    PREFIX="/usr/local"
198fi
199if [ "${exec_prefix}" != "" ]; then
200    EXEC_PREFIX="$exec_prefix"
201else
202    EXEC_PREFIX="${PREFIX}"
203fi
204if [ "${srcdir}" != "" ]; then
205	if [ "${PERL}" = "" ]; then
206		echo "*"
207		echo "* Separate build (--srcdir) requires perl, but there is"
208		echo "* no perl interpreter to be found in your PATH."
209		echo "*"
210		exit 1
211	fi
212	SRC=${srcdir}
213else
214	SRC=`pwd`
215fi
216BLD=`pwd`
217SRCDIR="${SRC}"
218BLDDIR="${BLD}"
219
220if [ "${testdir}" != "" ]; then
221	echo "Configure tests will be executed in ${testdir}"
222	if [ ! -e "${testdir}" ]; then
223		echo "Creating ${testdir}"
224		mkdir ${testdir}
225	fi
226else
227	testdir="."
228fi
229if [ "${includes}" = "" ]; then
230	includes="yes"
231fi
232case "${includes}" in
233yes|no)
234	;;
235link)
236	if [ "${with_proj_generation}" ]; then
237		echo "Cannot use --includes=link with --with-proj-generation!"
238		exit 1
239	fi
240	;;
241*)
242	echo "Usage: --includes [yes|no|link]"
243	exit 1
244	;;
245esac
246if [ "${srcdir}" = "" ]; then
247	cat << EOT > configure.dep.pl
248#!/usr/bin/perl
249# Public domain.
250# Scan Makefiles for "include .depend" and generate empty ".depend" files,
251# such that make can be run prior to an initial "make depend".
252#
253
254my %V = ();
255
256sub MakefileIncludesDepend (\$\$)
257{
258	my \$path = shift;
259	my \$cwd = shift;
260
261	if (!open(MF, \$path)) {
262		return (0);
263	}
264	my @lines = ();
265	foreach \$_ (<MF>) {
266		chop;
267
268		if (/^(.+)\\\\\$/) {			# Expansion
269			\$line .= \$1;
270		} else {				# New line
271			if (\$line) {
272				push @lines, \$line . \$_;
273				\$line = '';
274			} else {
275				push @lines, \$_;
276			}
277		}
278	}
279	foreach \$_ (@lines) {
280		if (/^\\s*#/) { next; }
281		if (/^\\t/) { next; }
282		s/\\\$\\{(\\w+)\\}/\$V{\$1}/g;
283		if (/^\\s*(\\w+)\\s*=\\s*"(.+)"\$/ ||
284		    /^\\s*(\\w+)\\s*=\\s*(.+)\$/) {
285			\$V{\$1} = \$2;
286		} elsif (/^\\s*(\\w+)\\s*\\+=\\s*"(.+)"\$/ ||
287		         /^\\s*(\\w+)\\s*\\+=\\s*(.+)\$/) {
288			if (exists(\$V{\$1}) && \$V{\$1} ne '') {
289				\$V{\$1} .= ' '.\$2;
290			} else {
291				\$V{\$1} = \$2;
292			}
293		}
294		if (/^\\s*include\\s+(.+)\$/) {
295			if (\$1 eq '.depend' ||
296			    MakefileIncludesDepend(\$cwd.'/'.\$1, \$cwd)) {
297				return (1);
298			}
299		}
300	}
301	close(MF);
302	return (0);
303}
304
305sub Scan (\$)
306{
307	my \$dir = shift;
308
309	unless (opendir(CWD, \$dir)) {
310		print STDERR "\$dir: opendir: \$!; ignoring\\n";
311		return;
312	}
313	%V = ();
314	if (-e \$dir.'/Makefile' &&
315	    MakefileIncludesDepend("\$dir/Makefile", \$dir)) {
316		if (open(OUT, ">\$dir/.depend")) {
317			close(OUT);
318		} else {
319			print STDERR "\$dir/.depend: \$!; ignoring\\n";
320		}
321	}
322	foreach my \$ent (readdir(CWD)) {
323		my \$file = \$dir.'/'.\$ent;
324
325		if (\$ent =~ /^\\./) {
326			next;
327		}
328		if (-d \$file) {
329			Scan(\$file);
330			next;
331		}
332	}
333	closedir(CWD);
334}
335if (@ARGV < 1) {
336	print STDERR "Usage: gen-dotdepend.pl [directory]\\n";
337	exit(1);
338}
339Scan(\$ARGV[0]);
340EOT
341	if [ "${PERL}" != "" ]; then
342		${PERL} configure.dep.pl .
343		rm -f configure.dep.pl
344	else
345		echo "*"
346		echo "* Warning: No perl was found. Perl is required for automatic"
347		echo "* generation of .depend files. You may need to create empty"
348		echo "* .depend files where it is required."
349		echo "*"
350	fi
351fi
352if [ "${show_help}" = "yes" ]; then
353echo "This configure script was generated by BSDBuild 3.0."
354echo "<http://bsdbuild.hypertriton.com/>"
355echo ""
356echo "Usage: ./configure [options]"
357echo ""
358echo "Standard build options:"
359echo "    --bindir=DIR              Executables for common users [PREFIX/bin]"
360echo "    --build=STRING            Host environment for build [auto-detect]"
361echo "    --byte-order=STRING       Byte order for build (LE|BE) [auto-detect]"
362echo "    --cache=DIR               Cache ./configure results in directory [none]"
363echo "    --datadir=DIR|NONE        Data files for program use [PREFIX/share]"
364echo "    --enable-nls              Multi-language support [no]"
365echo "    --exec-prefix=DIR         Machine-dependent installation base [PREFIX]"
366echo "    --host=STRING             Cross-compile for target environment [BUILD]"
367echo "    --includes=STRING         Preprocess C headers (yes|no|link) [yes]"
368echo "    --libdir=DIR              System libraries [PREFIX/lib]"
369echo "    --libexecdir=DIR          Executables for program use [PREFIX/libexec]"
370echo "    --localedir=DIR           Multi-language support locales [DATADIR/locale]"
371echo "    --mandir=DIR              Manual page documentation [PREFIX/man]"
372echo "    --moduledir=DIR|NONE      Dynamically loaded modules [PREFIX/lib]"
373echo "    --prefix=DIR              Installation base [/usr/local]"
374echo "    --srcdir=DIR              Source directory for concurrent build [.]"
375echo "    --statedir=DIR|NONE       Modifiable single-machine data [PREFIX/var]"
376echo "    --sysconfdir=DIR|NONE     System configuration files [PREFIX/etc]"
377echo "    --testdir=DIR             Execute all tests in this directory [.]"
378echo "    --with-catman             Install cat files for manual pages [auto-detect]"
379echo "    --with-ctags              Generate ctags(1) tag files [no]"
380echo "    --with-docs               Generate printable documentation [no]"
381echo "    --with-gettext            Use gettext for multi-language [auto-detect]"
382echo "    --with-libtool            Specify path to libtool [bundled]"
383echo "    --with-manlinks           Add manual entries for every function [no]"
384echo "    --with-manpages           Generate Unix manual pages [yes]"
385echo ""
386echo "Test program options:"
387echo "    --enable-warnings           Suggested compiler warnings [no]"
388exit 1
389fi;
390if [ "${show_version}" = "yes" ]; then
391echo "BSDBuild 3.0"
392exit 0
393fi;
394if [ "${srcdir}" != "" ]; then
395	build_guessed=`sh ${srcdir}/../../mk/config.guess`
396else
397	build_guessed=`sh ../../mk/config.guess`
398fi
399if [ $? != 0 ]; then
400	echo "../../mk/config.guess failed"
401	exit 1
402fi
403if [ "${build_arg}" != "" ]; then
404	build="${build_arg}"
405else
406	build="${build_guessed}"
407fi
408if [ "${host_arg}" != "" ]; then
409	host="${host_arg}"
410else
411	host="${build}"
412fi
413if [ "${host}" != "${build_guessed}" ]; then
414	CROSS_COMPILING="yes"
415else
416	CROSS_COMPILING="no"
417fi
418echo "BSDBuild 3.0 (http://bsdbuild.hypertriton.com)"
419
420echo "#!/bin/sh" > config.status
421echo "# Generated by configure script (BSDBuild 3.0)." >> config.status
422echo "Generated by configure script (BSDBuild 3.0)." > config.log
423
424if [ -e "Makefile.config" ]; then
425	echo "* Overwriting existing Makefile.config"
426fi
427echo "# Generated by configure script (BSDBuild 3.0)." > Makefile.config
428echo "" >> Makefile.config
429echo "BUILD=${build}" >> Makefile.config
430echo "HOST=${host}" >> Makefile.config
431echo "CROSS_COMPILING=${CROSS_COMPILING}" >> Makefile.config
432echo "SRCDIR=${SRC}" >> Makefile.config
433echo "BLDDIR=${BLD}" >> Makefile.config
434
435echo -n "./configure" >> config.log
436echo -n "./configure" >> config.status
437for arg
438do
439	echo -n " $arg" >> config.log
440	echo -n " $arg" >> config.status
441done
442echo "" >> config.log
443echo "" >> config.status
444
445if [ -e "$BLD/config" ]; then
446	echo "* Overwriting $BLD/config directory"
447	rm -fR "$BLD/config"
448fi
449mkdir -p "$BLD/config"
450if [ $? != 0 ]; then
451	echo "Could not create $BLD/config directory."
452	exit 1
453fi
454HAVE_MANDOC="no"
455NROFF=""
456for path in `echo $PATH | sed 's/:/ /g'`; do
457	if [ -x "${path}/nroff" ]; then
458		NROFF="${path}/nroff"
459	fi
460done
461if [ "${NROFF}" != "" ]; then
462	echo | ${NROFF} -Tmandoc >/dev/null
463	if [ "$?" = "0" ]; then
464		HAVE_MANDOC="yes"
465	fi
466fi
467if [ "${HAVE_MANDOC}" = "no" ]; then
468	if [ "${with_manpages}" = "yes" ]; then
469		echo "*"
470		echo "* --with-manpages was requested, but either the nroff(1)"
471		echo "* utility or the mdoc(7) macro package was not found."
472		echo "*"
473		exit 1
474	fi
475	echo "HAVE_MANDOC=no" >> Makefile.config
476	echo "NOMAN=yes" >> Makefile.config
477	echo "NOMANLINKS=yes" >> Makefile.config
478else
479	echo "HAVE_MANDOC=yes" >> Makefile.config
480	if [ "${with_catman}" = "no" ]; then
481		echo "NOCATMAN=yes" >> Makefile.config
482	else
483		if [ "${with_catman}" = "yes" ]; then
484			echo "NOCATMAN=no" >> Makefile.config
485		else
486			case "${host}" in
487			*-*-freebsd*)
488				echo "NOCATMAN=yes" >> Makefile.config
489				;;
490			*)
491				echo "NOCATMAN=no" >> Makefile.config
492				;;
493			esac
494		fi
495	fi
496	if [ "${with_manpages}" = "no" ]; then
497		echo "NOMAN=yes" >> Makefile.config
498		echo "NOMANLINKS=yes" >> Makefile.config
499	else
500		if [ "${with_manlinks}" != "yes" ]; then
501			echo "NOMANLINKS=yes" >> Makefile.config
502		fi
503	fi
504fi
505if [ "${with_docs}" = "no" ]; then
506	echo "NODOC=yes" >> Makefile.config
507fi
508if [ "${enable_nls}" = "yes" ]; then
509ENABLE_NLS="yes"
510echo "#ifndef ENABLE_NLS" > $BLD/config/enable_nls.h
511echo "#define ENABLE_NLS \"$ENABLE_NLS\"" >> $BLD/config/enable_nls.h
512echo "#endif" >> $BLD/config/enable_nls.h
513echo "hdefs[\"ENABLE_NLS\"] = \"$ENABLE_NLS\"" >>configure.lua
514msgfmt=""
515for path in `echo $PATH | sed 's/:/ /g'`; do
516	if [ -x "${path}/msgfmt" ]; then
517		msgfmt=${path}/msgfmt
518	fi
519done
520if [ "${msgfmt}" != "" ]; then
521	HAVE_GETTEXT="yes"
522else
523	HAVE_GETTEXT="no"
524fi
525echo "#ifndef ENABLE_NLS" > $BLD/config/enable_nls.h
526echo "#define ENABLE_NLS \"$ENABLE_NLS\"" >> $BLD/config/enable_nls.h
527echo "#endif" >> $BLD/config/enable_nls.h
528echo "hdefs[\"ENABLE_NLS\"] = \"$ENABLE_NLS\"" >>configure.lua
529else
530ENABLE_NLS="no"
531HAVE_GETTEXT="no"
532echo "#undef ENABLE_NLS" >$BLD/config/enable_nls.h
533echo "hdefs[\"ENABLE_NLS\"] = nil" >>configure.lua
534fi;
535CTAGS=""
536if [ "${with_ctags}" = "yes" ]; then
537	for path in `echo $PATH | sed 's/:/ /g'`; do
538		if [ -x "${path}/ectags" ]; then
539			CTAGS="${path}/ectags"
540		fi
541	done
542	if [ "${CTAGS}" = "" ]; then
543		for path in `echo $PATH | sed 's/:/ /g'`; do
544			if [ -x "${path}/ctags" ]; then
545				CTAGS="${path}/ctags"
546			fi
547		done
548	fi
549fi
550echo "CTAGS=${CTAGS}" >> Makefile.config
551if [ "${prefix_libtool}" != "" -a "${prefix_libtool}" != "bundled" ]; then
552	LIBTOOL_BUNDLED="no"
553	LIBTOOL="${prefix_libtool}"
554else
555	LIBTOOL_BUNDLED="yes"
556	LIBTOOL=\${TOP}/mk/libtool/libtool
557fi
558echo "LIBTOOL_BUNDLED=${LIBTOOL_BUNDLED}" >> Makefile.config
559echo "LIBTOOL=${LIBTOOL}" >> Makefile.config
560echo "PREFIX?=${PREFIX}" >> Makefile.config
561echo "#ifndef PREFIX" > $BLD/config/prefix.h
562echo "#define PREFIX \"$PREFIX\"" >> $BLD/config/prefix.h
563echo "#endif" >> $BLD/config/prefix.h
564echo "hdefs[\"PREFIX\"] = \"$PREFIX\"" >>configure.lua
565if [ "${bindir}" != "" ]; then
566	BINDIR="${bindir}"
567	BINDIR_SPECIFIED="yes"
568else
569	BINDIR="${PREFIX}/bin"
570fi
571echo "#ifndef BINDIR" > $BLD/config/bindir.h
572echo "#define BINDIR \"$BINDIR\"" >> $BLD/config/bindir.h
573echo "#endif" >> $BLD/config/bindir.h
574echo "hdefs[\"BINDIR\"] = \"$BINDIR\"" >>configure.lua
575if [ "${libdir}" != "" ]; then
576	LIBDIR="${libdir}"
577	LIBDIR_SPECIFIED="yes"
578else
579	LIBDIR="${PREFIX}/lib"
580fi
581echo "#ifndef LIBDIR" > $BLD/config/libdir.h
582echo "#define LIBDIR \"$LIBDIR\"" >> $BLD/config/libdir.h
583echo "#endif" >> $BLD/config/libdir.h
584echo "hdefs[\"LIBDIR\"] = \"$LIBDIR\"" >>configure.lua
585if [ "${moduledir}" != "" ]; then
586	MODULEDIR="${moduledir}"
587	MODULEDIR_SPECIFIED="yes"
588else
589	MODULEDIR="${PREFIX}/lib"
590fi
591echo "#ifndef MODULEDIR" > $BLD/config/moduledir.h
592echo "#define MODULEDIR \"$MODULEDIR\"" >> $BLD/config/moduledir.h
593echo "#endif" >> $BLD/config/moduledir.h
594echo "hdefs[\"MODULEDIR\"] = \"$MODULEDIR\"" >>configure.lua
595if [ "${libexecdir}" != "" ]; then
596	LIBEXECDIR="${libexecdir}"
597	LIBEXECDIR_SPECIFIED="yes"
598else
599	LIBEXECDIR="${PREFIX}/libexec"
600fi
601echo "#ifndef LIBEXECDIR" > $BLD/config/libexecdir.h
602echo "#define LIBEXECDIR \"$LIBEXECDIR\"" >> $BLD/config/libexecdir.h
603echo "#endif" >> $BLD/config/libexecdir.h
604echo "hdefs[\"LIBEXECDIR\"] = \"$LIBEXECDIR\"" >>configure.lua
605if [ "${datadir}" != "" ]; then
606	DATADIR="${datadir}"
607	DATADIR_SPECIFIED="yes"
608else
609	DATADIR="${PREFIX}/share"
610fi
611echo "#ifndef DATADIR" > $BLD/config/datadir.h
612echo "#define DATADIR \"$DATADIR\"" >> $BLD/config/datadir.h
613echo "#endif" >> $BLD/config/datadir.h
614echo "hdefs[\"DATADIR\"] = \"$DATADIR\"" >>configure.lua
615if [ "${statedir}" != "" ]; then
616	STATEDIR="${statedir}"
617	STATEDIR_SPECIFIED="yes"
618else
619	STATEDIR="${PREFIX}/var"
620fi
621echo "#ifndef STATEDIR" > $BLD/config/statedir.h
622echo "#define STATEDIR \"$STATEDIR\"" >> $BLD/config/statedir.h
623echo "#endif" >> $BLD/config/statedir.h
624echo "hdefs[\"STATEDIR\"] = \"$STATEDIR\"" >>configure.lua
625if [ "${sysconfdir}" != "" ]; then
626	SYSCONFDIR="${sysconfdir}"
627	SYSCONFDIR_SPECIFIED="yes"
628else
629	SYSCONFDIR="${PREFIX}/etc"
630fi
631echo "#ifndef SYSCONFDIR" > $BLD/config/sysconfdir.h
632echo "#define SYSCONFDIR \"$SYSCONFDIR\"" >> $BLD/config/sysconfdir.h
633echo "#endif" >> $BLD/config/sysconfdir.h
634echo "hdefs[\"SYSCONFDIR\"] = \"$SYSCONFDIR\"" >>configure.lua
635if [ "${localedir}" != "" ]; then
636	LOCALEDIR="${localedir}"
637	LOCALEDIR_SPECIFIED="yes"
638else
639	LOCALEDIR="${DATADIR}/locale"
640fi
641echo "#ifndef LOCALEDIR" > $BLD/config/localedir.h
642echo "#define LOCALEDIR \"$LOCALEDIR\"" >> $BLD/config/localedir.h
643echo "#endif" >> $BLD/config/localedir.h
644echo "hdefs[\"LOCALEDIR\"] = \"$LOCALEDIR\"" >>configure.lua
645if [ "${mandir}" != "" ]; then
646	MANDIR="${mandir}"
647	MANDIR_SPECIFIED="yes"
648else
649	MANDIR="${PREFIX}/man"
650fi
651echo "#ifndef MANDIR" > $BLD/config/mandir.h
652echo "#define MANDIR \"$MANDIR\"" >> $BLD/config/mandir.h
653echo "#endif" >> $BLD/config/mandir.h
654echo "hdefs[\"MANDIR\"] = \"$MANDIR\"" >>configure.lua
655if [ "${DATADIR_SPECIFIED}" != "yes" ]; then
656DATADIR="${PREFIX}/share/agartest"
657echo "#ifndef DATADIR" > $BLD/config/datadir.h
658echo "#define DATADIR \"$DATADIR\"" >> $BLD/config/datadir.h
659echo "#endif" >> $BLD/config/datadir.h
660echo "hdefs[\"DATADIR\"] = \"$DATADIR\"" >>configure.lua
661fi;
662if [ "${LOCALEDIR_SPECIFIED}" != "yes" ]; then
663LOCALEDIR="${DATADIR}/locale"
664echo "#ifndef LOCALEDIR" > $BLD/config/localedir.h
665echo "#define LOCALEDIR \"$LOCALEDIR\"" >> $BLD/config/localedir.h
666echo "#endif" >> $BLD/config/localedir.h
667echo "hdefs[\"LOCALEDIR\"] = \"$LOCALEDIR\"" >>configure.lua
668fi;
669$ECHO_N "checking for a C compiler..."
670$ECHO_N "checking for a C compiler..." >> config.log
671if [ "$CROSS_COMPILING" = "yes" ]; then
672	CROSSPFX="${host}-"
673else
674	CROSSPFX=""
675fi
676if [ "$CC" = "" ]; then
677	for i in `echo $PATH |sed 's/:/ /g'`; do
678		if [ -x "${i}/${CROSSPFX}cc" ]; then
679			if [ -f "${i}/${CROSSPFX}cc" ]; then
680				CC="${i}/${CROSSPFX}cc"
681				break
682			fi
683		elif [ -x "${i}/${CROSSPFX}gcc" ]; then
684			if [ -f "${i}/${CROSSPFX}gcc" ]; then
685				CC="${i}/${CROSSPFX}gcc"
686				break
687			fi
688		fi
689	done
690	if [ "$CC" = "" ]; then
691		echo "*"
692		echo "* Cannot find ${CROSSPFX}cc or ${CROSSPFX}gcc in default PATH."
693		echo "* You may need to set the CC environment variable."
694		echo "*"
695		echo "Cannot find ${CROSSPFX}cc or ${CROSSPFX}gcc in PATH." >> config.log
696		HAVE_CC="no"
697		echo "no"
698	else
699		HAVE_CC="yes"
700		echo "yes, ${CC}"
701		echo "yes, ${CC}" >> config.log
702	fi
703else
704	HAVE_CC="yes"
705	echo "using ${CC}"
706fi
707
708if [ "${HAVE_CC}" = "yes" ]; then
709	$ECHO_N "checking whether the C compiler works..."
710	$ECHO_N "checking whether the C compiler works..." >> config.log
711	cat << 'EOT' > conftest.c
712int main(int argc, char *argv[]) { return (0); }
713EOT
714	$CC -o conftest conftest.c 2>>config.log
715	if [ $? != 0 ]; then
716	    echo "no"
717	    echo "no (test failed to compile)" >> config.log
718		HAVE_CC="no"
719	else
720		HAVE_CC="yes"
721	fi
722
723	if [ "${HAVE_CC}" = "yes" ]; then
724		if [ "${EXECSUFFIX}" = "" ]; then
725			EXECSUFFIX=""
726			for OUTFILE in conftest.exe conftest conftest.*; do
727				if [ -f $OUTFILE ]; then
728					case $OUTFILE in
729					*.c | *.cc | *.m | *.o | *.obj | *.bb | *.bbg | *.d | *.pdb | *.tds | *.xcoff | *.dSYM | *.xSYM )
730						;;
731					*.* )
732						EXECSUFFIX=`expr "$OUTFILE" : '[^.]*\(\..*\)'`
733						break ;;
734					* )
735						break ;;
736					esac;
737			    fi
738			done
739			if [ "$EXECSUFFIX" != "" ]; then
740				echo "yes (it outputs $EXECSUFFIX files)"
741				echo "yes (it outputs $EXECSUFFIX files)" >> config.log
742			else
743				echo "yes"
744				echo "yes" >> config.log
745			fi
746echo "#ifndef EXECSUFFIX" > $BLD/config/execsuffix.h
747echo "#define EXECSUFFIX \"$EXECSUFFIX\"" >> $BLD/config/execsuffix.h
748echo "#endif" >> $BLD/config/execsuffix.h
749echo "hdefs[\"EXECSUFFIX\"] = \"$EXECSUFFIX\"" >>configure.lua
750		else
751			echo "yes"
752			echo "yes" >> config.log
753		fi
754	fi
755	rm -f conftest.c conftest$EXECSUFFIX
756	TEST_CFLAGS=""
757fi
758if [ "${HAVE_CC}" = "yes" ]; then
759$ECHO_N "cc: checking for compiler warning options..."
760$ECHO_N "cc: checking for compiler warning options..." >> config.log
761MK_COMPILE_STATUS="OK"
762cat << EOT > conftest.c
763int main(int argc, char *argv[]) { return (0); }
764
765EOT
766echo "$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c " >>config.log
767$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c  2>>config.log
768if [ $? != 0 ]; then
769	echo "-> failed ($?)" >> config.log
770	MK_COMPILE_STATUS="FAIL($?)"
771fi
772if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
773echo "yes"
774echo "yes" >> config.log
775HAVE_CC_WARNINGS="yes"
776echo "#ifndef HAVE_CC_WARNINGS" > $BLD/config/have_cc_warnings.h
777echo "#define HAVE_CC_WARNINGS \"$HAVE_CC_WARNINGS\"" >> $BLD/config/have_cc_warnings.h
778echo "#endif" >> $BLD/config/have_cc_warnings.h
779echo "hdefs[\"HAVE_CC_WARNINGS\"] = \"$HAVE_CC_WARNINGS\"" >>configure.lua
780else
781echo "no"
782echo "no" >> config.log
783HAVE_CC_WARNINGS="no"
784echo "#undef HAVE_CC_WARNINGS" >$BLD/config/have_cc_warnings.h
785echo "hdefs[\"HAVE_CC_WARNINGS\"] = nil" >>configure.lua
786fi;
787rm -f conftest.c $testdir/conftest$EXECSUFFIX
788if [ "${HAVE_CC_WARNINGS}" = "yes" ]; then
789TEST_CFLAGS="-Wall -Werror"
790fi;
791$ECHO_N "cc: checking for long double..."
792$ECHO_N "cc: checking for long double..." >> config.log
793MK_COMPILE_STATUS="OK"
794cat << EOT > conftest.c
795int
796main(int argc, char *argv[])
797{
798	long double ld = 0.1;
799
800	return (ld == 1.0);
801}
802
803EOT
804echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
805$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
806if [ $? != 0 ]; then
807	echo "-> failed ($?)" >> config.log
808	MK_COMPILE_STATUS="FAIL($?)"
809fi
810if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
811echo "yes"
812echo "yes" >> config.log
813HAVE_LONG_DOUBLE="yes"
814echo "#ifndef HAVE_LONG_DOUBLE" > $BLD/config/have_long_double.h
815echo "#define HAVE_LONG_DOUBLE \"$HAVE_LONG_DOUBLE\"" >> $BLD/config/have_long_double.h
816echo "#endif" >> $BLD/config/have_long_double.h
817echo "hdefs[\"HAVE_LONG_DOUBLE\"] = \"$HAVE_LONG_DOUBLE\"" >>configure.lua
818else
819echo "no"
820echo "no" >> config.log
821HAVE_LONG_DOUBLE="no"
822echo "#undef HAVE_LONG_DOUBLE" >$BLD/config/have_long_double.h
823echo "hdefs[\"HAVE_LONG_DOUBLE\"] = nil" >>configure.lua
824fi;
825rm -f conftest.c $testdir/conftest$EXECSUFFIX
826$ECHO_N "cc: checking for long long..."
827$ECHO_N "cc: checking for long long..." >> config.log
828MK_COMPILE_STATUS="OK"
829cat << EOT > conftest.c
830int
831main(int argc, char *argv[])
832{
833	long long ll = -1;
834	unsigned long long ull = 1;
835
836	return (ll != -1 || ull != 1);
837}
838
839EOT
840echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
841$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
842if [ $? != 0 ]; then
843	echo "-> failed ($?)" >> config.log
844	MK_COMPILE_STATUS="FAIL($?)"
845fi
846if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
847echo "yes"
848echo "yes" >> config.log
849HAVE_LONG_LONG="yes"
850echo "#ifndef HAVE_LONG_LONG" > $BLD/config/have_long_long.h
851echo "#define HAVE_LONG_LONG \"$HAVE_LONG_LONG\"" >> $BLD/config/have_long_long.h
852echo "#endif" >> $BLD/config/have_long_long.h
853echo "hdefs[\"HAVE_LONG_LONG\"] = \"$HAVE_LONG_LONG\"" >>configure.lua
854else
855echo "no"
856echo "no" >> config.log
857HAVE_LONG_LONG="no"
858echo "#undef HAVE_LONG_LONG" >$BLD/config/have_long_long.h
859echo "hdefs[\"HAVE_LONG_LONG\"] = nil" >>configure.lua
860fi;
861rm -f conftest.c $testdir/conftest$EXECSUFFIX
862$ECHO_N "cc: checking for cygwin environment..."
863$ECHO_N "cc: checking for cygwin environment..." >> config.log
864MK_COMPILE_STATUS="OK"
865cat << EOT > conftest.c
866#include <sys/types.h>
867#include <sys/stat.h>
868#include <windows.h>
869
870int
871main(int argc, char *argv[]) {
872	struct stat sb;
873	DWORD rv;
874	rv = GetFileAttributes("foo");
875	stat("foo", &sb);
876	return (0);
877}
878
879EOT
880echo "$CC $CFLAGS $TEST_CFLAGS -mcygwin -o $testdir/conftest conftest.c" >>config.log
881$CC $CFLAGS $TEST_CFLAGS -mcygwin -o $testdir/conftest conftest.c 2>>config.log
882if [ $? != 0 ]; then
883	echo "-> failed ($?)" >> config.log
884	MK_COMPILE_STATUS="FAIL($?)"
885fi
886if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
887echo "yes"
888echo "yes" >> config.log
889HAVE_CYGWIN="yes"
890echo "#ifndef HAVE_CYGWIN" > $BLD/config/have_cygwin.h
891echo "#define HAVE_CYGWIN \"$HAVE_CYGWIN\"" >> $BLD/config/have_cygwin.h
892echo "#endif" >> $BLD/config/have_cygwin.h
893echo "hdefs[\"HAVE_CYGWIN\"] = \"$HAVE_CYGWIN\"" >>configure.lua
894else
895echo "no"
896echo "no" >> config.log
897HAVE_CYGWIN="no"
898echo "#undef HAVE_CYGWIN" >$BLD/config/have_cygwin.h
899echo "hdefs[\"HAVE_CYGWIN\"] = nil" >>configure.lua
900fi;
901rm -f conftest.c $testdir/conftest
902$ECHO_N "cc: checking for -mwindows option..."
903$ECHO_N "cc: checking for -mwindows option..." >> config.log
904MK_COMPILE_STATUS="OK"
905cat << EOT > conftest.c
906#include <windows.h>
907int
908main(int argc, char *argv[]) {
909	return GetFileAttributes("foo") ? 0 : 1;
910}
911
912EOT
913echo "$CC $CFLAGS $TEST_CFLAGS -mwindows -o $testdir/conftest conftest.c" >>config.log
914$CC $CFLAGS $TEST_CFLAGS -mwindows -o $testdir/conftest conftest.c 2>>config.log
915if [ $? != 0 ]; then
916	echo "-> failed ($?)" >> config.log
917	MK_COMPILE_STATUS="FAIL($?)"
918fi
919if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
920echo "yes"
921echo "yes" >> config.log
922HAVE_CC_MWINDOWS="yes"
923echo "#ifndef HAVE_CC_MWINDOWS" > $BLD/config/have_cc_mwindows.h
924echo "#define HAVE_CC_MWINDOWS \"$HAVE_CC_MWINDOWS\"" >> $BLD/config/have_cc_mwindows.h
925echo "#endif" >> $BLD/config/have_cc_mwindows.h
926echo "hdefs[\"HAVE_CC_MWINDOWS\"] = \"$HAVE_CC_MWINDOWS\"" >>configure.lua
927else
928echo "no"
929echo "no" >> config.log
930HAVE_CC_MWINDOWS="no"
931echo "#undef HAVE_CC_MWINDOWS" >$BLD/config/have_cc_mwindows.h
932echo "hdefs[\"HAVE_CC_MWINDOWS\"] = nil" >>configure.lua
933fi;
934rm -f conftest.c $testdir/conftest
935if [ "${HAVE_CC_MWINDOWS}" = "yes" ]; then
936PROG_GUI_FLAGS="-mwindows"
937else
938PROG_GUI_FLAGS=""
939fi;
940$ECHO_N "cc: checking for -mconsole option..."
941$ECHO_N "cc: checking for -mconsole option..." >> config.log
942MK_COMPILE_STATUS="OK"
943cat << EOT > conftest.c
944#include <windows.h>
945int
946main(int argc, char *argv[]) {
947	return GetFileAttributes("foo") ? 0 : 1;
948}
949
950EOT
951echo "$CC $CFLAGS $TEST_CFLAGS -mconsole -o $testdir/conftest conftest.c" >>config.log
952$CC $CFLAGS $TEST_CFLAGS -mconsole -o $testdir/conftest conftest.c 2>>config.log
953if [ $? != 0 ]; then
954	echo "-> failed ($?)" >> config.log
955	MK_COMPILE_STATUS="FAIL($?)"
956fi
957if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
958echo "yes"
959echo "yes" >> config.log
960HAVE_CC_MCONSOLE="yes"
961echo "#ifndef HAVE_CC_MCONSOLE" > $BLD/config/have_cc_mconsole.h
962echo "#define HAVE_CC_MCONSOLE \"$HAVE_CC_MCONSOLE\"" >> $BLD/config/have_cc_mconsole.h
963echo "#endif" >> $BLD/config/have_cc_mconsole.h
964echo "hdefs[\"HAVE_CC_MCONSOLE\"] = \"$HAVE_CC_MCONSOLE\"" >>configure.lua
965else
966echo "no"
967echo "no" >> config.log
968HAVE_CC_MCONSOLE="no"
969echo "#undef HAVE_CC_MCONSOLE" >$BLD/config/have_cc_mconsole.h
970echo "hdefs[\"HAVE_CC_MCONSOLE\"] = nil" >>configure.lua
971fi;
972rm -f conftest.c $testdir/conftest
973if [ "${HAVE_CC_MCONSOLE}" = "yes" ]; then
974PROG_CLI_FLAGS="-mconsole"
975else
976PROG_CLI_FLAGS=""
977fi;
978case "${host}" in
979*-*-cygwin* | *-*-mingw32*)
980$ECHO_N "cc: checking for linker -no-undefined option..."
981$ECHO_N "cc: checking for linker -no-undefined option..." >> config.log
982MK_COMPILE_STATUS="OK"
983cat << EOT > conftest.c
984int main(int argc, char *argv[]) { return (0); }
985
986EOT
987echo "$CC $CFLAGS $TEST_CFLAGS -Wl,--no-undefined -o $testdir/conftest conftest.c" >>config.log
988$CC $CFLAGS $TEST_CFLAGS -Wl,--no-undefined -o $testdir/conftest conftest.c 2>>config.log
989if [ $? != 0 ]; then
990	echo "-> failed ($?)" >> config.log
991	MK_COMPILE_STATUS="FAIL($?)"
992fi
993if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
994echo "yes"
995echo "yes" >> config.log
996HAVE_LD_NO_UNDEFINED="yes"
997echo "#ifndef HAVE_LD_NO_UNDEFINED" > $BLD/config/have_ld_no_undefined.h
998echo "#define HAVE_LD_NO_UNDEFINED \"$HAVE_LD_NO_UNDEFINED\"" >> $BLD/config/have_ld_no_undefined.h
999echo "#endif" >> $BLD/config/have_ld_no_undefined.h
1000echo "hdefs[\"HAVE_LD_NO_UNDEFINED\"] = \"$HAVE_LD_NO_UNDEFINED\"" >>configure.lua
1001else
1002echo "no"
1003echo "no" >> config.log
1004HAVE_LD_NO_UNDEFINED="no"
1005echo "#undef HAVE_LD_NO_UNDEFINED" >$BLD/config/have_ld_no_undefined.h
1006echo "hdefs[\"HAVE_LD_NO_UNDEFINED\"] = nil" >>configure.lua
1007fi;
1008rm -f conftest.c $testdir/conftest
1009if [ "${HAVE_LD_NO_UNDEFINED}" = "yes" ]; then
1010LIBTOOLOPTS_SHARED="${LIBTOOLOPTS_SHARED} -no-undefined -Wl,--no-undefined"
1011fi;
1012$ECHO_N "cc: checking for linker -static-libgcc option..."
1013$ECHO_N "cc: checking for linker -static-libgcc option..." >> config.log
1014MK_COMPILE_STATUS="OK"
1015cat << EOT > conftest.c
1016int main(int argc, char *argv[]) { return (0); }
1017
1018EOT
1019echo "$CC $CFLAGS $TEST_CFLAGS -static-libgcc -o $testdir/conftest conftest.c" >>config.log
1020$CC $CFLAGS $TEST_CFLAGS -static-libgcc -o $testdir/conftest conftest.c 2>>config.log
1021if [ $? != 0 ]; then
1022	echo "-> failed ($?)" >> config.log
1023	MK_COMPILE_STATUS="FAIL($?)"
1024fi
1025if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
1026echo "yes"
1027echo "yes" >> config.log
1028HAVE_LD_STATIC_LIBGCC="yes"
1029echo "#ifndef HAVE_LD_STATIC_LIBGCC" > $BLD/config/have_ld_static_libgcc.h
1030echo "#define HAVE_LD_STATIC_LIBGCC \"$HAVE_LD_STATIC_LIBGCC\"" >> $BLD/config/have_ld_static_libgcc.h
1031echo "#endif" >> $BLD/config/have_ld_static_libgcc.h
1032echo "hdefs[\"HAVE_LD_STATIC_LIBGCC\"] = \"$HAVE_LD_STATIC_LIBGCC\"" >>configure.lua
1033else
1034echo "no"
1035echo "no" >> config.log
1036HAVE_LD_STATIC_LIBGCC="no"
1037echo "#undef HAVE_LD_STATIC_LIBGCC" >$BLD/config/have_ld_static_libgcc.h
1038echo "hdefs[\"HAVE_LD_STATIC_LIBGCC\"] = nil" >>configure.lua
1039fi;
1040rm -f conftest.c $testdir/conftest
1041if [ "${HAVE_LD_STATIC_LIBGCC}" = "yes" ]; then
1042LIBTOOLOPTS_SHARED="${LIBTOOLOPTS_SHARED} -XCClinker -static-libgcc"
1043fi;
1044;;
1045esac
1046fi;
1047if [ "${HAVE_CC}" != "yes" ]; then
1048echo "* "
1049echo "* " >> config.log
1050echo "* This software requires cc installed on your system."
1051echo "* This software requires cc installed on your system." >> config.log
1052echo "* "
1053echo "* " >> config.log
1054echo "configure failed!"
1055exit 1
1056fi;
1057$ECHO_N "checking for Agar (http://libagar.org/)..."
1058$ECHO_N "checking for Agar (http://libagar.org/)..." >> config.log
1059MK_EXEC_FOUND="No"
1060
1061if [ "" != "" ]; then
1062	if [ -e "/bin/agar-config" ]; then
1063		AGAR_VERSION=`/bin/agar-config --version`
1064		MK_EXEC_FOUND="Yes"
1065	fi
1066else
1067	AGAR_VERSION=""
1068	for path in `echo $PATH | sed 's/:/ /g'`; do
1069		if [ -e "${path}/agar-config" ]; then
1070			AGAR_VERSION=`${path}/agar-config --version`
1071			MK_EXEC_FOUND="Yes"
1072			break
1073		fi
1074	done
1075fi
1076if [ "${AGAR_VERSION}" != "" ]; then
1077if [ "" != "" ]; then
1078echo "yes ($AGAR_VERSION in )"
1079echo "yes ($AGAR_VERSION in )" >> config.log
1080else
1081echo "yes ($AGAR_VERSION)"
1082echo "yes ($AGAR_VERSION)" >> config.log
1083fi;
1084MK_VERSION_MAJOR=`echo "$AGAR_VERSION" |sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\).*/\1/'`;
1085MK_VERSION_MINOR=`echo "$AGAR_VERSION" |sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\).*/\2/'`;
1086MK_VERSION_MICRO=`echo "$AGAR_VERSION" |sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\).*/\3/'`;
1087MK_VERSION_OK="no"
1088if [ $MK_VERSION_MAJOR -gt 1 ]; then
1089	MK_VERSION_OK="yes";
1090elif [ $MK_VERSION_MAJOR -eq 1 ]; then
1091	if [ "$MK_VERSION_MINOR" = "" ]; then
1092		MK_VERSION_OK="yes"
1093	else
1094		if [ $MK_VERSION_MINOR -gt 5 ]; then
1095			MK_VERSION_OK="yes";
1096		elif [ $MK_VERSION_MINOR -eq 5 ]; then
1097			if [ "$MK_VERSION_MICRO" = "" ]; then
1098				MK_VERSION_OK="yes"
1099			else
1100				if [ $MK_VERSION_MICRO -ge 0 ]; then
1101					MK_VERSION_OK="yes"
1102				fi
1103			fi
1104		fi
1105	fi
1106fi
1107if [ "${MK_VERSION_OK}" = "no" ]; then
1108echo "*"
1109echo "*" >> config.log
1110echo "* Minimum required version is 1.5.0 (found $AGAR_VERSION); skipping."
1111echo "* Minimum required version is 1.5.0 (found $AGAR_VERSION); skipping." >> config.log
1112echo "*"
1113echo "*" >> config.log
1114fi;
1115else
1116if [ "" != "" ]; then
1117echo "no (not in )"
1118echo "no (not in )" >> config.log
1119else
1120echo "no"
1121echo "no" >> config.log
1122fi;
1123MK_VERSION_OK="no"
1124fi;
1125if [ "${MK_VERSION_OK}" = "yes" ]; then
1126$ECHO_N "checking whether Agar works..."
1127$ECHO_N "checking whether Agar works..." >> config.log
1128MK_EXEC_FOUND="No"
1129
1130if [ "" != "" ]; then
1131	if [ -e "/bin/agar-config" ]; then
1132		AGAR_CFLAGS=`/bin/agar-config --cflags`
1133		MK_EXEC_FOUND="Yes"
1134	fi
1135else
1136	AGAR_CFLAGS=""
1137	for path in `echo $PATH | sed 's/:/ /g'`; do
1138		if [ -e "${path}/agar-config" ]; then
1139			AGAR_CFLAGS=`${path}/agar-config --cflags`
1140			MK_EXEC_FOUND="Yes"
1141			break
1142		fi
1143	done
1144fi
1145MK_EXEC_FOUND="No"
1146
1147if [ "" != "" ]; then
1148	if [ -e "/bin/agar-config" ]; then
1149		AGAR_LIBS=`/bin/agar-config --libs`
1150		MK_EXEC_FOUND="Yes"
1151	fi
1152else
1153	AGAR_LIBS=""
1154	for path in `echo $PATH | sed 's/:/ /g'`; do
1155		if [ -e "${path}/agar-config" ]; then
1156			AGAR_LIBS=`${path}/agar-config --libs`
1157			MK_EXEC_FOUND="Yes"
1158			break
1159		fi
1160	done
1161fi
1162MK_COMPILE_STATUS="OK"
1163cat << EOT > conftest.c
1164#include <agar/core.h>
1165#include <agar/gui.h>
1166
1167int
1168main(int argc, char *argv[])
1169{
1170	AG_InitCore("conf-test", 0);
1171	AG_InitGraphics(NULL);
1172	AG_EventLoop();
1173	AG_Quit();
1174	return (0);
1175}
1176
1177EOT
1178echo "$CC $CFLAGS $TEST_CFLAGS ${AGAR_CFLAGS} -o $testdir/conftest conftest.c ${AGAR_LIBS}" >>config.log
1179$CC $CFLAGS $TEST_CFLAGS ${AGAR_CFLAGS} -o $testdir/conftest conftest.c ${AGAR_LIBS} 2>>config.log
1180if [ $? != 0 ]; then
1181	echo "-> failed ($?)" >> config.log
1182	MK_COMPILE_STATUS="FAIL($?)"
1183fi
1184if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
1185echo "yes"
1186echo "yes" >> config.log
1187HAVE_AGAR="yes"
1188echo "#ifndef HAVE_AGAR" > $BLD/config/have_agar.h
1189echo "#define HAVE_AGAR \"$HAVE_AGAR\"" >> $BLD/config/have_agar.h
1190echo "#endif" >> $BLD/config/have_agar.h
1191echo "hdefs[\"HAVE_AGAR\"] = \"$HAVE_AGAR\"" >>configure.lua
1192else
1193echo "no"
1194echo "no" >> config.log
1195HAVE_AGAR="no"
1196echo "#undef HAVE_AGAR" >$BLD/config/have_agar.h
1197echo "hdefs[\"HAVE_AGAR\"] = nil" >>configure.lua
1198fi;
1199rm -f conftest.c $testdir/conftest$EXECSUFFIX
1200if [ "${HAVE_AGAR}" = "yes" ]; then
1201echo "#ifndef AGAR_CFLAGS" > $BLD/config/agar_cflags.h
1202echo "#define AGAR_CFLAGS \"$AGAR_CFLAGS\"" >> $BLD/config/agar_cflags.h
1203echo "#endif" >> $BLD/config/agar_cflags.h
1204echo "hdefs[\"AGAR_CFLAGS\"] = \"$AGAR_CFLAGS\"" >>configure.lua
1205echo "#ifndef AGAR_LIBS" > $BLD/config/agar_libs.h
1206echo "#define AGAR_LIBS \"$AGAR_LIBS\"" >> $BLD/config/agar_libs.h
1207echo "#endif" >> $BLD/config/agar_libs.h
1208echo "hdefs[\"AGAR_LIBS\"] = \"$AGAR_LIBS\"" >>configure.lua
1209else
1210echo "#undef AGAR_CFLAGS" >$BLD/config/agar_cflags.h
1211echo "hdefs[\"AGAR_CFLAGS\"] = nil" >>configure.lua
1212AGAR_CFLAGS=""
1213echo "#undef AGAR_LIBS" >$BLD/config/agar_libs.h
1214echo "hdefs[\"AGAR_LIBS\"] = nil" >>configure.lua
1215AGAR_LIBS=""
1216fi;
1217else
1218echo "#undef AGAR_CFLAGS" >$BLD/config/agar_cflags.h
1219echo "hdefs[\"AGAR_CFLAGS\"] = nil" >>configure.lua
1220echo "#undef AGAR_LIBS" >$BLD/config/agar_libs.h
1221echo "hdefs[\"AGAR_LIBS\"] = nil" >>configure.lua
1222fi;
1223if [ "${HAVE_AGAR}" != "yes" ]; then
1224echo "* "
1225echo "* " >> config.log
1226echo "* This software requires agar installed on your system."
1227echo "* This software requires agar installed on your system." >> config.log
1228echo "* "
1229echo "* " >> config.log
1230echo "configure failed!"
1231exit 1
1232fi;
1233if [ "${MK_VERSION_OK}" != "yes" ]; then
1234echo "* "
1235echo "* " >> config.log
1236echo "* This software requires agar version >= 1.5.0,"
1237echo "* This software requires agar version >= 1.5.0," >> config.log
1238echo "* please upgrade and try again."
1239echo "* please upgrade and try again." >> config.log
1240echo "* "
1241echo "* " >> config.log
1242echo "configure failed!"
1243exit 1
1244fi;
1245$ECHO_N "checking for SDL (http://www.libsdl.org)..."
1246$ECHO_N "checking for SDL (http://www.libsdl.org)..." >> config.log
1247if [ "" != "" ]; then
1248MK_EXEC_FOUND="No"
1249
1250if [ "" != "" ]; then
1251	if [ -e "/bin/sdl-config" ]; then
1252		SDL_VERSION=`/bin/sdl-config --version`
1253		MK_EXEC_FOUND="Yes"
1254	fi
1255else
1256	SDL_VERSION=""
1257	for path in `echo $PATH | sed 's/:/ /g'`; do
1258		if [ -e "${path}/sdl-config" ]; then
1259			SDL_VERSION=`${path}/sdl-config --version`
1260			MK_EXEC_FOUND="Yes"
1261			break
1262		fi
1263	done
1264fi
1265MK_EXEC_FOUND="No"
1266
1267if [ "" != "" ]; then
1268	if [ -e "/bin/sdl-config" ]; then
1269		SDL_CFLAGS=`/bin/sdl-config --cflags`
1270		MK_EXEC_FOUND="Yes"
1271	fi
1272else
1273	SDL_CFLAGS=""
1274	for path in `echo $PATH | sed 's/:/ /g'`; do
1275		if [ -e "${path}/sdl-config" ]; then
1276			SDL_CFLAGS=`${path}/sdl-config --cflags`
1277			MK_EXEC_FOUND="Yes"
1278			break
1279		fi
1280	done
1281fi
1282MK_EXEC_FOUND="No"
1283
1284if [ "" != "" ]; then
1285	if [ -e "/bin/sdl-config" ]; then
1286		SDL_LIBS=`/bin/sdl-config --libs`
1287		MK_EXEC_FOUND="Yes"
1288	fi
1289else
1290	SDL_LIBS=""
1291	for path in `echo $PATH | sed 's/:/ /g'`; do
1292		if [ -e "${path}/sdl-config" ]; then
1293			SDL_LIBS=`${path}/sdl-config --libs`
1294			MK_EXEC_FOUND="Yes"
1295			break
1296		fi
1297	done
1298fi
1299else
1300case "${host}" in
1301*-*-darwin*)
1302MK_EXEC_FOUND="No"
1303SDL_VERSION=""
1304for path in `echo $PATH | sed 's/:/ /g'`; do
1305	if [ -e "${path}/sdl-config" ]; then
1306		SDL_VERSION=`${path}/sdl-config --version`
1307		MK_EXEC_FOUND="Yes"
1308		break
1309	fi
1310done
1311if [ "${cache}" != "" ]; then
1312	echo "$SDL_VERSION" > ${cache}/exec-SDL_VERSION
1313	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_VERSION
1314fi
1315if [ "${SDL_VERSION}" != "" ]; then
1316MK_EXEC_FOUND="No"
1317SDL_CFLAGS=""
1318for path in `echo $PATH | sed 's/:/ /g'`; do
1319	if [ -e "${path}/sdl-config" ]; then
1320		SDL_CFLAGS=`${path}/sdl-config --cflags`
1321		MK_EXEC_FOUND="Yes"
1322		break
1323	fi
1324done
1325if [ "${cache}" != "" ]; then
1326	echo "$SDL_CFLAGS" > ${cache}/exec-SDL_CFLAGS
1327	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_CFLAGS
1328fi
1329MK_EXEC_FOUND="No"
1330SDL_LIBS=""
1331for path in `echo $PATH | sed 's/:/ /g'`; do
1332	if [ -e "${path}/sdl-config" ]; then
1333		SDL_LIBS=`${path}/sdl-config --libs`
1334		MK_EXEC_FOUND="Yes"
1335		break
1336	fi
1337done
1338if [ "${cache}" != "" ]; then
1339	echo "$SDL_LIBS" > ${cache}/exec-SDL_LIBS
1340	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_LIBS
1341fi
1342else
1343$ECHO_N "framework..."
1344$ECHO_N "framework..." >> config.log
1345SDL_VERSION="1.2.15"
1346SDL_CFLAGS="-D_USE_SDL_FRAMEWORK"
1347SDL_LIBS="-framework SDL"
1348fi;
1349;;
1350*-*-freebsd*)
1351MK_EXEC_FOUND="No"
1352SDL_VERSION=""
1353for path in `echo $PATH | sed 's/:/ /g'`; do
1354	if [ -e "${path}/sdl11-config" ]; then
1355		SDL_VERSION=`${path}/sdl11-config --version`
1356		MK_EXEC_FOUND="Yes"
1357		break
1358	fi
1359done
1360if [ "${cache}" != "" ]; then
1361	echo "$SDL_VERSION" > ${cache}/exec-SDL_VERSION
1362	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_VERSION
1363fi
1364if [ "${SDL_VERSION}" != "" ]; then
1365MK_EXEC_FOUND="No"
1366SDL_CFLAGS=""
1367for path in `echo $PATH | sed 's/:/ /g'`; do
1368	if [ -e "${path}/sdl11-config" ]; then
1369		SDL_CFLAGS=`${path}/sdl11-config --cflags`
1370		MK_EXEC_FOUND="Yes"
1371		break
1372	fi
1373done
1374if [ "${cache}" != "" ]; then
1375	echo "$SDL_CFLAGS" > ${cache}/exec-SDL_CFLAGS
1376	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_CFLAGS
1377fi
1378MK_EXEC_FOUND="No"
1379SDL_LIBS=""
1380for path in `echo $PATH | sed 's/:/ /g'`; do
1381	if [ -e "${path}/sdl11-config" ]; then
1382		SDL_LIBS=`${path}/sdl11-config --libs`
1383		MK_EXEC_FOUND="Yes"
1384		break
1385	fi
1386done
1387if [ "${cache}" != "" ]; then
1388	echo "$SDL_LIBS" > ${cache}/exec-SDL_LIBS
1389	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_LIBS
1390fi
1391else
1392MK_EXEC_FOUND="No"
1393SDL_VERSION=""
1394for path in `echo $PATH | sed 's/:/ /g'`; do
1395	if [ -e "${path}/sdl-config" ]; then
1396		SDL_VERSION=`${path}/sdl-config --version`
1397		MK_EXEC_FOUND="Yes"
1398		break
1399	fi
1400done
1401if [ "${cache}" != "" ]; then
1402	echo "$SDL_VERSION" > ${cache}/exec-SDL_VERSION
1403	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_VERSION
1404fi
1405MK_EXEC_FOUND="No"
1406SDL_CFLAGS=""
1407for path in `echo $PATH | sed 's/:/ /g'`; do
1408	if [ -e "${path}/sdl-config" ]; then
1409		SDL_CFLAGS=`${path}/sdl-config --cflags`
1410		MK_EXEC_FOUND="Yes"
1411		break
1412	fi
1413done
1414if [ "${cache}" != "" ]; then
1415	echo "$SDL_CFLAGS" > ${cache}/exec-SDL_CFLAGS
1416	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_CFLAGS
1417fi
1418MK_EXEC_FOUND="No"
1419SDL_LIBS=""
1420for path in `echo $PATH | sed 's/:/ /g'`; do
1421	if [ -e "${path}/sdl-config" ]; then
1422		SDL_LIBS=`${path}/sdl-config --libs`
1423		MK_EXEC_FOUND="Yes"
1424		break
1425	fi
1426done
1427if [ "${cache}" != "" ]; then
1428	echo "$SDL_LIBS" > ${cache}/exec-SDL_LIBS
1429	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_LIBS
1430fi
1431fi;
1432;;
1433*)
1434MK_EXEC_FOUND="No"
1435SDL_VERSION=""
1436for path in `echo $PATH | sed 's/:/ /g'`; do
1437	if [ -e "${path}/sdl-config" ]; then
1438		SDL_VERSION=`${path}/sdl-config --version`
1439		MK_EXEC_FOUND="Yes"
1440		break
1441	fi
1442done
1443if [ "${cache}" != "" ]; then
1444	echo "$SDL_VERSION" > ${cache}/exec-SDL_VERSION
1445	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_VERSION
1446fi
1447MK_EXEC_FOUND="No"
1448SDL_CFLAGS=""
1449for path in `echo $PATH | sed 's/:/ /g'`; do
1450	if [ -e "${path}/sdl-config" ]; then
1451		SDL_CFLAGS=`${path}/sdl-config --cflags`
1452		MK_EXEC_FOUND="Yes"
1453		break
1454	fi
1455done
1456if [ "${cache}" != "" ]; then
1457	echo "$SDL_CFLAGS" > ${cache}/exec-SDL_CFLAGS
1458	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_CFLAGS
1459fi
1460MK_EXEC_FOUND="No"
1461SDL_LIBS=""
1462for path in `echo $PATH | sed 's/:/ /g'`; do
1463	if [ -e "${path}/sdl-config" ]; then
1464		SDL_LIBS=`${path}/sdl-config --libs`
1465		MK_EXEC_FOUND="Yes"
1466		break
1467	fi
1468done
1469if [ "${cache}" != "" ]; then
1470	echo "$SDL_LIBS" > ${cache}/exec-SDL_LIBS
1471	echo $MK_EXEC_FOUND > ${cache}/exec-found-SDL_LIBS
1472fi
1473;;
1474esac
1475fi;
1476if [ "${SDL_VERSION}" != "" ]; then
1477if [ "" != "" ]; then
1478echo "yes ($SDL_VERSION in )"
1479echo "yes ($SDL_VERSION in )" >> config.log
1480else
1481echo "yes ($SDL_VERSION)"
1482echo "yes ($SDL_VERSION)" >> config.log
1483fi;
1484MK_VERSION_MAJOR=`echo "$SDL_VERSION" |sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\).*/\1/'`;
1485MK_VERSION_MINOR=`echo "$SDL_VERSION" |sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\).*/\2/'`;
1486MK_VERSION_MICRO=`echo "$SDL_VERSION" |sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\).*/\3/'`;
1487MK_VERSION_OK="no"
1488if [ $MK_VERSION_MAJOR -gt 1 ]; then
1489	MK_VERSION_OK="yes";
1490elif [ $MK_VERSION_MAJOR -eq 1 ]; then
1491	if [ "$MK_VERSION_MINOR" = "" ]; then
1492		MK_VERSION_OK="yes"
1493	else
1494		if [ $MK_VERSION_MINOR -gt 2 ]; then
1495			MK_VERSION_OK="yes";
1496		elif [ $MK_VERSION_MINOR -eq 2 ]; then
1497			if [ "$MK_VERSION_MICRO" = "" ]; then
1498				MK_VERSION_OK="yes"
1499			else
1500				if [ $MK_VERSION_MICRO -ge 0 ]; then
1501					MK_VERSION_OK="yes"
1502				fi
1503			fi
1504		fi
1505	fi
1506fi
1507if [ "${MK_VERSION_OK}" = "no" ]; then
1508echo "*"
1509echo "*" >> config.log
1510echo "* Minimum required version is 1.2.0 (found $SDL_VERSION); skipping."
1511echo "* Minimum required version is 1.2.0 (found $SDL_VERSION); skipping." >> config.log
1512echo "*"
1513echo "*" >> config.log
1514fi;
1515else
1516if [ "" != "" ]; then
1517echo "no (not in )"
1518echo "no (not in )" >> config.log
1519else
1520echo "no"
1521echo "no" >> config.log
1522fi;
1523MK_VERSION_OK="no"
1524fi;
1525if [ "${MK_VERSION_OK}" = "yes" ]; then
1526$ECHO_N "checking whether SDL works..."
1527$ECHO_N "checking whether SDL works..." >> config.log
1528MK_COMPILE_STATUS="OK"
1529cat << EOT > conftest.c
1530#ifdef _USE_SDL_FRAMEWORK
1531# include <SDL/SDL.h>
1532# ifdef main
1533#  undef main
1534# endif
1535#else
1536# include <SDL.h>
1537#endif
1538int main(int argc, char *argv[]) {
1539	SDL_Surface *su;
1540
1541	if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE) != 0) {
1542		return (1);
1543	}
1544	su = SDL_CreateRGBSurface(0, 16, 16, 32, 0, 0, 0, 0);
1545	SDL_FreeSurface(su);
1546	SDL_Quit();
1547	return (0);
1548}
1549
1550EOT
1551echo "$CC $CFLAGS $TEST_CFLAGS ${SDL_CFLAGS} -o $testdir/conftest conftest.c ${SDL_LIBS}" >>config.log
1552$CC $CFLAGS $TEST_CFLAGS ${SDL_CFLAGS} -o $testdir/conftest conftest.c ${SDL_LIBS} 2>>config.log
1553if [ $? != 0 ]; then
1554	echo "-> failed ($?)" >> config.log
1555	MK_COMPILE_STATUS="FAIL($?)"
1556fi
1557if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
1558echo "yes"
1559echo "yes" >> config.log
1560HAVE_SDL="yes"
1561echo "#ifndef HAVE_SDL" > $BLD/config/have_sdl.h
1562echo "#define HAVE_SDL \"$HAVE_SDL\"" >> $BLD/config/have_sdl.h
1563echo "#endif" >> $BLD/config/have_sdl.h
1564echo "hdefs[\"HAVE_SDL\"] = \"$HAVE_SDL\"" >>configure.lua
1565else
1566echo "no"
1567echo "no" >> config.log
1568HAVE_SDL="no"
1569echo "#undef HAVE_SDL" >$BLD/config/have_sdl.h
1570echo "hdefs[\"HAVE_SDL\"] = nil" >>configure.lua
1571fi;
1572rm -f conftest.c $testdir/conftest$EXECSUFFIX
1573if [ "${HAVE_SDL}" = "yes" ]; then
1574echo "#ifndef SDL_CFLAGS" > $BLD/config/sdl_cflags.h
1575echo "#define SDL_CFLAGS \"$SDL_CFLAGS\"" >> $BLD/config/sdl_cflags.h
1576echo "#endif" >> $BLD/config/sdl_cflags.h
1577echo "hdefs[\"SDL_CFLAGS\"] = \"$SDL_CFLAGS\"" >>configure.lua
1578echo "#ifndef SDL_LIBS" > $BLD/config/sdl_libs.h
1579echo "#define SDL_LIBS \"$SDL_LIBS\"" >> $BLD/config/sdl_libs.h
1580echo "#endif" >> $BLD/config/sdl_libs.h
1581echo "hdefs[\"SDL_LIBS\"] = \"$SDL_LIBS\"" >>configure.lua
1582else
1583$ECHO_N "checking whether SDL works (with X11 libs)..."
1584$ECHO_N "checking whether SDL works (with X11 libs)..." >> config.log
1585SDL_LIBS="${SDL_LIBS} -L/usr/X11R6/lib -lX11 -lXext -lXrandr -lXrender"
1586MK_COMPILE_STATUS="OK"
1587cat << EOT > conftest.c
1588#ifdef _USE_SDL_FRAMEWORK
1589# include <SDL/SDL.h>
1590# ifdef main
1591#  undef main
1592# endif
1593#else
1594# include <SDL.h>
1595#endif
1596int main(int argc, char *argv[]) {
1597	SDL_Surface *su;
1598
1599	if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE) != 0) {
1600		return (1);
1601	}
1602	su = SDL_CreateRGBSurface(0, 16, 16, 32, 0, 0, 0, 0);
1603	SDL_FreeSurface(su);
1604	SDL_Quit();
1605	return (0);
1606}
1607
1608EOT
1609echo "$CC $CFLAGS $TEST_CFLAGS ${SDL_CFLAGS} -o $testdir/conftest conftest.c ${SDL_LIBS}" >>config.log
1610$CC $CFLAGS $TEST_CFLAGS ${SDL_CFLAGS} -o $testdir/conftest conftest.c ${SDL_LIBS} 2>>config.log
1611if [ $? != 0 ]; then
1612	echo "-> failed ($?)" >> config.log
1613	MK_COMPILE_STATUS="FAIL($?)"
1614fi
1615if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
1616echo "yes"
1617echo "yes" >> config.log
1618HAVE_SDL="yes"
1619echo "#ifndef HAVE_SDL" > $BLD/config/have_sdl.h
1620echo "#define HAVE_SDL \"$HAVE_SDL\"" >> $BLD/config/have_sdl.h
1621echo "#endif" >> $BLD/config/have_sdl.h
1622echo "hdefs[\"HAVE_SDL\"] = \"$HAVE_SDL\"" >>configure.lua
1623else
1624echo "no"
1625echo "no" >> config.log
1626HAVE_SDL="no"
1627echo "#undef HAVE_SDL" >$BLD/config/have_sdl.h
1628echo "hdefs[\"HAVE_SDL\"] = nil" >>configure.lua
1629fi;
1630rm -f conftest.c $testdir/conftest$EXECSUFFIX
1631if [ "${HAVE_SDL}" = "yes" ]; then
1632echo "#ifndef SDL_CFLAGS" > $BLD/config/sdl_cflags.h
1633echo "#define SDL_CFLAGS \"$SDL_CFLAGS\"" >> $BLD/config/sdl_cflags.h
1634echo "#endif" >> $BLD/config/sdl_cflags.h
1635echo "hdefs[\"SDL_CFLAGS\"] = \"$SDL_CFLAGS\"" >>configure.lua
1636echo "#ifndef SDL_LIBS" > $BLD/config/sdl_libs.h
1637echo "#define SDL_LIBS \"$SDL_LIBS\"" >> $BLD/config/sdl_libs.h
1638echo "#endif" >> $BLD/config/sdl_libs.h
1639echo "hdefs[\"SDL_LIBS\"] = \"$SDL_LIBS\"" >>configure.lua
1640else
1641echo "#undef SDL_CFLAGS" >$BLD/config/sdl_cflags.h
1642echo "hdefs[\"SDL_CFLAGS\"] = nil" >>configure.lua
1643SDL_CFLAGS=""
1644echo "#undef SDL_LIBS" >$BLD/config/sdl_libs.h
1645echo "hdefs[\"SDL_LIBS\"] = nil" >>configure.lua
1646SDL_LIBS=""
1647fi;
1648fi;
1649else
1650echo "#undef HAVE_SDL" >$BLD/config/have_sdl.h
1651echo "hdefs[\"HAVE_SDL\"] = nil" >>configure.lua
1652echo "#undef SDL_CFLAGS" >$BLD/config/sdl_cflags.h
1653echo "hdefs[\"SDL_CFLAGS\"] = nil" >>configure.lua
1654echo "#undef SDL_LIBS" >$BLD/config/sdl_libs.h
1655echo "hdefs[\"SDL_LIBS\"] = nil" >>configure.lua
1656fi;
1657if [ "${HAVE_SDL}" != "yes" ]; then
1658echo "* "
1659echo "* " >> config.log
1660echo "* This software requires sdl installed on your system."
1661echo "* This software requires sdl installed on your system." >> config.log
1662echo "* "
1663echo "* " >> config.log
1664echo "configure failed!"
1665exit 1
1666fi;
1667if [ "${MK_VERSION_OK}" != "yes" ]; then
1668echo "* "
1669echo "* " >> config.log
1670echo "* This software requires sdl version >= 1.2.0,"
1671echo "* This software requires sdl version >= 1.2.0," >> config.log
1672echo "* please upgrade and try again."
1673echo "* please upgrade and try again." >> config.log
1674echo "* "
1675echo "* " >> config.log
1676echo "configure failed!"
1677exit 1
1678fi;
1679CFLAGS="$CFLAGS -I$SRC"
1680CXXFLAGS="$CXXFLAGS -I$SRC"
1681CFLAGS="$CFLAGS -D_USE_AGAR_STD"
1682CXXFLAGS="$CXXFLAGS -D_USE_AGAR_STD"
1683CFLAGS="$CFLAGS -D_USE_AGAR_QUEUE"
1684CXXFLAGS="$CXXFLAGS -D_USE_AGAR_QUEUE"
1685CFLAGS="$CFLAGS -D_USE_AGAR_TYPES"
1686CXXFLAGS="$CXXFLAGS -D_USE_AGAR_TYPES"
1687if [ "${enable_warnings}" = "yes" ]
1688 then
1689CFLAGS="$CFLAGS -Wall"
1690CXXFLAGS="$CXXFLAGS -Wall"
1691CFLAGS="$CFLAGS -Werror"
1692CXXFLAGS="$CXXFLAGS -Werror"
1693CFLAGS="$CFLAGS -Wmissing-prototypes"
1694CXXFLAGS="$CXXFLAGS -Wmissing-prototypes"
1695fi
1696CFLAGS="$CFLAGS -I$BLD"
1697CXXFLAGS="$CXXFLAGS -I$BLD"
1698echo "CC=$CC" >>Makefile.config
1699echo "mdefs[\"CC\"] = \"$CC\"" >>configure.lua
1700echo "LOCALEDIR=$LOCALEDIR" >>Makefile.config
1701echo "mdefs[\"LOCALEDIR\"] = \"$LOCALEDIR\"" >>configure.lua
1702echo "LIBEXECDIR=$LIBEXECDIR" >>Makefile.config
1703echo "mdefs[\"LIBEXECDIR\"] = \"$LIBEXECDIR\"" >>configure.lua
1704echo "LIBDIR=$LIBDIR" >>Makefile.config
1705echo "mdefs[\"LIBDIR\"] = \"$LIBDIR\"" >>configure.lua
1706echo "EXECSUFFIX=$EXECSUFFIX" >>Makefile.config
1707echo "mdefs[\"EXECSUFFIX\"] = \"$EXECSUFFIX\"" >>configure.lua
1708echo "CXXFLAGS=$CXXFLAGS" >>Makefile.config
1709echo "mdefs[\"CXXFLAGS\"] = \"$CXXFLAGS\"" >>configure.lua
1710echo "AGAR_CFLAGS=$AGAR_CFLAGS" >>Makefile.config
1711echo "mdefs[\"AGAR_CFLAGS\"] = \"$AGAR_CFLAGS\"" >>configure.lua
1712echo "SDL_LIBS=$SDL_LIBS" >>Makefile.config
1713echo "mdefs[\"SDL_LIBS\"] = \"$SDL_LIBS\"" >>configure.lua
1714echo "HAVE_GETTEXT=$HAVE_GETTEXT" >>Makefile.config
1715echo "mdefs[\"HAVE_GETTEXT\"] = \"$HAVE_GETTEXT\"" >>configure.lua
1716echo "HAVE_LD_STATIC_LIBGCC=$HAVE_LD_STATIC_LIBGCC" >>Makefile.config
1717echo "mdefs[\"HAVE_LD_STATIC_LIBGCC\"] = \"$HAVE_LD_STATIC_LIBGCC\"" >>configure.lua
1718echo "HAVE_CC_MWINDOWS=$HAVE_CC_MWINDOWS" >>Makefile.config
1719echo "mdefs[\"HAVE_CC_MWINDOWS\"] = \"$HAVE_CC_MWINDOWS\"" >>configure.lua
1720echo "DATADIR=$DATADIR" >>Makefile.config
1721echo "mdefs[\"DATADIR\"] = \"$DATADIR\"" >>configure.lua
1722echo "PROG_CLI_FLAGS=$PROG_CLI_FLAGS" >>Makefile.config
1723echo "mdefs[\"PROG_CLI_FLAGS\"] = \"$PROG_CLI_FLAGS\"" >>configure.lua
1724echo "BINDIR=$BINDIR" >>Makefile.config
1725echo "mdefs[\"BINDIR\"] = \"$BINDIR\"" >>configure.lua
1726echo "HAVE_CC_WARNINGS=$HAVE_CC_WARNINGS" >>Makefile.config
1727echo "mdefs[\"HAVE_CC_WARNINGS\"] = \"$HAVE_CC_WARNINGS\"" >>configure.lua
1728echo "HAVE_CC_MCONSOLE=$HAVE_CC_MCONSOLE" >>Makefile.config
1729echo "mdefs[\"HAVE_CC_MCONSOLE\"] = \"$HAVE_CC_MCONSOLE\"" >>configure.lua
1730echo "ENABLE_NLS=$ENABLE_NLS" >>Makefile.config
1731echo "mdefs[\"ENABLE_NLS\"] = \"$ENABLE_NLS\"" >>configure.lua
1732echo "HAVE_AGAR=$HAVE_AGAR" >>Makefile.config
1733echo "mdefs[\"HAVE_AGAR\"] = \"$HAVE_AGAR\"" >>configure.lua
1734echo "CFLAGS=$CFLAGS" >>Makefile.config
1735echo "mdefs[\"CFLAGS\"] = \"$CFLAGS\"" >>configure.lua
1736echo "HAVE_LD_NO_UNDEFINED=$HAVE_LD_NO_UNDEFINED" >>Makefile.config
1737echo "mdefs[\"HAVE_LD_NO_UNDEFINED\"] = \"$HAVE_LD_NO_UNDEFINED\"" >>configure.lua
1738echo "MANDIR=$MANDIR" >>Makefile.config
1739echo "mdefs[\"MANDIR\"] = \"$MANDIR\"" >>configure.lua
1740echo "HAVE_SDL=$HAVE_SDL" >>Makefile.config
1741echo "mdefs[\"HAVE_SDL\"] = \"$HAVE_SDL\"" >>configure.lua
1742echo "LIBTOOLOPTS_SHARED=$LIBTOOLOPTS_SHARED" >>Makefile.config
1743echo "mdefs[\"LIBTOOLOPTS_SHARED\"] = \"$LIBTOOLOPTS_SHARED\"" >>configure.lua
1744echo "MODULEDIR=$MODULEDIR" >>Makefile.config
1745echo "mdefs[\"MODULEDIR\"] = \"$MODULEDIR\"" >>configure.lua
1746echo "PROG_GUI_FLAGS=$PROG_GUI_FLAGS" >>Makefile.config
1747echo "mdefs[\"PROG_GUI_FLAGS\"] = \"$PROG_GUI_FLAGS\"" >>configure.lua
1748echo "HAVE_CYGWIN=$HAVE_CYGWIN" >>Makefile.config
1749echo "mdefs[\"HAVE_CYGWIN\"] = \"$HAVE_CYGWIN\"" >>configure.lua
1750echo "STATEDIR=$STATEDIR" >>Makefile.config
1751echo "mdefs[\"STATEDIR\"] = \"$STATEDIR\"" >>configure.lua
1752echo "SYSCONFDIR=$SYSCONFDIR" >>Makefile.config
1753echo "mdefs[\"SYSCONFDIR\"] = \"$SYSCONFDIR\"" >>configure.lua
1754echo "SDL_CFLAGS=$SDL_CFLAGS" >>Makefile.config
1755echo "mdefs[\"SDL_CFLAGS\"] = \"$SDL_CFLAGS\"" >>configure.lua
1756echo "AGAR_LIBS=$AGAR_LIBS" >>Makefile.config
1757echo "mdefs[\"AGAR_LIBS\"] = \"$AGAR_LIBS\"" >>configure.lua
1758if [ "${srcdir}" != "" ]; then
1759	$ECHO_N "* Source is in ${srcdir}. Generating Makefiles..."
1760	${PERL} ${SRC}/mk/mkconcurrent.pl ${SRC}
1761	if [ $? != 0 ]; then
1762		exit 1;
1763	fi
1764	echo "done"
1765fi
1766echo "*"
1767echo "* Configuration successful. Use \"make depend all\" to compile,"
1768echo "* and \"make install\" to install this software under $PREFIX."
1769echo "*"
1770