3 # @(#) configure.inc 1.40@(#)
4 # Copyright (c) 1999-2007 David Parsons. All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in
13 # the documentation and/or other materials provided with the
15 # 3. My name may not be used to endorse or promote products derived
16 # from this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY DAVID PARSONS ``AS IS'' AND ANY
19 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID
22 # PARSONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 # THE POSSIBILITY OF SUCH DAMAGE.
34 # this preamble code is executed when this file is sourced and it picks
35 # interesting things off the command line.
37 ac_default_path="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
39 ac_standard="--src=DIR where the source lives (.)
40 --prefix=DIR where to install the final product (/usr/local)
41 --execdir=DIR where to put executables (prefix/bin)
42 --sbindir=DIR where to put static executables (prefix/sbin)
43 --confdir=DIR where to put configuration information (/etc)
44 --libdir=DIR where to put libraries (prefix/lib)
45 --libexecdir=DIR where to put private executables
46 --mandir=DIR where to put manpages"
50 if dirname B/A 2>/dev/null >/dev/null; then
56 echo "$1" | sed -e 's:/[^/]*$::'
64 ac_configure_command="$ac_configure_command $Q$x$Q"
66 # ac_configure_command="$*"
68 __d=`__ac_dirname "$ac_progname"`
69 if [ "$__d" = "$ac_progname" ]; then
72 AC_SRCDIR=`cd $__d;pwd`
83 while [ $# -gt 0 ]; do
88 AC_SRCDIR=`__ac_dir "$2"`
93 __d=`echo "$1" | sed -e 's/^[^=]*=//'`
94 AC_SRCDIR=`__ac_dir "$__d"`
99 AC_PREFIX=`__ac_dir "$2"`
104 __d=`echo "$1"| sed -e 's/^[^=]*=//'`
105 AC_PREFIX=`__ac_dir "$__d"`
110 AC_CONFDIR=`__ac_dir "$2"`
115 __d=`echo "$1" | sed -e 's/^[^=]*=//'`
116 AC_CONFDIR=`__ac_dir "$__d"`
120 X--libexec|X--libexecdir)
121 AC_LIBEXEC=`__ac_dir "$2"`
125 X--libexec=*|X--libexecdir=*)
126 __d=`echo "$1" | sed -e 's/^[^=]*=//'`
127 AC_LIBEXEC=`__ac_dir "$__d"`
132 AC_LIBDIR=`__ac_dir "$2"`
136 X--lib=*|X--libdir=*)
137 __d=`echo "$1" | sed -e 's/^[^=]*=//'`
138 AC_LIBDIR=`__ac_dir "$__d"`
143 AC_EXECDIR=`__ac_dir "$2"`
147 X--exec=*|X--execdir=*)
148 __d=`echo "$1" | sed -e 's/^[^=]*=//'`
149 AC_EXECDIR=`__ac_dir "$__d"`
154 AC_SBINDIR=`__ac_dir "$2"`
158 X--sbin=*|X--sbindir=*)
159 __d=`echo "$1" | sed -e 's/^[^=]*=//'`
160 AC_SBINDIR=`__ac_dir "$__d"`
165 AC_MANDIR=`__ac_dir "$2"`
169 X--man=*|X--mandir=*)
170 __d=`echo "$1" | sed -e 's/^[^=]*=//'`
171 AC_MANDIR=`__ac_dir "$__d"`
176 _var=`echo "$1"| sed -n 's/^--use-\([A-Za-z][-A-Za-z0-9_]*\)=.*$/\1/p'`
178 _val=`echo "$1" | sed -e 's/^--use-[^=]*=\(.*\)$/\1/'`
179 _v=`echo $_var | tr '[a-z]' '[A-Z]' | tr '-' '_'`
181 X[Yy][Ee][Ss]|X[Tt][Rr][Uu][Ee]) eval USE_${_v}=T ;;
182 X[Nn][Oo]|X[Ff][Aa][Ll][Ss][Ee]) eval unset USE_${_v} ;;
183 *) echo "Bad value for --use-$_var ; must be yes or no"
187 echo "Bad option $1. Use --help to show options" 1>&2
193 _var=`echo "$1"|sed -n 's/^--use-\([A-Za-z][-A-Za-z0-9_]*\)$/\1/p'`
194 _v=`echo $_var | tr '[a-z]' '[A-Z]' | tr '-' '_'`
199 _var=`echo "$1"| sed -n 's/^--with-\([A-Za-z][-A-Za-z0-9_]*\)=.*$/\1/p'`
201 _val=`echo "$1" | sed -e 's/^--with-[^=]*=\(.*\)$/\1/'`
202 _v=`echo $_var | tr '[a-z]' '[A-Z]' | tr '-' '_'`
203 eval WITH_${_v}=\"$_val\"
205 echo "Bad option $1. Use --help to show options" 1>&2
211 _var=`echo "$1" | sed -n 's/^--with-\([A-Za-z][A-Za-z0-9_-]*\)$/\1/p'`
213 _v=`echo $_var | tr '[a-z]' '[A-Z]' | tr '-' '_'`
216 echo "Bad option $1. Use --help to show options" 1>&2
223 test "$ac_help" && echo "$ac_help"
226 *) if [ "$LOCAL_AC_OPTIONS" ]; then
227 eval "$LOCAL_AC_OPTIONS"
231 if [ "$ac_error" ]; then
232 echo "Bad option $1. Use --help to show options" 1>&2
244 ${ac_echo:-echo} "${@}$ac_echo_nonl"
248 # log something to the terminal and to a logfile.
256 # log something to the terminal without a newline, and to a logfile with
265 # log something to the terminal
272 # log something to the terminal, no newline
280 # AC_CONTINUE tells configure not to bomb if something fails, but to
281 # continue blithely along
288 # Emulate gnu autoconf's AC_CHECK_HEADERS() function
290 AC_CHECK_HEADERS () {
293 echo "/* AC_CHECK_HEADERS */" > /tmp/ngc$$.c
295 echo "#include <$hdr>" >> /tmp/ngc$$.c
297 echo "main() { }" >> /tmp/ngc$$.c
299 LOGN "checking for header $hdr"
301 if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c; then
302 AC_DEFINE 'HAVE_'`echo $hdr | tr 'a-z' 'A-Z' | tr './' '_'` 1
309 rm -f /tmp/ngc$$.c /tmp/ngc$$
315 # emulate GNU autoconf's AC_CHECK_FUNCS function
325 echo "#include <$1>" >> /tmp/ngc$$.c
329 cat >> /tmp/ngc$$.c << EOF
337 LOGN "checking for the $F function"
339 if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS; then
340 AC_DEFINE `echo ${2:-HAVE_$F} | tr 'a-z' 'A-Z'` 1
344 echo "offending command was:"
346 echo "$AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS"
350 rm -f /tmp/ngc$$.c /tmp/ngc$$
356 # check to see if some structure exists
358 # usage: AC_CHECK_STRUCT structure {include ...}
367 for include in $*; do
368 echo "#include <$include>" >> /tmp/ngc$$.c
371 cat >> /tmp/ngc$$.c << EOF
378 LOGN "checking for struct $struct"
380 if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $AC_LIBS 2>>config.log; then
381 AC_DEFINE HAVE_STRUCT_`echo ${struct} | tr 'a-z' 'A-Z'`
388 rm -f /tmp/ngc$$.c /tmp/ngc$$
394 # check to see if some structure contains a field
396 # usage: AC_CHECK_FIELD structure field {include ...}
408 echo "#include <$include>" >> /tmp/ngc$$.c
411 cat >> /tmp/ngc$$.c << EOF
420 LOGN "checking that struct $struct has a $field field"
422 if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $AC_LIBS 2>>config.log; then
423 AC_DEFINE HAVE_`echo ${struct}_$field | tr 'a-z' 'A-Z'`
430 rm -f /tmp/ngc$$.c /tmp/ngc$$
436 # check that the C compiler works
439 test "$AC_CC" && return 0
441 cat > /tmp/ngc$$.c << \EOF
445 puts("hello, sailor");
449 TLOGN "checking the C compiler"
451 unset AC_CFLAGS AC_LDFLAGS
455 elif [ "$WITH_PATH" ]; then
457 elif [ "`acLookFor cc`" ]; then
458 # don't specify the full path if the user is looking in their $PATH
463 # finally check for POSIX c89
464 test "$AC_CC" || AC_CC=`acLookFor c89`
466 if [ ! "$AC_CC" ]; then
467 TLOG " (no C compiler found)"
470 echo "checking out the C compiler"
472 $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c
476 if [ $status -eq 0 ]; then
479 # check that the CFLAGS and LDFLAGS aren't bogus
481 unset AC_CFLAGS AC_LDFLAGS
483 if [ "$CFLAGS" ]; then
484 test "$CFLAGS" && echo "validating CFLAGS=${CFLAGS}"
485 if $AC_CC $CFLAGS -o /tmp/ngc$$.o /tmp/ngc$$.c ; then
486 AC_CFLAGS=${CFLAGS:-"-g"}
487 test "$CFLAGS" && echo "CFLAGS=\"${CFLAGS}\" are okay"
488 elif [ "$CFLAGS" ]; then
489 echo "ignoring bogus CFLAGS=\"${CFLAGS}\""
494 if [ "$LDFLAGS" ]; then
495 test "$LDFLAGS" && echo "validating LDFLAGS=${LDFLAGS}"
496 if $AC_CC $LDFLAGS -o /tmp/ngc$$ /tmp/ngc$$.o; then
497 AC_LDFLAGS=${LDFLAGS:-"-g"}
498 test "$LDFLAGS" && TLOG "LDFLAGS=\"${LDFLAGS}\" are okay"
499 elif [ "$LDFLAGS" ]; then
500 TLOG "ignoring bogus LDFLAGS=\"${LDFLAGS}\""
503 AC_LDFLAGS=${CFLAGS:-"-g"}
506 AC_FAIL " does not compile code properly"
511 rm -f /tmp/ngc$$ /tmp/ngc$$.c /tmp/ngc$$.o
518 # acLookFor actually looks for a program, without setting anything.
521 path=${AC_PATH:-$ac_default_path}
530 for program in $*; do
533 if [ $__mode $x/$program -a -f $x/$program ]; then
545 # check that a program exists and set its path
558 TLOGN "looking for $1"
560 DEST=`acLookFor $__mode $*`
562 __sym=`echo "$SYM" | tr '[a-z]' '[A-Z]'`
567 AC_DEFINE PATH_$__sym \""$DEST"\"
568 AC_SUB $__sym "$DEST"
573 echo "$1 is not found"
581 # AC_INIT starts the ball rolling
583 # After AC_INIT, fd's 1 and 2 point to config.log
584 # and fd 5 points to what used to be fd 1
587 __config_files="config.cmd config.sub config.h config.mak config.log"
588 __config_detritus="config.h.tmp"
589 rm -f $__config_files $__config_detritus
591 exec 5>&1 1>$__cwd/config.log 2>&1
592 AC_CONFIGURE_FOR=__AC_`echo $1 | sed -e 's/\..$//' | tr 'a-z' 'A-Z' | tr ' ' '_'`_D
594 # check to see whether to use echo -n or echo ...\c
598 if grep "helloworld" $$ >/dev/null; then
600 echo "[echo -n] works"
605 if grep "helloworld" $$ >/dev/null; then
607 echo "[echo ...\\c] works"
612 LOG "Configuring for [$1]"
614 rm -f $__cwd/config.h
615 cat > $__cwd/config.h.tmp << EOF
617 * configuration for $1${2:+" ($2)"}, generated `date`
618 * by ${LOGNAME:-`whoami`}@`hostname`
620 #ifndef $AC_CONFIGURE_FOR
621 #define $AC_CONFIGURE_FOR 1
627 if [ -d $AC_PREFIX/share/man ]; then
628 for t in 1 2 3 4 5 6 7 8 9; do
629 if [ -d $AC_PREFIX/share/man/man$t ]; then
631 elif [ -d $AC_PREFIX/share/man/cat$t ]; then
639 if [ -d $AC_PREFIX/libexec ]; then
646 AC_PREFIX=${AC_PREFIX:-/usr/local}
647 AC_EXECDIR=${AC_EXECDIR:-$AC_PREFIX/bin}
648 AC_SBINDIR=${AC_SBINDIR:-$AC_PREFIX/sbin}
649 AC_LIBDIR=${AC_LIBDIR:-$AC_PREFIX/lib}
650 AC_MANDIR=${AC_MANDIR:-$AC_PREFIX$__share/man}
651 AC_LIBEXEC=${AC_LIBEXEC:-$AC_PREFIX/$__libexec}
652 AC_CONFDIR=${AC_CONFDIR:-/etc}
654 AC_PATH=${WITH_PATH:-$PATH}
658 ac_os=`uname -s | sed 's/[-_].*//; s/[^a-zA-Z0-9]/_/g'`
659 _os=`echo $ac_os | tr '[a-z]' '[A-Z]'`
667 # AC_LIBRARY checks to see if a given library exists and contains the
669 # usage: AC_LIBRARY function library [alternate ...]
680 X-l*) __acllibs="$__acllibs $x" ;;
681 *) __aclhdrs="$__aclhdrs $x" ;;
685 # first see if the function can be found in any of the
687 AC_QUIET AC_CHECK_FUNCS $SRC $__aclhdrs && return 0
689 # then search through the list of libraries
691 for x in $__acllibs; do
693 if AC_QUIET AC_CHECK_FUNCS $SRC $__aclhdrs; then
694 AC_LIBS="$AC_LIBS $x"
703 # AC_PROG_LEX checks to see if LEX exists, and if it's lex or flex.
706 TLOGN "looking for lex "
711 AC_DEFINE PATH_LEX \"$DEST\"
715 DEST=`acLookFor flex`
718 AC_DEFINE 'LEX' \"$DEST\"
719 AC_SUB 'LEX', "$DEST"
723 echo "neither lex or flex found"
729 if AC_LIBRARY yywrap -ll -lfl; then
733 TLOG "(no lex library found)"
739 # AC_PROG_YACC checks to see if YACC exists, and if it's bison or
744 TLOGN "looking for yacc "
746 DEST=`acLookFor yacc`
749 AC_DEFINE PATH_YACC \"$DEST\"
750 AC_SUB 'YACC' "$DEST"
754 DEST=`acLookFor bison`
757 AC_DEFINE 'YACC' \"$DEST\"
758 AC_SUB 'YACC' "$DEST -y"
759 echo "yacc is $DEST -y"
763 echo "neither yacc or bison found"
773 # AC_PROG_LN_S checks to see if ln exists, and, if so, if ln -s works
776 test "$AC_FIND_PROG" || AC_PROG_FIND
778 test "$AC_FIND_PROG" || return 1
780 TLOGN "looking for \"ln -s\""
785 $DEST -s /tmp/a$$ /tmp/b$$
786 if [ "`$AC_FIND_PROG /tmp/b$$ -type l -print`" ]; then
788 echo "$DEST exists, and ln -s works"
789 AC_SUB 'LN_S' "$DEST -s"
793 TLOG " ($DEST exists, but -s does not seem to work)"
794 echo "$DEST exists, but ln -s doesn't seem to work"
808 # AC_PROG_FIND looks for the find program and sets the FIND environment
812 if test -z "$AC_FIND_PROG"; then
813 MF_PATH_INCLUDE FIND find
823 # AC_PROG_AWK looks for the awk program and sets the AWK environment
827 if test -z "$AC_AWK_PROG"; then
828 MF_PATH_INCLUDE AWK awk
838 # AC_PROG_SED looks for the sed program and sets the SED environment
842 if test -z "$AC_SED_PROG"; then
843 MF_PATH_INCLUDE SED sed
853 # AC_HEADER_SYS_WAIT looks for sys/wait.h
855 AC_HEADER_SYS_WAIT () {
856 AC_CHECK_HEADERS sys/wait.h || return 1
860 # AC_TYPE_PID_T checks to see if the pid_t type exists
863 cat > /tmp/pd$$.c << EOF
864 #include <sys/types.h>
868 LOGN "checking for pid_t"
870 if $AC_CC -c /tmp/pd$$.c -o /tmp/pd$$.o; then
874 echo "typedef int pid_t;" >> $__cwd/config.h.tmp
878 rm -f /tmp/pd$$.o /tmp/pd$$.c
884 # AC_C_CONST checks to see if the compiler supports the const keyword
887 cat > /tmp/pd$$.c << EOF
890 LOGN "checking for \"const\" keyword"
892 if $AC_CC -c /tmp/pd$$.c -o /tmp/pd$$.o; then
896 AC_DEFINE 'const' '/**/'
900 rm -f /tmp/pd$$.o /tmp/pd$$.c
906 # AC_SCALAR_TYPES checks to see if the compiler can generate 2 and 4 byte ints.
909 cat > /tmp/pd$$.c << EOF
913 unsigned long v_long;
915 unsigned short v_short;
917 if (sizeof v_long == 4)
918 puts("#define DWORD unsigned long");
919 else if (sizeof v_int == 4)
920 puts("#define DWORD unsigned int");
924 if (sizeof v_int == 2)
925 puts("#define WORD unsigned int");
926 else if (sizeof v_short == 2)
927 puts("#define WORD unsigned short");
930 puts("#define BYTE unsigned char");
935 LOGN "defining WORD & DWORD scalar types"
936 if $AC_CC /tmp/pd$$.c -o /tmp/pd$$; then
937 if /tmp/pd$$ >> $__cwd/config.h.tmp; then
943 *) TLOG " ** FAILED **" ;;
945 rm -f /tmp/pd$$ /tmp/pd$$.c
950 # AC_OUTPUT generates makefiles from makefile.in's
954 AC_SUB 'LIBS' "$AC_LIBS"
955 AC_SUB 'CONFIGURE_FILES' "$__config_files"
956 AC_SUB 'CONFIGURE_DETRITUS' "$__config_detritus"
957 AC_SUB 'GENERATED_FILES' "$*"
958 AC_SUB 'CFLAGS' "$AC_CFLAGS"
959 AC_SUB 'FCFLAGS' "$AC_FCFLAGS"
960 AC_SUB 'CXXFLAGS' "$AC_CXXFLAGS"
961 AC_SUB 'LDFLAGS' "$AC_LDFLAGS"
962 AC_SUB 'srcdir' "$AC_SRCDIR"
963 AC_SUB 'prefix' "$AC_PREFIX"
964 AC_SUB 'exedir' "$AC_EXECDIR"
965 AC_SUB 'sbindir' "$AC_SBINDIR"
966 AC_SUB 'libdir' "$AC_LIBDIR"
967 AC_SUB 'libexec' "$AC_LIBEXEC"
968 AC_SUB 'confdir' "$AC_CONFDIR"
969 AC_SUB 'mandir' "$AC_MANDIR"
971 if [ -r config.sub ]; then
972 test "$AC_SED_PROG" || AC_PROG_SED
973 test "$AC_SED_PROG" || return 1
976 echo "#endif/* ${AC_CONFIGURE_FOR} */" >> config.h.tmp
980 cat - > config.cmd << EOF
982 ${CXX:+CXX=${Q}${CXX}${Q}} ${CXXFLAGS:+CXXFLAGS=${Q}${CXXFLAGS}${Q}} ${FC:+FC=${Q}${FC}${Q}} ${FCFLAGS:+FCFLAGS=${Q}${FCFLAGS}${Q}} ${CC:+CC=${Q}${CC}${Q}} ${CFLAGS:+CFLAGS=${Q}${CFLAGS}${Q}} $ac_progname $ac_configure_command
987 for makefile in $*;do
988 if test -r $__d/${makefile}.in; then
989 LOG "generating $makefile"
990 ./config.md `__ac_dirname ./$makefile` 2>/dev/null
991 $AC_SED_PROG -f config.sub < $__d/${makefile}.in > $makefile
992 __config_files="$__config_files $makefile"
994 LOG "WARNING: ${makefile}.in does not exist!"
1002 cp $__cwd/config.h.tmp $__cwd/config.h
1006 # AC_CHECK_FLOCK checks to see if flock() exists and if the LOCK_NB argument
1011 AC_CHECK_HEADERS sys/types.h sys/file.h fcntl.h
1015 #include <sys/file.h>
1016 #include <sys/types.h>
1021 int x = open("$$.c", O_RDWR, 0666);
1022 int y = open("$$.c", O_RDWR, 0666);
1024 if (flock(x, LOCK_EX) != 0)
1026 if (flock(y, LOCK_EX|LOCK_NB) == 0)
1032 LOGN "checking for flock()"
1034 if $AC_CC -o flock $$.c ; then
1048 case "$HAS_FLOCK" in
1056 # AC_CHECK_RESOLVER finds out whether the berkeley resolver is
1057 # present on this system.
1059 AC_CHECK_RESOLVER () {
1062 TLOGN "checking for the Berkeley resolver library"
1064 cat > /tmp/ngc$$.c << EOF
1065 #include <sys/types.h>
1066 #include <netinet/in.h>
1067 #include <arpa/nameser.h>
1075 res_query("hello", C_IN, T_A, bfr, sizeof bfr);
1079 # first see if res_init() and res_query() actually exist...
1081 if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c; then
1083 elif $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c -lresolv; then
1085 AC_LIBS="$AC_LIBS -lresolv"
1092 # if res_init() and res_query() actually exist, check to
1093 # see if the HEADER structure is defined ...
1095 cat > /tmp/ngc$$.c << EOF
1096 #include <sys/types.h>
1097 #include <netinet/in.h>
1098 #include <arpa/nameser.h>
1108 if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $__extralib; then
1110 elif $AC_CC -DBIND_8_COMPAT -o /tmp/ngc$$ /tmp/ngc$$.c $__extralib; then
1111 TLOG " (bind9 with BIND_8_COMPAT)"
1112 AC_DEFINE BIND_8_COMPAT 1
1124 # AC_PROG_INSTALL finds the install program and guesses whether it's a
1125 # Berkeley or GNU install program
1127 AC_PROG_INSTALL () {
1129 DEST=`acLookFor install`
1131 LOGN "checking for install"
1133 if [ "$DEST" ]; then
1134 # BSD install or GNU install? Let's find out...
1137 $DEST /tmp/a$$ /tmp/b$$
1139 if test -r /tmp/a$$; then
1143 LOG " ($DEST) bsd install"
1145 rm -f /tmp/a$$ /tmp/b$$
1147 DEST=`acLookFor ginstall`
1148 if [ "$DEST" ]; then
1156 if [ "$IS_BSD" ]; then
1157 PROG_INSTALL="$DEST -c"
1159 PROG_INSTALL="$DEST"
1162 AC_SUB 'INSTALL' "$PROG_INSTALL"
1163 AC_SUB 'INSTALL_PROGRAM' "$PROG_INSTALL -s -m 755"
1164 AC_SUB 'INSTALL_DATA' "$PROG_INSTALL -m 444"
1166 # finally build a little directory installer
1167 # if mkdir -p works, use that, otherwise use install -d,
1168 # otherwise build a script to do it by hand.
1169 # in every case, test to see if the directory exists before
1172 if mkdir -p $$a/b; then
1173 # I like this method best.
1177 elif $PROG_INSTALL -d $$a/b; then
1178 __mkdir="$PROG_INSTALL -d"
1183 __config_files="$__config_files config.md"
1184 AC_SUB 'INSTALL_DIR' "$__cwd/config.md"
1185 echo "#! /bin/sh" > $__cwd/config.md
1186 echo "# script generated" `date` "by configure.sh" >> $__cwd/config.md
1187 echo >> $__cwd/config.md
1188 if [ "$__mkdir" ]; then
1189 echo "test -d \"\$1\" || $__mkdir \"\$1\"" >> $__cwd/config.md
1190 echo "exit $?" >> $__cwd/config.md
1192 cat - >> $__cwd/config.md << \EOD
1193 pieces=`IFS=/; for x in $1; do echo $x; done`
1195 for x in $pieces; do
1197 mkdir $dir || exit 1
1203 chmod +x $__cwd/config.md
1207 # acCheckCPP is a local that runs a C preprocessor with a given set of
1211 cat > /tmp/ngc$$.c << EOF
1217 if $1 $2 /tmp/ngc$$.c > /tmp/ngc$$.o; then
1218 if grep -v '#define' /tmp/ngc$$.o | grep -s BAR >/dev/null; then
1219 echo "CPP=[$1], CPPFLAGS=[$2]"
1221 AC_SUB 'CPPFLAGS' "$2"
1222 rm /tmp/ngc$$.c /tmp/ngc$$.o
1226 rm /tmp/ngc$$.c /tmp/ngc$$.o
1232 # AC_PROG_CPP checks for cpp, then checks to see which CPPFLAGS are needed
1233 # to run it as a filter.
1236 if [ "$AC_CPP_PROG" ]; then
1239 __ac_path="$AC_PATH"
1240 AC_PATH="/lib:/usr/lib:${__ac_path:-$ac_default_path}"
1241 DEST=`acLookFor cpp`
1242 AC_PATH="$__ac_path"
1246 LOGN "Looking for cpp"
1247 if [ "$DEST" ]; then
1249 acCheckCPP $DEST "$CPPFLAGS" || \
1250 acCheckCPP $DEST -traditional-cpp -E || \
1251 acCheckCPP $DEST -E || \
1252 acCheckCPP $DEST -traditional-cpp -pipe || \
1253 acCheckCPP $DEST -pipe || fail=1
1255 if [ "$fail" ]; then
1256 AC_FAIL " (can't run cpp as a pipeline)"
1262 AC_FAIL " (not found)"
1266 # AC_FAIL spits out an error message, then __fail's
1273 # AC_SUB writes a substitution into config.sub
1275 ( echononl "s;@$1@;"
1276 _subst=`echo $2 | sed -e 's/;/\\;/g'`
1278 echo ';g' ) >> $__cwd/config.sub
1282 # AC_MAK writes a define into config.mak
1284 echo "HAVE_$1 = 1" >> $__cwd/config.mak
1288 # AC_DEFINE adds a #define to config.h
1290 echo "#define $1 ${2:-1}" >> $__cwd/config.h.tmp
1294 # AC_INCLUDE adds a #include to config.h
1296 echo "#include \"$1\"" >> $__cwd/config.h.tmp
1300 # AC_CONFIG adds a configuration setting to all the config files
1302 AC_DEFINE "PATH_$1" \""$2"\"
1308 # AC_QUIET does something quietly