# This is free software, licensed under the GNU Public License V2. # See the file COPYING for details. dnl Process this file with autoconf to produce a configure script. AC_INIT(include/pi-cmp.h) AC_CONFIG_AUX_DIR(scripts) dnl Check host type AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AM_PROG_LIBTOOL AC_PROG_RANLIB AC_PROG_YACC WITHTCL="WITHOUTTCL" WITHCXX="WITHOUTCXX" WITHTK="WITHOUTTK" WITHPERL5="WITHOUTPERL5" WITHPYTHON="WITHOUTPYTHON" WITHJAVA="WITHOUTJAVA" AC_ARG_WITH(cpp, [ --with-cpp[=c++ compiler] use C++ [default=yes]]) if test "x$with_cpp" = "xno"; then CXX= ac_cv_prog_cxx_works=no else if test "x$with_cpp" = "xyes"; then with_cpp="" fi if test "x$with_cpp" = "x"; then AC_CHECK_PROGS(CXX,$CCC c++ g++ gcc CC cxx cc++, gcc) else CXX=$with_cpp fi AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_CACHE_CHECK([whether C++ compiler ($CXX $CXFLAGS $LDFLAGS) works], ac_cv_prog_cxx_works, [AC_TRY_COMPILE([#include ], [class a { public: int b; a(void); }; a b; ], ac_cv_prog_cxx_works=yes,ac_cv_prog_cxx_works=no)]) AC_LANG_RESTORE AC_PROG_CXX_GNU if test $ac_cv_prog_gxx = yes; then GXX=yes dnl Check whether -g works, even if CXXFLAGS is set, in case the package dnl plays around with CXXFLAGS (such as to build both debugging and dnl normal versions of a library), tasteless as that idea is. ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= AC_PROG_CXX_G if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS="$ac_save_CXXFLAGS" elif test $ac_cv_prog_cxx_g = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-O2" fi else GXX= test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" fi fi ccexecs='' cclib='' libcclib='' SUBMAKE_COMM='cd $(top_builddir)/libsock ; $(MAKE) ' SUBMAKE_COMM_DUBIOUS='cd $(top_builddir)/dubious ; $(MAKE) ' SUBMAKE_COMM_CC='-true' EXT='' CXXLIBS='' if test $ac_cv_prog_cxx_works = yes; then ccexecs='$(CCEXECS)' cclib='libpicc.a' libcclib='libcc/libpicc.a' SUBMAKE_COMM_CC='cd $(top_builddir)/libcc ; $(MAKE) ' WITHCXX='WITHCXX' else CXX='' CXXFLAGS='' fi AC_SUBST(ccexecs) AC_SUBST(cclib) AC_SUBST(libcclib) AC_SUBST(SUBMAKE_COMM) AC_SUBST(SUBMAKE_COMM_DUBIOUS) AC_SUBST(SUBMAKE_COMM_CC) AC_SUBST(EXT) AC_SUBST(CXXLIBS) dnl Adjust linker case "$host" in *sunos*) case "$LD" in */ucb/*) LIBS="-L/usr/ucblib -R/usr/ucblib $LIBS" ;; esac ;; esac dnl Checks for libraries. if test $ac_cv_prog_cxx_works = yes; then AC_LANG_SAVE AC_LANG_CPLUSPLUS if test $ac_cv_prog_gxx = yes; then AC_CHECK_LIB(g++, main, CXXLIBS="$CXXLIBS -lg++") fi AC_LANG_RESTORE fi AC_CHECK_LIB(m, ldexp, LIBS="$LIBS -lm") AC_CHECK_LIB(PW, alloca, LIBS="$LIBS -lPW") AC_ARG_WITH(readline21, [ --with-readline21 use readline 2.1 [default=yes]]) AC_ARG_WITH(readline20, [ --with-readline20 use readline 2.0 [default=yes]]) ac_save_LIBS="$LIBS" LIBS="$LIBS -lreadline" AC_TRY_LINK(,[(void)readline(0);], RLLIBS="-lreadline", LIBS="$LIBS -ltermcap" AC_TRY_LINK(,[(void)readline(0);], RLLIBS="-lreadline -ltermcap")) LIBS="$ac_save_LIBS" AC_MSG_CHECKING(for readline) if test "x$with_readline21" = "x" || test "x$with_readline21" = "xyes"; then ac_save_LIBS="$LIBS" LIBS="$LIBS $RLLIBS" AC_TRY_LINK([#include #include ], [rl_callback_read_char();], [RLDEFS="-DREADLINE_2_1" with_readline20='no' AC_MSG_RESULT(2.1)]) LIBS="$ac_save_LIBS" fi if test "x$with_readline20" = "x" || test "x$with_readline20" = "xyes"; then ac_save_LIBS="$LIBS" LIBS="$LIBS $RLLIBS" AC_TRY_LINK([#include #include ], [ extern void rl_deprep_terminal(void); extern int rl_getc(FILE * stream); extern void rl_gather_tyi(void); rl_deprep_terminal(); (void)rl_getc(stdin); rl_gather_tyi();], RLDEFS="-DREADLINE_2_0"; AC_MSG_RESULT(2.0)) LIBS="$ac_save_LIBS" fi if test "x$RLDEFS" = "x"; then AC_MSG_RESULT(none) fi AC_SUBST(RLLIBS) AC_SUBST(RLDEFS) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h malloc.h sys/ioctl.h sys/time.h sys/ioctl_compat.h memory.h string.h strings.h unistd.h stdlib.h netinet/in.h dirent.h sys/ndir.h sys/dir.h ndir.h sys/select.h sockio.h netdb.h sys/utsname.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_HEADER_TIME AC_STRUCT_TM dnl Find optional libraries (borrowed from Tcl) tcl_checkBoth=0 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) if test "$tcl_checkSocket" = 1; then AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tcl_checkBoth=1) fi if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) fi AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])) AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL AC_CHECK_FUNCS(atexit strchr strdup memcpy memmove strtoul cfmakeraw cfsetspeed cfsetispeed cfsetospeed sigaction dup2 inet_aton gethostname uname putenv) AC_CACHE_CHECK([for cispeed and cospeed members of struct termios], ac_cv_termios_cspeed, [AC_TRY_COMPILE([#include ], [int main(void) { struct termios t;t.c_ispeed=t.c_ospeed=0;}], ac_cv_termios_cspeed=yes,ac_cv_termios_cspeed=no)]) if test $ac_cv_termios_cspeed = yes; then AC_DEFINE(TERMIOS_CSPEED) fi AC_CACHE_CHECK([for sa_len], ac_cv_sa_len, [AC_TRY_COMPILE([#include #include ], [int main(void) { struct sockaddr t;t.sa_len = 0;}], ac_cv_sa_len=yes,ac_cv_sa_len=no)]) if test $ac_cv_sa_len = yes; then AC_DEFINE(HAVE_SA_LEN) fi dnl Check packages AC_ARG_WITH(tcl, [ --with-tcl=tclbasedir use Tcl [default=yes]]) AC_ARG_WITH(itcl, [ --with-itcl=iclbasedir use Itcl [default=yes]]) AC_ARG_WITH(tk, [ --with-tk=tkbasedir use Tk [default=yes]]) AC_ARG_WITH(python, [ --with-python=pylibbase use Python [default=yes]]) AC_ARG_WITH(java, [ --with-java=jdkbase use Java [default=yes]]) AC_ARG_WITH(perl5, [ --with-perl5=perl5exec use Perl5 [default=yes]]) if test "x$with_perl5" = "xno"; then PERL5='' else if test "x$with_perl5" != "xyes" && test "x$with_perl5" != "x"; then PERL5="$with_perl5" else AC_PATH_PROG(PERL5, perl) fi fi changequote(, )dnl if test "x$PERL5" != "x"; then case `$PERL5 -e 'print $]'` in *5.*) WITHPERL5='WITHPERL5' ;; *) PERL5='' ;; esac fi changequote([, ])dnl AC_MSG_CHECKING(for Java Development Kit) if test "x$with_java" = "xyes" || test "x$with_java" = "x" ; then for java_path in /usr/local/java /usr/local /usr/java /usr; do if test -f $java_path/bin/javac; then with_java=$java_path; break fi done if test "x$with_java" = "xyes"; then echo "Unable to find Java base installation directory." echo "Please give directory (such as /usr/local) as argument to --with-java=dir." with_java=no fi fi if test "x$with_java" = "x"; then with_java=no fi JAVABASE='' if test "x$with_java" != "xno"; then # I'd like to check Java for version, but it doesn't seem to know how to do that. Odd. changequote(, )dnl cat >test.java <