1 dnl Process this file with autoconf to produce a configure script.
4 dnl Specify the autoconf file.
5 AC_CONFIG_HEADER(autoconfig.h)
7 dnl Check if we are forced to use the cxref-cpp
10 [ --with-cxref-cpp use the supplied cpp instead of trying to use gcc],
11 [if test "$withval" = "yes"; then WITH_CXREF_CPP=yes; fi
12 if test "$withval" = "no"; then WITH_CXREF_CPP=no; fi])
14 dnl Checks for programs.
23 dnl Checks for libraries.
25 dnl Checks for header files.
28 AC_CHECK_HEADERS(fcntl.h malloc.h sys/time.h unistd.h stdlib.h)
30 dnl Checks for typedefs, structures, and compiler characteristics.
37 dnl Checks for library functions.
41 AC_CHECK_FUNCS(strerror strstr bcmp)
43 dnl Check the gcc version
45 if test ! "x$GCC" = "x" ; then
47 AC_MSG_CHECKING([if installed gcc is new enough to use instead of cxref-cpp])
52 #if defined(__GNUC__) && ( ( __GNUC__==2 && __GNUC_MINOR__>=8 ) || __GNUC__>=3 )
61 if test "$WITH_CXREF_CPP" = "no" ; then
63 if test "x$newGCC" = "x" ; then
65 AC_MSG_ERROR([the '--without-cxref-cpp' option was used but gcc is not suitable])
67 AC_MSG_RESULT([yes, ignoring further checks due to '--without-cxref-cpp' option])
70 elif test "x$newGCC" = "x" || test "$WITH_CXREF_CPP" = "yes" ; then
72 if test "x$newGCC" = "x" ; then
73 AC_MSG_RESULT([no, using cxref-cpp])
75 AC_MSG_RESULT([yes, but '--with-cxref-cpp' option overrides this])
80 AC_MSG_CHECKING([if installed gcc preserves comments after define statements])
82 echo "#define foo bar /* FIND-ME */" | $CC -E -C - > ./conftest.gcc
84 if $EGREP -e FIND-ME ./conftest.gcc > /dev/null 2>&1 ; then
87 AC_MSG_RESULT([no, using cxref-cpp])
94 AC_MSG_CHECKING([if installed gcc preserves comments after include statements])
98 echo "#include \"conftest.h\" /* FIND-ME */" | $CC -E -C - > ./conftest.gcc
100 if $EGREP -e FIND-ME ./conftest.gcc > /dev/null 2>&1 ; then
103 AC_MSG_RESULT([no, using cxref-cpp])
108 rm ./conftest.h ./conftest.gcc
114 AC_MSG_WARN(-----------------------------------------------------)
115 AC_MSG_WARN(The C compiler is not gcc, you may have problems! )
116 AC_MSG_WARN(read the file cpp/README and cpp/cxref-cpp-configure.)
117 AC_MSG_WARN(-----------------------------------------------------)
126 dnl Create the output files.
128 AC_OUTPUT(cxref-cpp-configure)
130 chmod 755 cxref-cpp-configure