| 1 | dnl Process this file with autoconf to produce a configure script. |
|---|
| 2 | |
|---|
| 3 | AC_INIT(base64.c) |
|---|
| 4 | |
|---|
| 5 | AC_CANONICAL_HOST |
|---|
| 6 | |
|---|
| 7 | dnl UCL checked $host_os and exited if we didn't recognize it. |
|---|
| 8 | dnl Let's be more optimistic for now. |
|---|
| 9 | |
|---|
| 10 | dnl XXX |
|---|
| 11 | dnl Backwards compatability to UCL's -D<ostype> for now |
|---|
| 12 | dnl All references to an OS should be replaced by references |
|---|
| 13 | dnl to features! |
|---|
| 14 | |
|---|
| 15 | case "$host_os" in |
|---|
| 16 | |
|---|
| 17 | linux*) |
|---|
| 18 | AC_DEFINE(Linux) |
|---|
| 19 | ;; |
|---|
| 20 | |
|---|
| 21 | sunos*) |
|---|
| 22 | AC_DEFINE(SunOS) |
|---|
| 23 | ;; |
|---|
| 24 | |
|---|
| 25 | solaris*) |
|---|
| 26 | AC_DEFINE(Solaris) |
|---|
| 27 | ;; |
|---|
| 28 | |
|---|
| 29 | hpux*) |
|---|
| 30 | AC_DEFINE(HPUX) |
|---|
| 31 | ;; |
|---|
| 32 | esac |
|---|
| 33 | |
|---|
| 34 | AC_PROG_CC |
|---|
| 35 | AC_PROG_CPP |
|---|
| 36 | AC_PROG_RANLIB |
|---|
| 37 | |
|---|
| 38 | AC_HEADER_STDC |
|---|
| 39 | AC_C_CONST |
|---|
| 40 | AC_TYPE_SIZE_T |
|---|
| 41 | |
|---|
| 42 | # Check for standard size types. The defaults are only valid on some |
|---|
| 43 | # systems so we hope that <inttypes.h> exists when they're wrong. |
|---|
| 44 | AC_CHECK_TYPE(u_int8_t, unsigned char) |
|---|
| 45 | AC_CHECK_TYPE(u_int16_t, unsigned short) |
|---|
| 46 | AC_CHECK_TYPE(u_int32_t, unsigned long) |
|---|
| 47 | AC_CHECK_TYPE(int8_t, signed char) |
|---|
| 48 | AC_CHECK_TYPE(int16_t, short) |
|---|
| 49 | AC_CHECK_TYPE(int32_t, long) |
|---|
| 50 | AC_CHECK_TYPE(int64_t, long long) |
|---|
| 51 | |
|---|
| 52 | # The following two macros cause autoconf to complain. |
|---|
| 53 | AC_C_BIGENDIAN |
|---|
| 54 | AC_C_CHAR_UNSIGNED |
|---|
| 55 | # |
|---|
| 56 | # The (?which?) library does not work with unsigned characters. |
|---|
| 57 | # Force the compiler to use signed chars. |
|---|
| 58 | if test $ac_cv_c_char_unsigned = yes |
|---|
| 59 | then |
|---|
| 60 | if test "$GCC" = yes |
|---|
| 61 | then |
|---|
| 62 | CFLAGS="$CFLAGS -fsigned-char" |
|---|
| 63 | else |
|---|
| 64 | case "$host_os" in |
|---|
| 65 | dnl |
|---|
| 66 | dnl I don't know when "-signed" was added to IRIX CC |
|---|
| 67 | dnl so err on the side of using it. |
|---|
| 68 | irix*) CFLAGS="$CFLAGS -signed" |
|---|
| 69 | ;; |
|---|
| 70 | dnl need e.g. --force-signed-chars=-signed |
|---|
| 71 | *) AC_MSG_ERROR([I don't know how to force signed chars]) |
|---|
| 72 | ;; |
|---|
| 73 | esac |
|---|
| 74 | fi |
|---|
| 75 | fi |
|---|
| 76 | dnl __CHAR_UNSIGNED__ will be defined; hope this is OK. |
|---|
| 77 | |
|---|
| 78 | # GCC-specific warning flags |
|---|
| 79 | if test "$GCC" = yes |
|---|
| 80 | then |
|---|
| 81 | CFLAGS="$CFLAGS -W -Wall -Wbad-function-cast -Wmissing-prototypes -Werror" |
|---|
| 82 | if test -f .devel |
|---|
| 83 | then |
|---|
| 84 | CFLAGS="$CFLAGS -Werror" |
|---|
| 85 | fi |
|---|
| 86 | fi |
|---|
| 87 | |
|---|
| 88 | # The following causes autoconf to complain. |
|---|
| 89 | AC_CHECK_FILE(/dev/urandom,AC_DEFINE(HAVE_DEV_URANDOM)) |
|---|
| 90 | |
|---|
| 91 | # If more files than mbus.c use vsnprintf, split it out into |
|---|
| 92 | # vsnprintf.c and add it to AC_REPLACE_FUNCS |
|---|
| 93 | AC_CHECK_FUNC(vsnprintf,,AC_DEFINE(NEED_VSNPRINTF)) |
|---|
| 94 | |
|---|
| 95 | # If inet_aton is actually needed somewhere, split it out into |
|---|
| 96 | # inet_aton.c and add it to AC_REPLACE_FUNCS |
|---|
| 97 | |
|---|
| 98 | AC_REPLACE_FUNCS(inet_pton inet_ntop) |
|---|
| 99 | |
|---|
| 100 | # define HAVE_IPv6 if we find getipnodebyname |
|---|
| 101 | AC_CACHE_CHECK(whether to include IPv6 support, |
|---|
| 102 | ac_cv_ucl_has_ipv6, |
|---|
| 103 | AC_EGREP_HEADER(getipnodebyname, |
|---|
| 104 | netdb.h, |
|---|
| 105 | ac_cv_ucl_has_ipv6=yes, |
|---|
| 106 | ac_cv_ucl_has_ipv6=no)) |
|---|
| 107 | if test $ac_cv_ucl_has_ipv6 = yes |
|---|
| 108 | then |
|---|
| 109 | AC_DEFINE(HAVE_IPv6) |
|---|
| 110 | fi |
|---|
| 111 | |
|---|
| 112 | AC_SEARCH_LIBS(socket, socket) |
|---|
| 113 | AC_SEARCH_LIBS(inet_addr, nsl) |
|---|
| 114 | |
|---|
| 115 | # configure defaults CFLAGS to -g -O2 |
|---|
| 116 | # so a debug flag would have to fail to remove -g |
|---|
| 117 | # and the optimize would have to modify or add the -O |
|---|
| 118 | # flags: |
|---|
| 119 | # -debug: |
|---|
| 120 | # DEBUG2=$DEBUG |
|---|
| 121 | # AC_DEFINE(DEBUG) |
|---|
| 122 | # -optimize |
|---|
| 123 | # OPTIMIZE2=$OPTIMIZE |
|---|
| 124 | # AC_DEFINE(NDEBUG) |
|---|
| 125 | # -profile |
|---|
| 126 | AC_ARG_ENABLE(profile, |
|---|
| 127 | [ --enable-profile enable profiling], |
|---|
| 128 | [if test $enableval = yes |
|---|
| 129 | then |
|---|
| 130 | if test "$GCC" = yes |
|---|
| 131 | then |
|---|
| 132 | CFLAGS="$CFLAGS -pg" |
|---|
| 133 | else |
|---|
| 134 | AC_ERROR([Don't know how to enable profiling for $CC]) |
|---|
| 135 | fi |
|---|
| 136 | fi]) |
|---|
| 137 | |
|---|
| 138 | # -bounds |
|---|
| 139 | # add -fbounds-checking to CFLAGS |
|---|
| 140 | # add -lcheck to LIBS |
|---|
| 141 | AC_ARG_ENABLE(bounds, |
|---|
| 142 | [ --enable-bounds enable bounds checking], |
|---|
| 143 | [if test $enableval = yes |
|---|
| 144 | then |
|---|
| 145 | if test "$GCC" = yes |
|---|
| 146 | then |
|---|
| 147 | CFLAGS="$CFLAGS -fbounds-checking" |
|---|
| 148 | LIBS="$LIBS -lcheck" |
|---|
| 149 | else |
|---|
| 150 | AC_ERROR([Don't know how to enable profiling for $CC]) |
|---|
| 151 | fi |
|---|
| 152 | fi]) |
|---|
| 153 | |
|---|
| 154 | # others |
|---|
| 155 | # add as compile flag |
|---|
| 156 | # also: |
|---|
| 157 | # MBUS_ENCRYPT_BY_DEFAULT |
|---|
| 158 | |
|---|
| 159 | |
|---|
| 160 | |
|---|
| 161 | # -DDEBUG |
|---|
| 162 | # -DDEBUG_MEM |
|---|
| 163 | # -DNDEBUG |
|---|
| 164 | AC_ARG_ENABLE(debug, |
|---|
| 165 | [ --enable-debug enable debug messages and code], |
|---|
| 166 | [if test $enableval = yes |
|---|
| 167 | then |
|---|
| 168 | AC_DEFINE(DEBUG) |
|---|
| 169 | fi]) |
|---|
| 170 | AC_ARG_ENABLE(debug-mem, |
|---|
| 171 | [ --enable-debug-mem enable memory debugging code], |
|---|
| 172 | [if test $enableval = yes |
|---|
| 173 | then |
|---|
| 174 | AC_DEFINE(DEBUG_MEM) |
|---|
| 175 | fi]) |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | AC_CONFIG_HEADER(config.h) |
|---|
| 179 | |
|---|
| 180 | AC_OUTPUT(Makefile) |
|---|