1dnl Process this file with autoconf to produce a configure script. 2AC_INIT(cgi/cgi.c) 3AC_CONFIG_HEADER(cs_config.h) 4 5dnl Checks for programs. 6AC_PROG_CC 7AC_PROG_CPP 8AC_PROG_LN_S 9AC_CHECK_PROGS(AR, ar aal, ar) 10AC_PROG_RANLIB 11 12AC_PROG_MAKE_SET 13AC_PROG_INSTALL 14 15dnl Checks for Neotonic Paths 16AC_MSG_CHECKING(for Neotonic Paths) 17if test -d /neo/opt/include; then 18 AC_MSG_RESULT(found) 19 CPPFLAGS="$CPPFLAGS -I/neo/opt/include" 20 LDFLAGS="$LDFLAGS -L/neo/opt/lib" 21else 22 AC_MSG_RESULT(not found) 23fi 24 25dnl Checks for header files. 26AC_HEADER_DIRENT 27AC_HEADER_STDC 28AC_HEADER_SYS_WAIT 29AC_CHECK_HEADERS(fcntl.h stdarg.h varargs.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h features.h) 30 31dnl Checks for typedefs, structures, and compiler characteristics. 32AC_C_CONST 33AC_TYPE_MODE_T 34AC_TYPE_OFF_T 35AC_TYPE_PID_T 36AC_TYPE_SIZE_T 37AC_HEADER_TIME 38AC_STRUCT_TM 39AC_STRUCT_TIMEZONE 40 41dnl Checks for library functions. 42AC_TYPE_SIGNAL 43AC_FUNC_STRFTIME 44AC_FUNC_VPRINTF 45AC_FUNC_WAIT3 46AC_CHECK_FUNCS(gettimeofday mktime putenv strerror strspn strtod strtol strtoul) 47AC_CHECK_FUNCS(random rand drand48) 48 49dnl Checks for libraries. 50EXTRA_UTL_OBJS= 51EXTRA_UTL_SRC= 52cs_cv_wdb=no 53AC_ARG_ENABLE(apache, [ --disable-wdb Disables building of wdb], 54 [if test $enableval = no; then 55 AC_MSG_RESULT(Disabling wdb code) 56 else 57 AC_SEARCH_LIBS(db_open, db db2, [cs_cv_wdb=yes]) 58 if test $cs_cv_wdb = yes; then 59 AC_DEFINE(HAVE_DB2) 60 EXTRA_UTL_SRC="$EXTRA_UTL_SRC wdb.c" 61 fi 62 fi]) 63 64dnl Check for locks 65AC_CHECK_FUNC(lockf, [ 66 AC_DEFINE(HAVE_LOCKF) 67 EXTRA_UTL_SRC="$EXTRA_UTL_SRC ulocks.c rcfs.c" 68 69 cs_cv_pthread=no 70 AC_CHECK_HEADER(pthread.h, [cs_cv_pthread=yes]) 71 if test $cs_cv_pthread = yes; then 72 AC_DEFINE(HAVE_PTHREADS) 73 EXTRA_UTL_SRC="$EXTRA_UTL_SRC skiplist.c dict.c" 74 fi 75]) 76 77AC_MINGW32() 78if test "x$MINGW32" = "xyes"; then 79 CPPFLAGS="$CPPFLAGS -D__WINDOWS_GCC__" 80 USE_MINGW32="USE_MINGW32 = 1" 81else 82 EXTRA_UTL_SRC="$EXTRA_UTL_SRC filter.c neo_net.c neo_server.c" 83fi 84 85dnl Check for snprintf and vsnprintf 86cs_cv_snprintf=no 87SNPRINTFOBJS="" 88AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)], [cs_cv_snprintf=yes]) 89AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)], [cs_cv_snprintf=yes]) 90if test $cs_cv_snprintf = yes; then 91 EXTRA_UTL_OBJS="$EXTRA_UTL_OBJS snprintf.o" 92fi 93 94 95dnl Check for missing re-entrant functions 96cs_cv_missing=no 97cs_cv_need_reentrant=no 98dnl copied from libcurl 99AC_CHECK_FUNCS(localtime_r, [ 100 AC_MSG_CHECKING(whether localtime_r is declared) 101 AC_EGREP_CPP(localtime_r,[ 102#include <time.h>],[ 103 AC_DEFINE(HAVE_LOCALTIME_R) 104 AC_MSG_RESULT(yes)],[ 105 AC_MSG_RESULT(no) 106 AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared) 107 AC_EGREP_CPP(localtime_r,[ 108#define _REENTRANT 109#include <time.h>],[ 110 cs_cv_need_reentrant=yes 111 AC_MSG_RESULT(yes)],[ 112 cs_cv_missing=yes 113 AC_MSG_RESULT(no)])])], [cs_cv_missing=yes]) 114 115AC_CHECK_FUNCS(gmtime_r, [ 116 AC_MSG_CHECKING(whether gmtime_r is declared) 117 AC_EGREP_CPP(gmtime_r,[ 118#include <time.h>],[ 119 AC_DEFINE(HAVE_GMTIME_R) 120 AC_MSG_RESULT(yes)],[ 121 AC_MSG_RESULT(no) 122 AC_MSG_CHECKING(whether gmtime_r with -D_REENTRANT is declared) 123 AC_EGREP_CPP(gmtime_r,[ 124#define _REENTRANT 125#include <time.h>],[ 126 cs_cv_need_reentrant=yes 127 AC_MSG_RESULT(yes)],[ 128 cs_cv_missing=yes 129 AC_MSG_RESULT(no)])])], [cs_cv_missing=yes]) 130 131AC_CHECK_FUNCS(strtok_r, [ 132 AC_MSG_CHECKING(whether strtok_r is declared) 133 AC_EGREP_CPP(strtok_r,[ 134#include <string.h>],[ 135 AC_DEFINE(HAVE_STRTOK_R) 136 AC_MSG_RESULT(yes)],[ 137 AC_MSG_RESULT(no) 138 AC_MSG_CHECKING(whether strtok_r with -D_REENTRANT is declared) 139 AC_EGREP_CPP(strtok_r,[ 140#define _REENTRANT 141#include <string.h>],[ 142 cs_cv_need_reentrant=yes 143 AC_MSG_RESULT(yes)],[ 144 cs_cv_missing=yes 145 AC_MSG_RESULT(no)])])], [cs_cv_missing=yes]) 146 147AC_CHECK_FUNC(mkstemp, [AC_DEFINE(HAVE_MKSTEMP)], [cs_cv_missing=yes]) 148if test $cs_cv_missing = yes; then 149 EXTRA_UTL_OBJS="$EXTRA_UTL_OBJS missing.o" 150fi 151if test $cs_cv_need_reentrant = yes; then 152 CPPFLAGS="$CPPFLAGS -D_REENTRANT" 153fi 154 155cs_cv_regex=yes 156AC_CHECK_FUNC(regexec, [AC_DEFINE(HAVE_REGEX)], [cs_cv_regex=no]) 157if test $cs_cv_regex = no; then 158 CPPFLAGS="$CPPFLAGS -I\$(NEOTONIC_ROOT)/util/regex" 159 EXTRA_UTL_SRC="$EXTRA_UTL_SRC regex/regex.c" 160fi 161 162cs_cv_compression=yes 163AC_CHECK_LIB(z, deflate, [cs_cv_compression=yes], [cs_cv_compression=no]) 164AC_ARG_ENABLE(compression, [ --disable-compression Disables HTML Compression support], 165 [if test $enableval = no; then 166 cs_cv_compression=no; 167 AC_MSG_RESULT(Disabling HTML Compression support) 168 fi]) 169 170if test $cs_cv_compression = yes; then 171 AC_DEFINE(HTML_COMPRESSION) 172 LIBS="$LIBS -lz" 173fi 174 175AC_ARG_ENABLE(remote-debugger, [ --enable-remote-debugger Enables remote X CGI debugging], 176 [if test $enableval = yes; then 177 AC_DEFINE(ENABLE_REMOTE_DEBUG) 178 AC_MSG_RESULT(Enabling CGI X Remote debugger) 179 fi]) 180 181dnl Check for Apache apxs 182cs_cv_apache=yes 183AC_ARG_ENABLE(apache, [ --disable-apache Disables building of apache 1.3.x module], 184 [if test $enableval = no; then 185 cs_cv_apache=no; 186 AC_MSG_RESULT(Disabling Apache 1.3.x Module) 187 fi]) 188AC_ARG_WITH(apache, [ --with-apache=path Set location of Apache installation], [cs_cv_apache_path="$withval"], [cs_cv_apache_path=]) 189 190if test $cs_cv_apache = yes; then 191 AC_MSG_CHECKING(for apache apxs) 192 apxs_path=no 193 apache_search_path="$cs_cv_apache_path /neo/opt /usr/local /usr" 194 for path in $apache_search_path; do 195 if test -x $path/httpd/bin/apxs; then 196 apxs_path=$path/httpd/bin/apxs 197 httpd_path=$path/httpd/bin/httpd 198 break 199 fi 200 if test -x $path/httpd/sbin/apxs; then 201 apxs_path=$path/httpd/sbin/apxs 202 httpd_path=$path/httpd/sbin/httpd 203 break 204 fi 205 if test -x $path/bin/apxs; then 206 apxs_path=$path/bin/apxs 207 httpd_path=$path/bin/httpd 208 break 209 fi 210 if test -x $path/sbin/apxs; then 211 apxs_path=$path/sbin/apxs 212 httpd_path=$path/sbin/httpd 213 break 214 fi 215 done 216 if test "x$apxs_path" = "xno"; then 217 AC_MSG_RESULT(not found) 218 else 219 AC_MSG_RESULT(found $apxs_path) 220 AC_MSG_CHECKING(for apache 1.3.x) 221 changequote(<<, >>)dnl 222 apache_version="`$httpd_path -v | grep 'Server version' | sed -e 's/.*Apache\/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/'`" 223 apache_major_version=`echo $apache_version | sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` 224 apache_minor_version=`echo $apache_version | sed -e 's/.*\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` 225 changequote([, ])dnl 226 if test "$apache_major_version" = "1" -a "$apache_minor_version" = "3"; then 227 AC_MSG_RESULT(found $apache_version) 228 APXS_PATH="$apxs_path" 229 BUILD_WRAPPERS="$BUILD_WRAPPERS mod_ecs" 230 else 231 AC_MSG_RESULT(found $apache_version - disabling module build) 232 fi 233 fi 234fi 235 236dnl Check for Python library/includes 237cs_cv_python=yes 238AC_ARG_ENABLE(python, [ --disable-python Disables building of python module], 239 [if test $enableval = no; then 240 cs_cv_python=no; 241 AC_MSG_RESULT(Disabling python module) 242 fi]) 243AC_ARG_WITH(python, [ --with-python=path Set location of Python Interpreter], [cs_cv_python_path="$withval"], [cs_cv_python_path=no]) 244 245if test $cs_cv_python = yes; then 246 AC_MSG_CHECKING(for python includes) 247 python_inc=no 248 python_lib=no 249 python_search_path="/neo/opt /usr/local /usr /c" 250 python_versions="2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15" 251 if test $cs_cv_python_path != "no" -a -x $cs_cv_python_path; then 252 python_bin=$cs_cv_python_path 253 vers=`$python_bin -c "import sys; print sys.version[[:3]]"` 254 py_inst_dir=`$python_bin -c "import sys; print sys.exec_prefix"` 255 python_inc=$py_inst_dir/include/python$vers 256 python_lib="-L$py_inst_dir/lib/python$vers/config -lpython$vers" 257 python_site=$py_inst_dir/lib/python$vers/site-packages 258 else 259 for vers in $python_versions; do 260 for path in $python_search_path; do 261 if test -x $path/bin/python$vers; then 262 python_bin=$path/bin/python$vers 263 major_vers=`echo $vers | cut -b 1` 264 if test $major_vers -ge 2; then 265 python_base=`$python_bin -c "import sys, os; print os.path.dirname([[x for x in sys.path if x.find('site-packages') != -1]][[0]])"` 266 else 267 python_base=`$python_bin -c "import site, os; print os.path.dirname(site.sitedirs[[0]])"` 268 fi 269 if test -d $python_base; then 270 python_lib="-L$python_base/config -lpython$vers" 271 python_site=$python_base/site-packages 272 fi 273 fi 274 if test -f $path/include/python$vers/Python.h; then 275 python_inc=$path/include/python$vers 276 fi 277 if test "x$python_lib" = "xno"; then 278 if test -d $path/lib/python$vers; then 279 python_lib="-L$path/lib/python$vers/config -lpython$vers" 280 python_site=$path/lib/python$vers/site-packages 281 fi 282 if test -d $path/lib64/python$vers; then 283 python_lib="-L$path/lib64/python$vers/config -lpython$vers" 284 python_site=$path/lib64/python$vers/site-packages 285 fi 286 fi 287 dnl This is currently special cased mostly for Windows 288 dnl installs, but we only use python_lib for windows anyways 289 if test -f $path/python$vers/include/Python.h; then 290 python_inc=$path/python$vers/include 291 python_lib="-L$path/python$vers/libs -lpython$vers" 292 python_site=$path/python$vers/Lib/site-packages 293 break 2 294 fi 295 if test "x$python_inc" != "xno" -a "x$python_lib" != "xno"; then 296 break 2 297 fi 298 done 299 done 300 fi 301 if test "x$python_inc" = "xno"; then 302 AC_MSG_RESULT(not found) 303 PYTHON= 304 PYTHON_INC= 305 PYTHON_LIB= 306 PYTHON_SITE= 307 else 308 AC_MSG_RESULT(found $python_inc) 309 PYTHON=$python_bin 310 PYTHON_INC="-I$python_inc" 311 PYTHON_LIB=$python_lib 312 if test "x$PYTHON_SITE" = "x"; then 313 PYTHON_SITE=$python_site 314 fi 315 BUILD_WRAPPERS="$BUILD_WRAPPERS python" 316 fi 317fi 318 319dnl Check for Perl binary 320cs_cv_perl=yes 321AC_ARG_ENABLE(perl, [ --disable-perl Disables building of perl module], 322 [if test $enableval = no; then 323 cs_cv_perl=no; 324 AC_MSG_RESULT(Disabling perl module) 325 fi]) 326AC_ARG_WITH(perl, [ --with-perl=path Set location of Perl binary], [cs_cv_perl_path="$withval"], [cs_cv_perl_path=no]) 327 328if test $cs_cv_perl = yes; then 329 AC_MSG_CHECKING(for perl >= 5.006) 330 perl_path=no 331 perl_search_path="/neo/opt /usr/local /usr" 332 if test $cs_cv_perl_path != "no" -a -x $cs_cv_perl_path; then 333 perl_path=$cs_cv_perl_path 334 else 335 for path in $perl_search_path; do 336 if test -x $path/bin/perl; then 337 require_error=`$path/bin/perl -e 'require 5.006' 2>&1` 338 if test "x$require_error" = "x"; then 339 perl_path=$path/bin/perl 340 break 341 fi 342 fi 343 done 344 fi 345 if test "x$perl_path" = "xno"; then 346 AC_MSG_RESULT(not found) 347 PERL= 348 else 349 AC_MSG_RESULT(found $perl_path) 350 PERL="$perl_path" 351 BUILD_WRAPPERS="$BUILD_WRAPPERS perl" 352 fi 353fi 354 355dnl Check for Ruby binary 356cs_cv_ruby=yes 357AC_ARG_ENABLE(ruby, [ --disable-ruby Disables building of ruby module], 358 [if test $enableval = no; then 359 cs_cv_ruby=no; 360 AC_MSG_RESULT(Disabling ruby module) 361 fi]) 362AC_ARG_WITH(ruby, [ --with-ruby=path Set location of Ruby binary], [cs_cv_ruby_path="$withval"], [cs_cv_ruby_path=no]) 363 364if test $cs_cv_ruby = yes; then 365 AC_MSG_CHECKING(for ruby) 366 ruby_path=no 367 ruby_search_path="/neo/opt /usr/local /usr" 368 if test $cs_cv_ruby_path != "no" -a -x $cs_cv_ruby_path; then 369 ruby_path=$cs_cv_ruby_path 370 else 371 for path in $ruby_search_path; do 372 if test -x $path/bin/ruby; then 373 ruby_path=$path/bin/ruby 374 break 375 fi 376 done 377 fi 378 if test "x$ruby_path" = "xno"; then 379 AC_MSG_RESULT(not found) 380 RUBY= 381 else 382 AC_MSG_RESULT(found $ruby_path) 383 RUBY="$ruby_path" 384 BUILD_WRAPPERS="$BUILD_WRAPPERS ruby" 385 fi 386fi 387 388dnl Check for Java library/includes 389cs_cv_java=yes 390AC_ARG_ENABLE(java, [ --disable-java Disables building of java module], 391 [if test $enableval = no; then 392 cs_cv_java=no; 393 AC_MSG_RESULT(Disabling java module) 394 fi]) 395AC_ARG_WITH(java, [ --with-java=path Set location of J2SDK], [cs_cv_java_path="$withval"], [cs_cv_java_path=no]) 396 397if test $cs_cv_java = yes; then 398 AC_MSG_CHECKING(for j2sdk path) 399 java_path=no 400 if test $cs_cv_java_path != "no" -a -d $cs_cv_java_path; then 401 java_path=$cs_cv_java_path 402 else 403 java_search_path="/neo/opt /usr/local /usr /usr/lib" 404 for path in $java_search_path; do 405 if test -d $path/java/j2sdk; then 406 java_path=$path/java/j2sdk 407 break 408 fi 409 if test -d $path/j2sdk; then 410 java_path=$path/j2sdk 411 break 412 fi 413 possible="$path/java/j2sdk*" 414 for pos_path in $possible; do 415 if test -d $pos_path; then 416 java_path=$pos_path 417 break 2 418 fi 419 done 420 possible="$path/j2sdk*" 421 for pos_path in $possible; do 422 if test -d $pos_path; then 423 java_path=$pos_path 424 break 2 425 fi 426 done 427 done 428 fi 429 if test "x$java_path" = "xno"; then 430 AC_MSG_RESULT(not found) 431 JAVA_PATH= 432 JAVA_INCLUDE_PATH= 433 else 434 AC_MSG_RESULT(found $java_path) 435 JAVA_PATH="$java_path" 436 JAVAC="$java_path/bin/javac" 437 _ACJNI_JAVAC=$JAVAC 438 AC_JNI_INCLUDE_DIR 439 for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS 440 do 441 JAVA_INCLUDE_PATH="$JAVA_INCLUDE_PATH -I$JNI_INCLUDE_DIR" 442 done 443 BUILD_WRAPPERS="$BUILD_WRAPPERS java-jni" 444 fi 445fi 446 447dnl Check for C# library/includes 448cs_cv_csharp=yes 449AC_ARG_ENABLE(csharp, [ --disable-csharp Disables building of csharp module], 450 [if test $enableval = no; then 451 cs_cv_csharp=no; 452 AC_MSG_RESULT(Disabling csharp module) 453 fi]) 454AC_ARG_WITH(csharp, [ --with-csharp=path Set location of csharp], [cs_cv_csharp_path="$withval"], [cs_cv_csharp_path=no]) 455if test $cs_cv_csharp = yes; then 456 AC_MSG_CHECKING(for csharp path) 457 csharp_path=no 458 if test $cs_cv_csharp_path != "no" -a -d $cs_cv_csharp_path; then 459 csharp_path=$cs_cv_csharp_path 460 else 461 csharp_search_path="/neo/opt /usr/local /usr" 462 for path in $csharp_search_path; do 463 if test -f $path/bin/mcs; then 464 csharp_path=$path 465 break 466 fi 467 done 468 fi 469 if test "x$csharp_path" = "xno"; then 470 AC_MSG_RESULT(not found) 471 CSHARP_PATH= 472 else 473 AC_MSG_RESULT(found $csharp_path/bin/mcs) 474 CSHARP_PATH="$csharp_path" 475 BUILD_WRAPPERS="$BUILD_WRAPPERS dso csharp" 476 fi 477fi 478 479AC_ARG_ENABLE(gettext, [ --enable-gettext Enables gettext message translation], 480 [if test $enableval = yes; then 481 dnl Check for gettext 482 AC_CHECK_FUNC(gettext, [ 483 cs_cv_libintl=no 484 AC_CHECK_HEADER(libintl.h, [cs_cv_libintl=yes]) 485 if test $cs_cv_libintl = yes; then 486 AC_DEFINE(ENABLE_GETTEXT) 487 AC_MSG_RESULT(Enabling gettext message translation) 488 else 489 AC_MSG_RESULT(not found) 490 fi 491 ]) 492 fi]) 493 494 495AC_SUBST(RANLIB) 496AC_SUBST(AR) 497AC_SUBST(USE_MINGW32) 498AC_SUBST(APXS_PATH) 499AC_SUBST(PERL) 500AC_SUBST(RUBY) 501AC_SUBST(BUILD_WRAPPERS) 502AC_SUBST(JAVA_PATH) 503AC_SUBST(JAVA_INCLUDE_PATH) 504AC_SUBST(PYTHON) 505AC_SUBST(PYTHON_INC) 506AC_SUBST(PYTHON_LIB) 507AC_SUBST(PYTHON_SITE) 508AC_SUBST(EXTRA_UTL_SRC) 509AC_SUBST(EXTRA_UTL_OBJS) 510AC_SUBST(CSHARP_PATH) 511 512AC_OUTPUT(rules.mk) 513