Benny Prijono | c4c61d0 | 2006-08-20 20:47:34 +0000 | [diff] [blame] | 1 | AC_INIT(pjproject,0.5.8) |
| 2 | AC_CANONICAL_BUILD |
| 3 | AC_CANONICAL_HOST |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 4 | AC_CANONICAL_TARGET |
Benny Prijono | c4c61d0 | 2006-08-20 20:47:34 +0000 | [diff] [blame] | 5 | AC_CONFIG_HEADER([pjlib/include/pj/compat/os_auto.h |
| 6 | pjlib/include/pj/compat/m_auto.h |
| 7 | ]) |
| 8 | AC_CONFIG_FILES([build.mak |
| 9 | build/os-auto.mak |
| 10 | pjlib/build/os-auto.mak |
| 11 | pjlib-util/build/os-auto.mak |
| 12 | pjmedia/build/os-auto.mak |
| 13 | pjsip/build/os-auto.mak |
| 14 | ]) |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 15 | AC_PROG_CC |
Benny Prijono | c4c61d0 | 2006-08-20 20:47:34 +0000 | [diff] [blame] | 16 | AC_PROG_CXX |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 17 | AC_LANG_C |
| 18 | |
Benny Prijono | c4c61d0 | 2006-08-20 20:47:34 +0000 | [diff] [blame] | 19 | AC_CHECK_LIB(pthread,pthread_create) |
| 20 | |
| 21 | AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu]) |
| 22 | AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"]) |
| 23 | |
| 24 | # Endianness detection |
| 25 | AC_C_BIGENDIAN([AC_SUBST(ac_bigendian,1) |
| 26 | AC_DEFINE(PJ_IS_LITTLE_ENDIAN,0) |
| 27 | AC_DEFINE(PJ_IS_BIG_ENDIAN,1) |
| 28 | ], |
| 29 | [AC_SUBST(ac_bigendian,0) |
| 30 | AC_DEFINE(PJ_IS_LITTLE_ENDIAN,1) |
| 31 | AC_DEFINE(PJ_IS_BIG_ENDIAN,0) |
| 32 | ]) |
| 33 | |
| 34 | # --disable-floating-point option |
| 35 | AC_ARG_ENABLE(floating-point, |
| 36 | AC_HELP_STRING([--disable-floating-point], |
| 37 | [Disable floating point where possible]), |
| 38 | [if test "$enable_floating_point" = "no"; then |
| 39 | AC_DEFINE(PJ_HAS_FLOATING_POINT,0) |
| 40 | AC_MSG_RESULT([Checking if floating point is disabled... yes]) |
| 41 | fi], |
| 42 | [ |
| 43 | AC_DEFINE(PJ_HAS_FLOATING_POINT,1) |
| 44 | AC_MSG_RESULT([Checking if floating point is disabled... no]) |
| 45 | AC_CHECK_LIB(m,fmod) |
| 46 | ]) |
| 47 | |
| 48 | |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 49 | AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)]) |
| 50 | AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)]) |
| 51 | AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)]) |
| 52 | AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)]) |
| 53 | AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)]) |
| 54 | AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)]) |
| 55 | AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)]) |
| 56 | AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)]) |
| 57 | AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)]) |
| 58 | AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)]) |
| 59 | AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)]) |
| 60 | AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)]) |
| 61 | AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)]) |
| 62 | AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)]) |
| 63 | AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)]) |
| 64 | AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)]) |
| 65 | AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)]) |
| 66 | AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)]) |
| 67 | AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)]) |
| 68 | AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)]) |
| 69 | AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)]) |
| 70 | AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)]) |
| 71 | AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)]) |
| 72 | AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)]) |
| 73 | AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)]) |
| 74 | |
Benny Prijono | c4c61d0 | 2006-08-20 20:47:34 +0000 | [diff] [blame] | 75 | AC_MSG_RESULT([Setting PJ_OS_NAME to $target]) |
| 76 | AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"]) |
| 77 | |
| 78 | AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1]) |
| 79 | AC_DEFINE(PJ_HAS_ERRNO_VAR,1) |
| 80 | |
| 81 | AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1]) |
| 82 | AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1) |
| 83 | |
| 84 | AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1]) |
| 85 | AC_DEFINE(PJ_HAS_MALLOC,1) |
| 86 | |
| 87 | AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0]) |
| 88 | AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0) |
| 89 | |
| 90 | AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long]) |
| 91 | AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long) |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 92 | |
| 93 | # Determine if inet_aton() is available |
| 94 | AC_MSG_CHECKING([if inet_aton is available]) |
| 95 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h> |
| 96 | #include <netinet/in.h> |
| 97 | #include <arpa/inet.h>]], |
| 98 | [inet_aton(0, 0);])], |
| 99 | [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1) |
| 100 | AC_MSG_RESULT(yes)], |
| 101 | [AC_MSG_RESULT(no)]) |
| 102 | |
| 103 | # Determine if sockaddr_in has sin_len member |
| 104 | AC_MSG_CHECKING([if sockaddr_in has sin_len member]) |
| 105 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h> |
| 106 | #include <netinet/in.h> |
| 107 | #include <arpa/inet.h>]], |
| 108 | [struct sockaddr_in a; a.sin_len=0;])], |
| 109 | [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1) |
| 110 | AC_MSG_RESULT(yes)], |
| 111 | AC_MSG_RESULT(no)) |
| 112 | |
| 113 | # Determine if SO_ERROR is available |
| 114 | AC_MSG_CHECKING([if SO_ERROR is available]) |
| 115 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h> |
| 116 | #include <netinet/in.h> |
| 117 | #include <arpa/inet.h>]], |
| 118 | [int i=SO_ERROR;])], |
| 119 | [AC_DEFINE(PJ_HAS_SO_ERROR,1) |
| 120 | AC_MSG_RESULT(yes)], |
| 121 | AC_MSG_RESULT(no)) |
| 122 | |
| 123 | # Determine if RW-mutex is available |
| 124 | AC_MSG_CHECKING([if pthread_rwlock_t is available]) |
| 125 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], |
| 126 | [pthread_rwlock_t *x;])], |
| 127 | [AC_DEFINE(PJ_EMULATE_RWMUTEX,0) |
| 128 | AC_MSG_RESULT(yes)], |
Benny Prijono | c4c61d0 | 2006-08-20 20:47:34 +0000 | [diff] [blame] | 129 | [AC_DEFINE(PJ_EMULATE_RWMUTEX,1) |
| 130 | AC_MSG_RESULT(no)]) |
| 131 | |
| 132 | |
| 133 | ########################################## |
| 134 | # |
| 135 | # PJMEDIA |
| 136 | # |
| 137 | |
| 138 | # Sound device backend selection |
| 139 | AC_SUBST(ac_pjmedia_snd) |
| 140 | case $target in |
| 141 | *cygwin* | *win* | *mingw*) |
| 142 | ac_pjmedia_snd=pa_win32 |
| 143 | AC_MSG_RESULT([Checking sound device backend... win32 sound]) |
| 144 | ;; |
| 145 | *rtems*) |
| 146 | ac_pjmedia_snd=null |
| 147 | AC_MSG_RESULT([Checking sound device backend... null sound]) |
| 148 | ;; |
| 149 | *darwin*) |
| 150 | ac_pjmedia_snd=pa_darwin_os |
| 151 | AC_MSG_RESULT([Checking sound device backend... coreaudio]) |
| 152 | ;; |
| 153 | *) |
| 154 | ac_pjmedia_snd=pa_unix |
| 155 | AC_CHECK_HEADER(alsa/version.h, |
| 156 | [AC_SUBST(ac_pa_use_alsa,1) |
| 157 | LIBS="$LIBS -lasound" |
| 158 | ], |
| 159 | [AC_SUBST(ac_pa_use_alsa,0)]) |
| 160 | AC_MSG_RESULT([Checking sound device backend... unix]) |
| 161 | ;; |
| 162 | esac |
| 163 | |
| 164 | # Include resampling small filter |
| 165 | AC_SUBST(ac_no_small_filter) |
| 166 | AC_ARG_ENABLE(small-filter, |
| 167 | AC_HELP_STRING([--disable-small-filter], |
| 168 | [Exclude small filter in resampling]), |
| 169 | [if test "$enable_small_filter" = "no"; then |
| 170 | [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0'] |
| 171 | AC_MSG_RESULT([Checking if small filter is disabled... yes]) |
| 172 | fi], |
| 173 | AC_MSG_RESULT([Checking if small filter is disabled... no])) |
| 174 | |
| 175 | # Include resampling large filter |
| 176 | AC_SUBST(ac_no_large_filter) |
| 177 | AC_ARG_ENABLE(large-filter, |
| 178 | AC_HELP_STRING([--disable-large-filter], |
| 179 | [Exclude large filter in resampling]), |
| 180 | [if test "$enable_large_filter" = "no"; then |
| 181 | [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0'] |
| 182 | AC_MSG_RESULT([Checking if large filter is disabled... yes]) |
| 183 | fi], |
| 184 | AC_MSG_RESULT([Checking if large filter is disabled... no])) |
| 185 | |
| 186 | # Include G.711 Annex A PLC |
| 187 | AC_SUBST(ac_no_g711_plc) |
| 188 | AC_ARG_ENABLE(g711-plc, |
| 189 | AC_HELP_STRING([--disable-g711-plc], |
| 190 | [Exclude G.711 Annex A PLC]), |
| 191 | [if test "$enable_g711_plc" = "no"; then |
| 192 | [ac_no_g711_plc='-DPJMEDIA_HAS_G711_PLC=0'] |
| 193 | AC_MSG_RESULT([Checking if G.711 Annex A PLC is disabled...yes]) |
| 194 | fi], |
| 195 | AC_MSG_RESULT([Checking if G.711 Annex A PLC is disabled...no])) |
| 196 | |
| 197 | # Include Speex AEC |
| 198 | AC_SUBST(ac_no_speex_aec) |
| 199 | AC_ARG_ENABLE(speex-aec, |
| 200 | AC_HELP_STRING([--disable-speex-aec], |
| 201 | [Exclude Speex Acoustic Echo Canceller/AEC]), |
| 202 | [if test "$enable_speex_aec" = "no"; then |
| 203 | [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0'] |
| 204 | AC_MSG_RESULT([Checking if Speex AEC is disabled...yes]) |
| 205 | fi], |
| 206 | AC_MSG_RESULT([Checking if Speex AEC is disabled...no])) |
| 207 | |
| 208 | # Include G711 codec |
| 209 | AC_SUBST(ac_no_g711_codec) |
| 210 | AC_ARG_ENABLE(g711-codec, |
| 211 | AC_HELP_STRING([--disable-g711-codec], |
| 212 | [Exclude G.711 codecs from the build]), |
| 213 | [if test "$enable_g711_codec" = "no"; then |
| 214 | [ac_no_g711_codec=1] |
| 215 | AC_MSG_RESULT([Checking if G.711 codec is disabled...yes]) |
| 216 | fi], |
| 217 | AC_MSG_RESULT([Checking if G.711 codec is disabled...no])) |
| 218 | |
| 219 | |
| 220 | # Include L16 codec |
| 221 | AC_SUBST(ac_no_l16_codec) |
| 222 | AC_ARG_ENABLE(l16-codec, |
| 223 | AC_HELP_STRING([--disable-l16-codec], |
| 224 | [Exclude Linear/L16 codec family from the build]), |
| 225 | [if test "$enable_l16_codec" = "no"; then |
| 226 | [ac_no_l16_codec=1] |
| 227 | AC_MSG_RESULT([Checking if L16 codecs are disabled...yes]) |
| 228 | fi], |
| 229 | AC_MSG_RESULT([Checking if G.711 codec is disabled...no])) |
| 230 | |
| 231 | |
| 232 | # Include GSM codec |
| 233 | AC_SUBST(ac_no_gsm_codec) |
| 234 | AC_ARG_ENABLE(gsm-codec, |
| 235 | AC_HELP_STRING([--disable-gsm-codec], |
| 236 | [Exclude GSM codec in the build]), |
| 237 | [if test "$enable_gsm_codec" = "no"; then |
| 238 | [ac_no_gsm_codec=1] |
| 239 | AC_MSG_RESULT([Checking if GSM codec is disabled...yes]) |
| 240 | fi], |
| 241 | AC_MSG_RESULT([Checking if GSM codec is disabled...no])) |
| 242 | |
| 243 | # Include Speex codec |
| 244 | AC_SUBST(ac_no_speex_codec) |
| 245 | AC_ARG_ENABLE(speex-codec, |
| 246 | AC_HELP_STRING([--disable-speex-codec], |
| 247 | [Exclude Speex codecs in the build]), |
| 248 | [if test "$enable_speex_codec" = "no"; then |
| 249 | [ac_no_speex_codec=1] |
| 250 | AC_MSG_RESULT([Checking if Speex codec is disabled...yes]) |
| 251 | fi], |
| 252 | AC_MSG_RESULT([Checking if Speex codec is disabled...no])) |
| 253 | |
| 254 | # Include iLBC codec |
| 255 | AC_SUBST(ac_no_ilbc_codec) |
| 256 | AC_ARG_ENABLE(ilbc-codec, |
| 257 | AC_HELP_STRING([--disable-ilbc-codec], |
| 258 | [Exclude iLBC codec in the build]), |
| 259 | [if test "$enable_ilbc_codec" = "no"; then |
| 260 | [ac_no_ilbc_codec=1] |
| 261 | AC_MSG_RESULT([Checking if iLBC codec is disabled...yes]) |
| 262 | fi], |
| 263 | AC_MSG_RESULT([Checking if iLBC codec is disabled...no])) |
| 264 | |
| 265 | |
| 266 | |
| 267 | ########################################## |
| 268 | # |
| 269 | # MANUAL CONFIG |
| 270 | # |
| 271 | |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 272 | |
| 273 | # Determine if select() requires nfds to be filled up with |
| 274 | # correct value (max_fd+1). If zero, nfds will be filled up with |
| 275 | # PJ_FD_SETSIZE |
Benny Prijono | c4c61d0 | 2006-08-20 20:47:34 +0000 | [diff] [blame] | 276 | AC_MSG_CHECKING([if select() needs correct nfds]) |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 277 | case $target in |
| 278 | *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1) |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 279 | AC_MSG_RESULT(yes) |
| 280 | ;; |
| 281 | *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0) |
| 282 | AC_MSG_RESULT([no (default)]) |
| 283 | AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)]) |
| 284 | ;; |
| 285 | esac |
| 286 | |
| 287 | # Determine if pj_thread_create() should enforce thread stack size when |
| 288 | # creating thread. Default is zero, to allow OS to allocate appropriate |
| 289 | # thread's stack size. |
| 290 | AC_MSG_CHECKING([if pj_thread_create() should enforce stack size]) |
| 291 | case $target in |
| 292 | *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1) |
| 293 | AC_MSG_RESULT(yes) |
| 294 | ;; |
| 295 | *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0) |
| 296 | AC_MSG_RESULT([no (default)]) |
| 297 | ;; |
| 298 | esac |
| 299 | |
| 300 | # Determine if pj_thread_create() should allocate thread's stack from |
| 301 | # the pool. Default is zero, to let OS allocate thread's stack. |
| 302 | AC_MSG_CHECKING([if pj_thread_create() should allocate stack]) |
| 303 | case $target in |
| 304 | *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1) |
| 305 | AC_MSG_RESULT(yes) |
| 306 | ;; |
| 307 | *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0) |
| 308 | AC_MSG_RESULT([no (default)]) |
| 309 | ;; |
| 310 | esac |
| 311 | |
| 312 | # This value specifies the value set in errno by the OS when a non-blocking |
| 313 | # socket recv() can not return immediate data. |
| 314 | case $target in |
| 315 | *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN) |
| 316 | AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)]) |
| 317 | ;; |
| 318 | esac |
| 319 | |
| 320 | # This value specifies the value set in errno by the OS when a non-blocking |
| 321 | # socket connect() can not get connected immediately. |
| 322 | case $target in |
| 323 | *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS) |
| 324 | AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)]) |
| 325 | ;; |
| 326 | esac |
| 327 | |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 328 | |
Benny Prijono | c4c61d0 | 2006-08-20 20:47:34 +0000 | [diff] [blame] | 329 | AC_SUBST(target) |
| 330 | AC_SUBST(ac_cross_compile) |
| 331 | if test "$build" = "$host"; then |
| 332 | ac_cross_compile= |
| 333 | else |
| 334 | ac_cross_compile=${host}- |
| 335 | fi |
| 336 | AC_SUBST(ac_linux_poll,select) |
| 337 | AC_SUBST(ac_host,unix) |
| 338 | AC_SUBST(ac_main_obj) |
| 339 | case $target in |
| 340 | *rtems*) |
| 341 | ac_main_obj=main_rtems.o |
| 342 | ;; |
| 343 | *) |
| 344 | ac_main_obj=main.o |
| 345 | ;; |
| 346 | esac |
| 347 | AC_SUBST(CC) |
Benny Prijono | a9b372a | 2006-07-24 02:07:11 +0000 | [diff] [blame] | 348 | AC_OUTPUT() |
| 349 | |