aboutsummaryrefslogtreecommitdiffstats
path: root/conf/m4/plptools
diff options
context:
space:
mode:
Diffstat (limited to 'conf/m4/plptools')
-rw-r--r--conf/m4/plptools/PLP_CHECK_COMPILERS.m4190
-rw-r--r--conf/m4/plptools/PLP_CHECK_READLINE.m441
-rw-r--r--conf/m4/plptools/PLP_FIND_CDEV.m417
-rw-r--r--conf/m4/plptools/PLP_FIND_FILE.m417
-rw-r--r--conf/m4/plptools/PLP_HELP_MESSAGE.m49
5 files changed, 274 insertions, 0 deletions
diff --git a/conf/m4/plptools/PLP_CHECK_COMPILERS.m4 b/conf/m4/plptools/PLP_CHECK_COMPILERS.m4
new file mode 100644
index 0000000..bd61ed2
--- /dev/null
+++ b/conf/m4/plptools/PLP_CHECK_COMPILERS.m4
@@ -0,0 +1,190 @@
+dnl
+dnl Check for various compiler options
+dnl
+AC_DEFUN(PLP_CHECK_COMPILERS,
+[
+ dnl this is somehow a fat lie, but prevents other macros from double checking
+ AC_PROVIDE([AC_PROG_CC])
+ AC_PROVIDE([AC_PROG_CPP])
+ AC_REQUIRE([PLP_HELP_MSG])
+ PLP_HELP_MSG([Generic build options:])
+ AC_ARG_ENABLE(debug,[ --enable-debug creates debugging code [default=no]],
+ [
+ if test $enableval = "no"; dnl
+ then ac_use_debug_code="no"
+ else ac_use_debug_code="yes"
+ fi
+ ], [ac_use_debug_code="no"])
+
+ AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)],
+ [
+ if test $enableval = "no"; then
+ ac_use_strict_options="no"
+ else
+ ac_use_strict_options="yes"
+ fi
+ ], [ac_use_strict_options="no"])
+
+dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
+ AC_MSG_CHECKING(for a C-Compiler)
+ dnl if there is one, print out. if not, don't matter
+ AC_MSG_RESULT($CC)
+
+ if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
+ if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
+ if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
+ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+
+ AC_PROG_CC_WORKS
+ AC_PROG_CC_GNU
+
+ if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+ else
+ GCC=
+ fi
+
+ if test -z "$CFLAGS"; then
+ if test "$ac_use_debug_code" = "yes"; then
+ AC_PROG_CC_G
+ if test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g"
+ fi
+ else
+ if test "$GCC" = "yes"; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=""
+ fi
+ fi
+
+ if test "$GCC" = "yes"; then
+ CFLAGS="$CFLAGS -Wall"
+
+ if test "$ac_use_strict_options" = "yes"; then
+ CFLAGS="$CFLAGS -W -ansi -pedantic"
+ fi
+ fi
+ else
+ AC_MSG_RESULT(Using predefined CFLAGS $CFLAGS)
+ fi
+
+ case "$host" in
+ *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
+ esac
+
+ #
+ # If debugging is off, strip all programs
+ #
+ if test "$ac_use_debug_code" = "no"; then
+ if test -z "$LDFLAGS" && test "$GCC" = "yes"; then
+ LDFLAGS="-s"
+ fi
+ else
+ AC_DEFINE_UNQUOTED(DEBUG)
+ fi
+
+
+dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
+dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
+
+ AC_MSG_CHECKING(how to run the C preprocessor)
+ # On Suns, sometimes $CPP names a directory.
+ if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+ fi
+ if test -z "$CPP"; then
+ AC_CACHE_VAL(ac_cv_prog_CPP,
+ [ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ dnl Use a header file that comes with gcc, so configuring glibc
+ dnl with a fresh cross-compiler works.
+ AC_TRY_CPP([#include <assert.h>
+ Syntax Error], ,
+ CPP="${CC-cc} -E -traditional-cpp"
+ AC_TRY_CPP([#include <assert.h>
+ Syntax Error], , CPP=/lib/cpp))
+ ac_cv_prog_CPP="$CPP"])dnl
+ CPP="$ac_cv_prog_CPP"
+ else
+ ac_cv_prog_CPP="$CPP"
+ fi
+ AC_MSG_RESULT($CPP)
+ AC_SUBST(CPP)dnl
+
+
+ AC_MSG_CHECKING(for a C++-Compiler)
+ dnl if there is one, print out. if not, don't matter
+ AC_MSG_RESULT($CXX)
+
+ if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
+ if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
+ if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
+ if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
+ test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
+
+ AC_PROG_CXX_WORKS
+ AC_PROG_CXX_GNU
+
+ if test $ac_cv_prog_gxx = yes; then
+ GXX=yes
+ else
+ AC_MSG_CHECKING(whether we are using SPARC CC)
+ GXX=
+ cat > conftest.C << EOF
+#ifdef __SUNPRO_CC
+ yes;
+#endif
+EOF
+
+ ac_try="$CXX -E conftest.C"
+ if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_CC=yes
+ else
+ ac_cv_prog_CC=no
+ fi
+ AC_MSG_RESULT($ac_cv_prog_CC)
+ fi
+
+ if test -z "$CXXFLAGS"; then
+ if test "$ac_use_debug_code" = "yes"; then
+ AC_PROG_CXX_G
+ if test $ac_cv_prog_cxx_g = yes; then
+ CXXFLAGS="-g"
+ fi
+ if test "$ac_cv_prog_CC" = "yes"; then
+ CXXFLAGS="$CXXFLAGS -pto"
+ fi
+ else
+ if test "$GXX" = "yes"; then
+ CXXFLAGS="-O2"
+ else
+ if test "$ac_cv_prog_CC" = "yes"; then
+ CXXFLAGS="-pto -O2"
+ else
+ CXXFLAGS=""
+ fi
+ fi
+ fi
+
+ if test "$GXX" = "yes"; then
+ CXXFLAGS="$CXXFLAGS -Wall"
+
+ if test "$ac_use_strict_options" = "yes"; then
+ CXXFLAGS="$CXXFLAGS -W -ansi -Wtraditional -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wbad-function-cast -Wsynth"
+ fi
+
+ if test "$ac_very_strict" = "yes"; then
+ CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wshadow -Wredundant-decls -Wconversion"
+ fi
+ fi
+ fi
+
+ case "$host" in
+ *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
+ esac
+
+])
diff --git a/conf/m4/plptools/PLP_CHECK_READLINE.m4 b/conf/m4/plptools/PLP_CHECK_READLINE.m4
new file mode 100644
index 0000000..1b99a19
--- /dev/null
+++ b/conf/m4/plptools/PLP_CHECK_READLINE.m4
@@ -0,0 +1,41 @@
+dnl
+dnl Check for libreadline and if it is available, check if it
+dnl depends on libcurses. (Normally, it silently resolves the
+dnl following symbols from libtermcap:
+dnl tgetnum, tgoto, tgetflag, tputs, tgetent, BC, PC, UP
+dnl On RedHat 7.0 however, libtermcap is broken: It contains no
+dnl symbols at all. Fortunately, libcurses provides the same
+dnl and therefore we have to check for that special case.)
+dnl
+AC_DEFUN(PLP_CHECK_READLINE,
+[
+ AC_MSG_CHECKING(for readline in -lreadline)
+ ac_cv_addcurses=false
+ ac_cv_have_libreadline=false
+ saved_libs=$LIBS
+ LIBS="$LIBS -lreadline"
+ link1ok=0
+ link2ok=0
+ AC_TRY_LINK(,[extern char *readline(void); readline();],link1ok=1)
+ LIBS="$LIBS -lreadline -lcurses"
+ AC_TRY_LINK(,[extern char *readline(void); readline();],link2ok=1)
+ LIBS="$saved_LIBS"
+ case "$link1ok$link2ok" in
+ 00)
+ AC_MSG_RESULT(no)
+ ;;
+ 01)
+ ac_cv_have_libreadline=true;
+ ac_cv_addcurses=true
+ AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE)
+ AC_MSG_RESULT([yes, and needs libcurses])
+ ;;
+ 1*)
+ ac_cv_have_libreadline=true;
+ AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE)
+ AC_MSG_RESULT(yes)
+ ;;
+ esac
+ AM_CONDITIONAL(HAVE_LIBREADLINE, test x$ac_cv_have_libreadline = xtrue)
+ AM_CONDITIONAL(ADD_LIBCURSES, test x$ac_cv_addcurses = xtrue)
+])
diff --git a/conf/m4/plptools/PLP_FIND_CDEV.m4 b/conf/m4/plptools/PLP_FIND_CDEV.m4
new file mode 100644
index 0000000..557d7e9
--- /dev/null
+++ b/conf/m4/plptools/PLP_FIND_CDEV.m4
@@ -0,0 +1,17 @@
+dnl
+dnl Select first existing char device from a list of given devices
+dnl Usage:
+dnl PLP_FIND_CDEV(/dev/tty1 /dev/tty2 /dev/console, FOUND)
+dnl
+dnl On return, variable FOUND is set to one of the devices or to NO, if none
+dnl was found.
+dnl
+AC_DEFUN(PLP_FIND_CDEV,[
+ $2=NO
+ for i in $1; do
+ if test -c "$i" ; then
+ $2=$i
+ break 2
+ fi
+ done
+])
diff --git a/conf/m4/plptools/PLP_FIND_FILE.m4 b/conf/m4/plptools/PLP_FIND_FILE.m4
new file mode 100644
index 0000000..868b2d5
--- /dev/null
+++ b/conf/m4/plptools/PLP_FIND_FILE.m4
@@ -0,0 +1,17 @@
+dnl
+dnl Select first existing file from a list of given files
+dnl Usage:
+dnl PLP_FIND_FILE(filea fileb filec, FOUND)
+dnl
+dnl On return, variable FOUND is set to one of fileX or to NO, if none
+dnl was found.
+dnl
+AC_DEFUN(PLP_FIND_FILE,[
+ $2=NO
+ for i in $1; do
+ if test -r "$i" ; then
+ $2=$i
+ break 2
+ fi
+ done
+])
diff --git a/conf/m4/plptools/PLP_HELP_MESSAGE.m4 b/conf/m4/plptools/PLP_HELP_MESSAGE.m4
new file mode 100644
index 0000000..dea8d50
--- /dev/null
+++ b/conf/m4/plptools/PLP_HELP_MESSAGE.m4
@@ -0,0 +1,9 @@
+dnl
+dnl Insert a custom line into the output of configure --help
+dnl
+AC_DEFUN(PLP_HELP_MSG,[
+ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+ ac_help="$ac_help
+[$1]"
+ AC_DIVERT_POP()dnl
+])