[1a80b4] | 1 | dnl |
---|
| 2 | dnl Process this file with autoconf to produce a configure script. |
---|
| 3 | dnl |
---|
| 4 | |
---|
[3e55bc] | 5 | dnl |
---|
| 6 | dnl Initialisation |
---|
| 7 | dnl |
---|
[1a80b4] | 8 | AC_INIT(factor.h) |
---|
| 9 | |
---|
| 10 | dnl |
---|
| 11 | dnl Set up variables for Makefile.in |
---|
| 12 | dnl |
---|
[3e55bc] | 13 | dnl Change libfac variables here: |
---|
| 14 | AC_SUBST(libfac_name) |
---|
| 15 | libfac_name="\"Factorization and characteristic sets library\"" |
---|
| 16 | AC_SUBST(libfac_version) |
---|
[4a81ec] | 17 | libfac_version="0.3.0" |
---|
[3e55bc] | 18 | AC_SUBST(libfac_date) |
---|
[4a81ec] | 19 | libfac_date="\"Sep 11 1997\"" |
---|
[3e55bc] | 20 | AC_SUBST(libfac_author) |
---|
| 21 | libfac_author="\"M. Messollen\"" |
---|
| 22 | |
---|
[1a80b4] | 23 | AC_SUBST(libfac) |
---|
| 24 | libfac="libfac" |
---|
| 25 | AC_SUBST(libfac_g) |
---|
| 26 | libfac_g="libfac-g" |
---|
| 27 | AC_SUBST(libsingfac) |
---|
| 28 | libsingfac="libsingfac" |
---|
| 29 | AC_SUBST(libsingfac_g) |
---|
| 30 | libsingfac_g="libsingfac-g" |
---|
| 31 | AC_SUBST(factorH) |
---|
| 32 | factorH="factor.h" |
---|
| 33 | AC_SUBST(targetname) |
---|
| 34 | |
---|
| 35 | dnl |
---|
| 36 | dnl Parse options |
---|
| 37 | dnl |
---|
| 38 | |
---|
| 39 | AC_ARG_WITH( |
---|
| 40 | debug, |
---|
| 41 | [ --with-debug build with debugging options turned on]) |
---|
| 42 | |
---|
| 43 | AC_ARG_WITH( |
---|
| 44 | Singular, |
---|
| 45 | [ --with-Singular build for use with Singular]) |
---|
| 46 | |
---|
| 47 | if test "$with_Singular" = yes; then |
---|
[4a81ec] | 48 | AC_DEFINE(SINGULAR) |
---|
| 49 | AC_DEFINE(NOSTREAMIO) |
---|
[1a80b4] | 50 | if test "$with_debug" = yes; then |
---|
| 51 | targetname="libsingfac-g" |
---|
| 52 | else |
---|
| 53 | targetname="libsingfac" |
---|
| 54 | fi |
---|
| 55 | else |
---|
| 56 | if test "$with_debug" = yes; then |
---|
| 57 | targetname="libfac-g" |
---|
| 58 | else |
---|
| 59 | targetname="libfac" |
---|
| 60 | fi |
---|
| 61 | fi |
---|
| 62 | |
---|
| 63 | dnl |
---|
| 64 | dnl add to -I and -L, if necessary |
---|
| 65 | dnl |
---|
| 66 | if (test "x${prefix} != xNONE && test "${prefix} != "/usr/local") || \ |
---|
| 67 | test "${ac_default_prefix}" != "/usr/local" || \ |
---|
| 68 | test "${includedir}" != '${prefix}/include'; then |
---|
| 69 | CPPFLAGS="-I${includedir} ${CPPFLAGS}" |
---|
| 70 | fi |
---|
| 71 | CPPFLAGS="-I./factor ${CPPFLAGS}" |
---|
| 72 | |
---|
| 73 | if (test "x${prefix} != xNONE && test "${prefix} != "/usr/local") || \ |
---|
| 74 | test "${ac_default_prefix}" != "/usr/local" || \ |
---|
| 75 | test "${libdir}" != '${prefix}/lib'; then |
---|
| 76 | LDFLAGS="-L${libdir} ${LDFLAGS}" |
---|
| 77 | fi |
---|
| 78 | LDFLAGS="-L. ${LDFLAGS}" |
---|
| 79 | |
---|
[4a81ec] | 80 | if test "${CXXFLAGS+set}" != set; then |
---|
| 81 | ac_cxxflags_set=no |
---|
| 82 | if test "$with_debug" = yes; then |
---|
| 83 | CXXFLAGS="-g" |
---|
| 84 | else |
---|
| 85 | CXXFLAGS="-O" |
---|
| 86 | AC_DEFINE(NDEBUG) |
---|
| 87 | fi |
---|
[1a80b4] | 88 | fi |
---|
| 89 | |
---|
| 90 | dnl |
---|
| 91 | dnl Checks for programs. |
---|
| 92 | dnl |
---|
| 93 | AC_LANG_CPLUSPLUS |
---|
| 94 | AC_PROG_CXX |
---|
| 95 | AC_REQUIRE_CPP |
---|
| 96 | AC_PROG_MAKE_SET |
---|
| 97 | AC_PROG_RANLIB |
---|
| 98 | AC_CHECK_PROG(AR,ar,ar) |
---|
| 99 | if test -z "$AR"; then |
---|
| 100 | AC_MSG_ERROR(Need ar) |
---|
| 101 | fi |
---|
| 102 | |
---|
| 103 | dnl |
---|
[3e55bc] | 104 | dnl programs for installation |
---|
[1a80b4] | 105 | dnl |
---|
[3e55bc] | 106 | dnl ac_save_path=${PATH} |
---|
| 107 | dnl PATH="$PATH:.." |
---|
| 108 | dnl AC_PROG_INSTALL |
---|
| 109 | dnl AC_PATH_PROG(MKINSTALLDIRS, mkinstalldirs, -mkdir -p) |
---|
| 110 | dnl PATH="$ac_save_path" |
---|
[dc32d42] | 111 | |
---|
[3e55bc] | 112 | dnl |
---|
| 113 | dnl Checks for header files. |
---|
| 114 | dnl |
---|
| 115 | AC_CHECK_HEADER(factory.h,,AC_MSG_WARN(factory.h not found! Install factory before building libfac!)) |
---|
[1a80b4] | 116 | |
---|
| 117 | dnl |
---|
| 118 | dnl Checks for libraries. |
---|
| 119 | dnl |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | dnl |
---|
| 123 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
| 124 | dnl |
---|
| 125 | AC_C_CONST |
---|
| 126 | AC_C_INLINE |
---|
| 127 | |
---|
| 128 | dnl |
---|
| 129 | dnl Last, but not least, customize CFLAGS |
---|
| 130 | dnl |
---|
| 131 | if test ${GXX} = yes; then |
---|
[104fd23] | 132 | |
---|
| 133 | # check whether CXX accepts --no-rtti |
---|
| 134 | AC_MSG_CHECKING(whether gcc accepts --no-rtti) |
---|
[d3ff79] | 135 | tmp_flags=${CXXFLAGS} |
---|
[104fd23] | 136 | CXXFLAGS="${CXXFLAGS} --no-rtti" |
---|
[d3ff79] | 137 | AC_LANG_SAVE |
---|
| 138 | AC_LANG_CPLUSPLUS |
---|
[104fd23] | 139 | AC_CACHE_VAL(ac_cv_cxx_have_rtti, |
---|
| 140 | AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no) |
---|
| 141 | ) |
---|
| 142 | AC_MSG_RESULT(${ac_cv_cxx_have_rtti}) |
---|
| 143 | if test "${ac_cv_cxx_have_rtti}" != yes; then |
---|
| 144 | CXXFLAGS=$temp_flags |
---|
| 145 | else |
---|
| 146 | CXX="${CXX} --no-rtti" |
---|
| 147 | fi |
---|
| 148 | |
---|
| 149 | # check whether gcc accepts --no-exceptions |
---|
| 150 | AC_MSG_CHECKING(whether gcc accepts --no-exceptions) |
---|
| 151 | CXXFLAGS="${CXXFLAGS} --no-exceptions" |
---|
| 152 | AC_CACHE_VAL(ac_cv_cxx_have_exceptions, |
---|
| 153 | AC_TRY_COMPILE(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no) |
---|
| 154 | ) |
---|
| 155 | AC_MSG_RESULT(${ac_cv_cxx_have_exceptions}) |
---|
| 156 | if test "${ac_cv_cxx_have_exceptions}" != yes; then |
---|
| 157 | CXXFLAGS=$temp_flags |
---|
| 158 | else |
---|
| 159 | CXX="${CXX} --no-exceptions" |
---|
| 160 | fi |
---|
| 161 | |
---|
[d3ff79] | 162 | AC_LANG_RESTORE |
---|
[104fd23] | 163 | CXXFLAGS=$temp_flags |
---|
[d3ff79] | 164 | |
---|
| 165 | fi |
---|
[104fd23] | 166 | |
---|
[4a81ec] | 167 | if test "$ac_cxxflags_set" = no; then |
---|
| 168 | if test "$with_debug" = yes; then |
---|
| 169 | CXXFLAGS="-O -g" |
---|
| 170 | else |
---|
| 171 | CXXFLAGS="-O3 " |
---|
| 172 | fi |
---|
[1a80b4] | 173 | fi |
---|
| 174 | CXXTEMPLFLAGS="-fno-implicit-templates" |
---|
| 175 | else |
---|
| 176 | CXXTEMPFLAGS="" |
---|
| 177 | fi |
---|
| 178 | AC_SUBST(CXXTEMPLFLAGS) |
---|
| 179 | |
---|
| 180 | AC_OUTPUT(Makefile) |
---|
[3e55bc] | 181 | |
---|
| 182 | dnl |
---|
| 183 | dnl Plans: |
---|
| 184 | dnl 1) look for libraries (warn if not found) for building testprog |
---|
| 185 | dnl 1) search for perl |
---|