1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
|
AC_INIT
#
# $Source: /home/wms/cvs/pente/configure.in,v $
# $Revision: 1.6 $
# $Date: 2001/08/01 00:01:45 $
#
# Remember to change these in "README", and "pente.6" too.
# DATE must be in DAY MONTH YEAR format.
date="31 7 2001"
VERSION=\"2.2.5\"
######################################################################
# My own, personal functions. #
######################################################################
AC_DEFUN(WMS_GET_SYSTEM,
[AC_MSG_CHECKING([for machine type])
if test ${target} = NONE ; then
SYSTEM_TYPE=`uname -m | sed sx/xxg`
if test $? '!=' 0 ; then SYSTEM_TYPE=unknown ; fi
os=`uname -s | sed sx/xxg`
if test $? '=' 0 ; then SYSTEM_TYPE=${SYSTEM_TYPE}-${os} ; fi
if test ${os} '=' SunOS ; then
SYSTEM_TYPE=${SYSTEM_TYPE}`uname -r | sed -e 's/\.//g' -e 's/_.*//'`
fi
AC_MSG_RESULT($SYSTEM_TYPE)
else
SYSTEM_TYPE=${target}
AC_MSG_RESULT($SYSTEM_TYPE (set by user))
fi])
AC_DEFUN(WMS_GET_CFLAGS,
[AC_MSG_CHECKING([for best CFLAGS argument])
if test $ac_cv_prog_gcc = yes ; then
CFLAGS='-O2 -fomit-frame-pointer'
else
CFLAGS='-O'
fi
AC_MSG_RESULT($CFLAGS)
AC_SUBST(CFLAGS)])
AC_DEFUN(WMS_CHECK_H_ERRNO,
[AC_MSG_CHECKING([for h_errno])
AC_TRY_LINK([#include <sys/types.h>
#include <sys/socket.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#if HAVE_SYS_IN_H
#include <sys/in.h>
#endif
#if HAVE_SYS_INET_H
#include <sys/inet.h>
#endif
#include <netdb.h>
#if HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#if HAVE_RESOLV_H
#include <resolv.h>
#endif], [h_errno = 0;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_H_ERRNO)], [AC_MSG_RESULT(no)])])
# I don't really know what will clearly tell whether you have sockets or not,
# so I just took a bunch of socket-related functions and stuck them in
# a routine. If it builds and links, I assume I can build sockets code;
# otherwise I assume I can't.
AC_DEFUN(WMS_CHECK_SOCKETS,
[AC_MSG_CHECKING([for sockets])
AC_TRY_LINK([#include <sys/types.h>
#include <sys/socket.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#if HAVE_SYS_IN_H
#include <sys/in.h>
#endif
#if HAVE_SYS_INET_H
#include <sys/inet.h>
#endif
#include <netdb.h>
#if HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#if HAVE_RESOLV_H
#include <resolv.h>
#endif
#include <sys/utsname.h>
#include <pwd.h>
#include <fcntl.h>], [
struct sockaddr_in sa;
bind(0,(struct sockaddr *)&sa, sizeof(sa));
listen(0,2);
socket(AF_INET,SOCK_STREAM,0);
gethostbyname("foo");],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOCKETS)], [AC_MSG_RESULT(no)])])
######################################################################
# Done with my own functions. On to the real configure file. #
######################################################################
export VERSION
AC_DEFINE_UNQUOTED(VERSION,$VERSION)
dayNum=`echo $date | awk '{ print $1 }'`
monthNum=`echo $date | awk '{ print $2 }'`
yearNum=`echo $date | awk '{ print $3 }'`
monthEnglish=`echo January February March April May June July August September October November December | awk '{ print $'$monthNum' }'`
monthFrench=`echo Janvier Fevrier Mars Avril Mai Juin Juillet Aot Septembre Octobre Novembre Dcembre | awk '{ print $'$monthNum' }'`
monthItalian=`echo Gennaio Febbraio Marzo Aprile Maggie Guigno Luglio Agosto Settembre Ottobre Novembre Dicembre | awk '{ print $'$monthNum' }'`
DATE="\"$dayNum $monthEnglish $yearNum\""
DATE_FRENCH="\"$dayNum $monthFrench $yearNum\""
DATE_ITALIAN="\"$dayNum $monthItalian $yearNum\""
export DATE
export DATE_FRENCH
export DATE_ITALIAN
AC_DEFINE_UNQUOTED(DATE,$DATE)
AC_DEFINE_UNQUOTED(DATE_FRENCH,$DATE_FRENCH)
AC_DEFINE_UNQUOTED(DATE_ITALIAN,$DATE_ITALIAN)
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_CPP
WMS_GET_CFLAGS
PROGS="pente"
AC_SUBST(PROGS)dnl
BUILD_DIR=`pwd`
AC_SUBST(BUILD_DIR)dnl
LIBDIR="-L\$(BUILD_DIR)/wmslib"
INCDIR="-I\$(BUILD_DIR)/wmslib/src -I\$(BUILD_DIR)/obj-\$(SYSTEM_TYPE)"
WMS_GET_SYSTEM
export SYSTEM_TYPE
AC_SUBST(SYSTEM_TYPE)dnl
rm -rf obj-${SYSTEM_TYPE} obj-d${SYSTEM_TYPE} pente-${SYSTEM_TYPE}
mkdir obj-${SYSTEM_TYPE}
if test x"$HOME" = x/home/wms ; then
mkdir obj-d${SYSTEM_TYPE}
fi
cp configure.h.in obj-${SYSTEM_TYPE}/configure.h.in
AC_CONFIG_HEADER(obj-${SYSTEM_TYPE}/configure.h)
AC_SUBST(LIBS)dnl
AC_SUBST(LIBDIR)dnl
AC_SUBST(INCDIR)dnl
AC_SUBST(VERSION)dnl
AC_SUBST(DATE)dnl
AC_PROG_RANLIB
AC_ISC_POSIX
AC_MINIX
AC_AIX
AC_CHECK_LIB(m,main)
AC_CHECK_LIB(seq,main)
AC_CHECK_LIB(nsl,main)
AC_CHECK_LIB(socket,main)
AC_CHECK_HEADER(curses.h,
AC_CHECK_LIB(curses, main,
AC_DEFINE(CURSES_DISP)
AC_CHECK_LIB(termcap, main)
LIBS="-lcurses $LIBS"))
AC_STDC_HEADERS
AC_CHECK_HEADERS(memory.h sys/select.h unistd.h assert.h stdlib.h string.h netinet/in.h sys/in.h sys/inet.h arpa/nameser.h resolv.h sys/time.h)
AC_TIME_WITH_SYS_TIME
AC_CHECK_HEADER(
sun/audioio.h,
AC_DEFINE(SUN_SOUND))
AC_CHECK_HEADER(linux/soundcard.h, AC_DEFINE(LINUX_SOUND))
WMS_CHECK_H_ERRNO
WMS_CHECK_SOCKETS
AC_CHECK_SIZEOF(short)
if test "x$ac_cv_sizeof_short" '=' x0 ; then
echo "********* IMPORTANT *************************************************"
echo "*** configure cannot figure out how to run your C compiler."
echo "*** figure out how to run your C compiler."
echo "*** If you are cross compiling, then configure cannot detect the "
echo "*** size of various types and the endian style of your machine. "
echo "*** You will have to edit the file obj-${SYSTEM_TYPE}/configure.h "
echo "*** by hand."
echo "*** If you are NOT cross compiling, then please see the README file"
echo "*** for instructions on how to tell ./configure how to run your"
echo "*** C compiler."
echo "*********************************************************************"
exit 1
fi
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_C_BIGENDIAN
AC_CHECK_FUNCS(strerror getdtablesize memmove strcasecmp)
AC_RETSIGTYPE
AC_FIND_X
if test '!' "$no_x" ; then
AC_DEFINE(X11_DISP)
if test "$x_includes" ; then
INCDIR="$INCDIR -I$x_includes"
fi
LIBS="-lX11 $LIBS"
if test "$x_libraries" ; then
LIBDIR="$LIBDIR -L$x_libraries"
fi
fi
subdirs='comp xio'
for dname in ${subdirs}; do
mkdir obj-${SYSTEM_TYPE}/$dname
if test x"$HOME" = x/home/wms ; then
mkdir obj-d${SYSTEM_TYPE}/$dname
fi
done
TOP_FILES='pente pe_snd play board cio textio'
PENTE_INCS='src/pente.h src/play.h src/board.h src/comp/comp.h src/comp/eval.h src/xio/xio.h src/xio/setup.h src/xio/helpwin.h src/xio/sound.h src/xio/remAcc.h'
COMP_FILES='comp spawn eval move lmove deeptree'
XIO_FILES='plasma xio mainwin helpwin strings pentebuts cm2pm setup remote sound remAcc'
ofiles=' '
sfiles="README COPYING man6/pente.6 configure Makefile.in configure.h.in install-sh $PENTE_INCS"
for ofile in ${TOP_FILES}; do
ofiles="${ofiles} obj-\$(SYSTEM_TYPE)/${ofile}.o"
sfiles="${sfiles} src/${ofile}.c"
done
for ofile in ${COMP_FILES}; do
ofiles="${ofiles} obj-\$(SYSTEM_TYPE)/comp/${ofile}.o"
sfiles="${sfiles} src/comp/${ofile}.c"
done
for ofile in ${XIO_FILES}; do
ofiles="${ofiles} obj-\$(SYSTEM_TYPE)/xio/${ofile}.o"
sfiles="${sfiles} src/xio/${ofile}.c"
done
OBJS=${ofiles}
AC_SUBST(OBJS)dnl
AC_OUTPUT(Makefile)
for ofile in ${TOP_FILES}; do
cat <<EOF >>Makefile
obj-\$(SYSTEM_TYPE)/${ofile}.o: src/${ofile}.c
cd src; \$(CC) \$(CFLAGS) -c ${ofile}.c
mv src/${ofile}.o obj-\$(SYSTEM_TYPE)/${ofile}.o
EOF
done
for ofile in ${COMP_FILES}; do
cat <<EOF >>Makefile
obj-\$(SYSTEM_TYPE)/comp/${ofile}.o: src/comp/${ofile}.c
cd src/comp; \$(CC) \$(CFLAGS) -c ${ofile}.c
mv src/comp/${ofile}.o obj-\$(SYSTEM_TYPE)/comp/${ofile}.o
EOF
done
for ofile in ${XIO_FILES}; do
cat <<EOF >>Makefile
obj-\$(SYSTEM_TYPE)/xio/${ofile}.o: src/xio/${ofile}.c
cd src/xio; \$(CC) \$(CFLAGS) -c ${ofile}.c
mv src/xio/${ofile}.o obj-\$(SYSTEM_TYPE)/xio/${ofile}.o
EOF
done
# I blow away the cache every time. Why? Here's why:
# A) You hopefully only ever run configure once per machine type, so
# it won't buy most users any time.
# B) If you have several machine types sharing a file system, the cache will
# make configure break! There's NO CHECK to make sure that the cache is
# for the appropriate machine!
# These two reasons - especially B - lead me to conclude that autoconf's
# caching is not useful in it's current implementation. If code is added
# to make it check to ensure that it's on the right machine, great, otherwise
# forget it.
echo Destroying config.cache
rm -f config.cache
# Add in wmslib's Makefile
TOP_FILES='wms'
WMS_FILES='clp clp-x rnd snd str'
BUT_FILES='net box but canvas checkbox ctext i_finder i_general i_snd i_win menu menu_snd plain rcur slide tblock text textin timer write'
ABUT_FILES='abut swin msg'
cfiles=' '
hfiles=' '
ofiles=' '
for tfile in ${TOP_FILES}; do
cfiles="${cfiles} wmslib/src/${tfile}.c"
hfiles="${hfiles} wmslib/src/${tfile}.h"
ofiles="${ofiles} wmslib/obj-\$(SYSTEM_TYPE)/${tfile}.o"
done
for tfile in ${WMS_FILES}; do
cfiles="${cfiles} wmslib/src/wms/${tfile}.c"
hfiles="${hfiles} wmslib/src/wms/${tfile}.h"
ofiles="${ofiles} wmslib/obj-\$(SYSTEM_TYPE)/wms_${tfile}.o"
done
for tfile in ${BUT_FILES}; do
cfiles="${cfiles} wmslib/src/but/${tfile}.c"
hfiles="${hfiles} wmslib/src/but/${tfile}.h"
ofiles="${ofiles} wmslib/obj-\$(SYSTEM_TYPE)/but_${tfile}.o"
done
for tfile in ${ABUT_FILES}; do
cfiles="${cfiles} wmslib/src/abut/${tfile}.c"
hfiles="${hfiles} wmslib/src/abut/${tfile}.h"
ofiles="${ofiles} wmslib/obj-\$(SYSTEM_TYPE)/abut_${tfile}.o"
done
sfiles="${sfiles} ${cfiles} ${hfiles}"
rm -rf wmslib/obj-${SYSTEM_TYPE} wmslib/obj-d${SYSTEM_TYPE}
mkdir wmslib/obj-${SYSTEM_TYPE}
if test x"$HOME" = x/home/wms ; then
mkdir wmslib/obj-d${SYSTEM_TYPE}
fi
arofiles=`echo ${ofiles} | sed 's&wmslib/obj-$(SYSTEM_TYPE)/&&g'`
cat <<EOF >>Makefile
wmslib/libwms-\$(SYSTEM_TYPE).a: ${ofiles}
cd wmslib/obj-\$(SYSTEM_TYPE); ar -r libwms-\$(SYSTEM_TYPE).a ${arofiles}
mv wmslib/obj-\$(SYSTEM_TYPE)/libwms-\$(SYSTEM_TYPE).a wmslib/libwms-\$(SYSTEM_TYPE).a
EOF
if test "$RANLIB" '!=' : ; then
echo " cd wmslib; ${RANLIB} libwms-\$(SYSTEM_TYPE).a" >>Makefile
fi
cat <<EOF >>Makefile
EOF
for cfile in ${cfiles}; do
scfile=`echo $cfile | sed 'sx.*/xx'`
sofile=`echo $scfile | sed 's/c$/o/'`
dname=`echo $cfile | sed 's&/'${scfile}'$&&'`
ofile=`echo $cfile | sed -e 's/src/obj-$(SYSTEM_TYPE)/' -e 'sxbut/xbut_x' -e 'sxabut/xabut_x' -e 'sxwms/xwms_x' -e 's/c$/o/'`
cat <<EOF >>Makefile
${ofile}: ${cfile}
cd ${dname}; \$(CC) \$(CFLAGS) -c ${scfile}
mv ${dname}/${sofile} ${ofile}
EOF
done
# I only make tar for myself. Why? Because nobody else really needs it
# and the line ends up so long it breaks some editors.
if test x"$HOME" = x/home/wms ; then
tsfiles=' '
for sfile in ${sfiles}; do
tsfiles="${tsfiles} pente-\$(VERSION)/${sfile}"
done
cat <<EOF >>Makefile
tar:
cd ..; tar cvf pente-\$(VERSION).tar ${tsfiles} pente-\$(VERSION)/configure.in; gzip -f -9v pente-\$(VERSION).tar
EOF
fi
echo '# DO NOT DELETE' >>Makefile
mv Makefile Makefile-${SYSTEM_TYPE}
ln -s Makefile-${SYSTEM_TYPE} Makefile
if test x"$HOME" = x/home/wms ; then
sed <Makefile-${SYSTEM_TYPE} >Makefile-d${SYSTEM_TYPE} -e 's/SYSTEM_TYPE = /SYSTEM_TYPE = d/' -e 's/^CFLAGS/# Old CFLAGS/' -e 's/# CFLAGS/CFLAGS/' -e 's/^LFLAGS/# Old LFLAGS/' -e 's/# LFLAGS/LFLAGS/'
rm -f Makefile-d
ln -s Makefile-d${SYSTEM_TYPE} Makefile-d
cd obj-d${SYSTEM_TYPE}
ln -s ../obj-${SYSTEM_TYPE}/configure.h .
fi
|