summaryrefslogtreecommitdiff
path: root/configure.in
blob: e5c5acb63fd67f97e5c2bda5dce84fe69ceac084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
dnl Process this file with autoconf to produce a configure script.
AC_INIT(cgi/cgi.c)
AC_CONFIG_HEADER(cs_config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LN_S
AC_CHECK_PROGS(AR, ar aal, ar)
AC_PROG_RANLIB

AC_PROG_MAKE_SET
AC_PROG_INSTALL

dnl Checks for Neotonic Paths
AC_MSG_CHECKING(for Neotonic Paths)
if test -d /neo/opt/include; then
  AC_MSG_RESULT(found)
  CPPFLAGS="$CPPFLAGS -I/neo/opt/include"
  LDFLAGS="$LDFLAGS -L/neo/opt/lib"
else
  AC_MSG_RESULT(not found)
fi

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h stdarg.h varargs.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h features.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_FUNC_WAIT3
AC_CHECK_FUNCS(gettimeofday mktime putenv strerror strspn strtod strtol strtoul)
AC_CHECK_FUNCS(random rand drand48)

dnl Checks for libraries.
EXTRA_UTL_OBJS=
EXTRA_UTL_SRC=
cs_cv_wdb=no
AC_ARG_ENABLE(apache, [  --disable-wdb Disables building of wdb],
  [if test $enableval = no; then
     AC_MSG_RESULT(Disabling wdb code)
   else
     AC_SEARCH_LIBS(db_open, db db2, [cs_cv_wdb=yes])
     if test $cs_cv_wdb = yes; then
       AC_DEFINE(HAVE_DB2)
       EXTRA_UTL_SRC="$EXTRA_UTL_SRC wdb.c"
     fi
   fi])

dnl Check for locks
AC_CHECK_FUNC(lockf, [
  AC_DEFINE(HAVE_LOCKF)
  EXTRA_UTL_SRC="$EXTRA_UTL_SRC ulocks.c rcfs.c"

  cs_cv_pthread=no
  AC_CHECK_HEADER(pthread.h, [cs_cv_pthread=yes])
  if test $cs_cv_pthread = yes; then
    AC_DEFINE(HAVE_PTHREADS)
    EXTRA_UTL_SRC="$EXTRA_UTL_SRC skiplist.c dict.c"
  fi
])

AC_MINGW32()
if test "x$MINGW32" = "xyes"; then
  CPPFLAGS="$CPPFLAGS -D__WINDOWS_GCC__"
  USE_MINGW32="USE_MINGW32 = 1"
else
  EXTRA_UTL_SRC="$EXTRA_UTL_SRC filter.c neo_net.c neo_server.c"
fi

dnl Check for snprintf and vsnprintf
cs_cv_snprintf=no
SNPRINTFOBJS=""
AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)], [cs_cv_snprintf=yes])
AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)], [cs_cv_snprintf=yes])
if test $cs_cv_snprintf = yes; then
  EXTRA_UTL_OBJS="$EXTRA_UTL_OBJS snprintf.o"
fi


dnl Check for missing re-entrant functions
cs_cv_missing=no
cs_cv_need_reentrant=no
dnl copied from libcurl
AC_CHECK_FUNCS(localtime_r, [
  AC_MSG_CHECKING(whether localtime_r is declared)
  AC_EGREP_CPP(localtime_r,[
#include <time.h>],[
    AC_DEFINE(HAVE_LOCALTIME_R)
    AC_MSG_RESULT(yes)],[
    AC_MSG_RESULT(no)
    AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
    AC_EGREP_CPP(localtime_r,[
#define _REENTRANT
#include <time.h>],[
      cs_cv_need_reentrant=yes
      AC_MSG_RESULT(yes)],[
      cs_cv_missing=yes
      AC_MSG_RESULT(no)])])], [cs_cv_missing=yes])

AC_CHECK_FUNCS(gmtime_r, [
  AC_MSG_CHECKING(whether gmtime_r is declared)
  AC_EGREP_CPP(gmtime_r,[
#include <time.h>],[
    AC_DEFINE(HAVE_GMTIME_R)
    AC_MSG_RESULT(yes)],[
    AC_MSG_RESULT(no)
    AC_MSG_CHECKING(whether gmtime_r with -D_REENTRANT is declared)
    AC_EGREP_CPP(gmtime_r,[
#define _REENTRANT
#include <time.h>],[
      cs_cv_need_reentrant=yes
      AC_MSG_RESULT(yes)],[
      cs_cv_missing=yes
      AC_MSG_RESULT(no)])])], [cs_cv_missing=yes])

AC_CHECK_FUNCS(strtok_r, [
  AC_MSG_CHECKING(whether strtok_r is declared)
  AC_EGREP_CPP(strtok_r,[
#include <string.h>],[
    AC_DEFINE(HAVE_STRTOK_R)
    AC_MSG_RESULT(yes)],[
    AC_MSG_RESULT(no)
    AC_MSG_CHECKING(whether strtok_r with -D_REENTRANT is declared)
    AC_EGREP_CPP(strtok_r,[
#define _REENTRANT
#include <string.h>],[
      cs_cv_need_reentrant=yes
      AC_MSG_RESULT(yes)],[
      cs_cv_missing=yes
      AC_MSG_RESULT(no)])])], [cs_cv_missing=yes])

AC_CHECK_FUNC(mkstemp, [AC_DEFINE(HAVE_MKSTEMP)], [cs_cv_missing=yes])
if test $cs_cv_missing = yes; then
  EXTRA_UTL_OBJS="$EXTRA_UTL_OBJS missing.o"
fi
if test $cs_cv_need_reentrant = yes; then
  CPPFLAGS="$CPPFLAGS -D_REENTRANT"
fi

cs_cv_regex=yes
AC_CHECK_FUNC(regexec, [AC_DEFINE(HAVE_REGEX)], [cs_cv_regex=no])
if test $cs_cv_regex = no; then
  CPPFLAGS="$CPPFLAGS -I\$(NEOTONIC_ROOT)/util/regex"
  EXTRA_UTL_SRC="$EXTRA_UTL_SRC regex/regex.c"
fi

cs_cv_compression=yes
AC_CHECK_LIB(z, deflate, [cs_cv_compression=yes], [cs_cv_compression=no])
AC_ARG_ENABLE(compression, [  --disable-compression		Disables HTML Compression support],
  [if test $enableval = no; then
     cs_cv_compression=no;
     AC_MSG_RESULT(Disabling HTML Compression support)
   fi])

if test $cs_cv_compression = yes; then
  AC_DEFINE(HTML_COMPRESSION)
  LIBS="$LIBS -lz"
fi

AC_ARG_ENABLE(remote-debugger, [  --enable-remote-debugger	Enables remote X CGI debugging],
  [if test $enableval = yes; then
     AC_DEFINE(ENABLE_REMOTE_DEBUG)
     AC_MSG_RESULT(Enabling CGI X Remote debugger)
   fi])

dnl Check for Apache apxs
cs_cv_apache=yes
AC_ARG_ENABLE(apache, [  --disable-apache		Disables building of apache 1.3.x module],
  [if test $enableval = no; then
     cs_cv_apache=no;
     AC_MSG_RESULT(Disabling Apache 1.3.x Module)
   fi])
AC_ARG_WITH(apache, [  --with-apache=path		Set location of Apache installation], [cs_cv_apache_path="$withval"], [cs_cv_apache_path=])

if test $cs_cv_apache = yes; then
  AC_MSG_CHECKING(for apache apxs)
  apxs_path=no
  apache_search_path="$cs_cv_apache_path /neo/opt /usr/local /usr"
  for path in $apache_search_path; do
    if test -x $path/httpd/bin/apxs; then
      apxs_path=$path/httpd/bin/apxs
      httpd_path=$path/httpd/bin/httpd
      break
    fi
    if test -x $path/httpd/sbin/apxs; then
      apxs_path=$path/httpd/sbin/apxs
      httpd_path=$path/httpd/sbin/httpd
      break
    fi
    if test -x $path/bin/apxs; then
      apxs_path=$path/bin/apxs
      httpd_path=$path/bin/httpd
      break
    fi
    if test -x $path/sbin/apxs; then
      apxs_path=$path/sbin/apxs
      httpd_path=$path/sbin/httpd
      break
    fi
  done
  if test "x$apxs_path" = "xno"; then
    AC_MSG_RESULT(not found)
  else
    AC_MSG_RESULT(found $apxs_path)
    AC_MSG_CHECKING(for apache 1.3.x)
    changequote(<<, >>)dnl
    apache_version="`$httpd_path -v | grep 'Server version' | sed -e 's/.*Apache\/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/'`"
    apache_major_version=`echo $apache_version | sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
    apache_minor_version=`echo $apache_version | sed -e 's/.*\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
    changequote([, ])dnl
    if test "$apache_major_version" = "1" -a "$apache_minor_version" = "3"; then
      AC_MSG_RESULT(found $apache_version)
      APXS_PATH="$apxs_path"
      BUILD_WRAPPERS="$BUILD_WRAPPERS mod_ecs"
    else
      AC_MSG_RESULT(found $apache_version - disabling module build)
    fi
  fi
fi

dnl Check for Python library/includes
cs_cv_python=yes
AC_ARG_ENABLE(python, [  --disable-python		Disables building of python module],
  [if test $enableval = no; then
     cs_cv_python=no;
     AC_MSG_RESULT(Disabling python module)
   fi])
AC_ARG_WITH(python, [  --with-python=path		Set location of Python Interpreter], [cs_cv_python_path="$withval"], [cs_cv_python_path=no])

if test $cs_cv_python = yes; then
  AC_MSG_CHECKING(for python includes)
  python_inc=no
  python_lib=no
  python_search_path="/neo/opt /usr/local /usr /c"
  python_versions="2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
  if test $cs_cv_python_path != "no" -a -x $cs_cv_python_path; then
    python_bin=$cs_cv_python_path
    vers=`$python_bin -c "import sys; print sys.version[[:3]]"`
    py_inst_dir=`$python_bin -c "import sys; print sys.exec_prefix"`
    python_inc=$py_inst_dir/include/python$vers
    python_lib="-L$py_inst_dir/lib/python$vers/config -lpython$vers"
    python_site=$py_inst_dir/lib/python$vers/site-packages
  else
    for vers in $python_versions; do
      for path in $python_search_path; do
        if test -x $path/bin/python$vers; then
	  python_bin=$path/bin/python$vers
	  major_vers=`echo $vers | cut -b 1`
	  if test $major_vers -ge 2; then
	      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]])"`
	  else
	      python_base=`$python_bin -c "import site, os; print os.path.dirname(site.sitedirs[[0]])"`
	  fi
	  if test -d $python_base; then
	      python_lib="-L$python_base/config -lpython$vers"
	      python_site=$python_base/site-packages
	  fi
	fi
	if test -f $path/include/python$vers/Python.h; then
	  python_inc=$path/include/python$vers
        fi
	if test "x$python_lib" = "xno"; then
	    if test -d $path/lib/python$vers; then
	      python_lib="-L$path/lib/python$vers/config -lpython$vers"
	      python_site=$path/lib/python$vers/site-packages
	    fi
	    if test -d $path/lib64/python$vers; then
	      python_lib="-L$path/lib64/python$vers/config -lpython$vers"
	      python_site=$path/lib64/python$vers/site-packages
	    fi
	fi
	dnl This is currently special cased mostly for Windows
	dnl installs, but we only use python_lib for windows anyways
	if test -f $path/python$vers/include/Python.h; then
	  python_inc=$path/python$vers/include
	  python_lib="-L$path/python$vers/libs -lpython$vers"
	  python_site=$path/python$vers/Lib/site-packages
	  break 2
	fi
	if test "x$python_inc" != "xno" -a "x$python_lib" != "xno"; then
	  break 2
	fi
      done
    done
  fi
  if test "x$python_inc" = "xno"; then
    AC_MSG_RESULT(not found)
    PYTHON=
    PYTHON_INC=
    PYTHON_LIB=
    PYTHON_SITE=
  else
    AC_MSG_RESULT(found $python_inc)
    PYTHON=$python_bin
    PYTHON_INC="-I$python_inc"
    PYTHON_LIB=$python_lib
    if test "x$PYTHON_SITE" = "x"; then
	PYTHON_SITE=$python_site
    fi
    BUILD_WRAPPERS="$BUILD_WRAPPERS python"
  fi
fi

dnl Check for Perl binary
cs_cv_perl=yes
AC_ARG_ENABLE(perl, [  --disable-perl		Disables building of perl module],
  [if test $enableval = no; then
     cs_cv_perl=no;
     AC_MSG_RESULT(Disabling perl module)
   fi])
AC_ARG_WITH(perl, [  --with-perl=path		Set location of Perl binary], [cs_cv_perl_path="$withval"], [cs_cv_perl_path=no])

if test $cs_cv_perl = yes; then
  AC_MSG_CHECKING(for perl >= 5.006)
  perl_path=no
  perl_search_path="/neo/opt /usr/local /usr"
  if test $cs_cv_perl_path != "no" -a -x $cs_cv_perl_path; then
    perl_path=$cs_cv_perl_path
  else
    for path in $perl_search_path; do
      if test -x $path/bin/perl; then
	require_error=`$path/bin/perl -e 'require 5.006' 2>&1`
	if test "x$require_error" = "x"; then
	  perl_path=$path/bin/perl
	  break
	fi
      fi
    done
  fi
  if test "x$perl_path" = "xno"; then
    AC_MSG_RESULT(not found)
    PERL=
  else
    AC_MSG_RESULT(found $perl_path)
    PERL="$perl_path"
    BUILD_WRAPPERS="$BUILD_WRAPPERS perl"
  fi
fi

dnl Check for Ruby binary
cs_cv_ruby=yes
AC_ARG_ENABLE(ruby, [  --disable-ruby		Disables building of ruby module],
  [if test $enableval = no; then
     cs_cv_ruby=no;
     AC_MSG_RESULT(Disabling ruby module)
   fi])
AC_ARG_WITH(ruby, [  --with-ruby=path		Set location of Ruby binary], [cs_cv_ruby_path="$withval"], [cs_cv_ruby_path=no])

if test $cs_cv_ruby = yes; then
  AC_MSG_CHECKING(for ruby)
  ruby_path=no
  ruby_search_path="/neo/opt /usr/local /usr"
  if test $cs_cv_ruby_path != "no" -a -x $cs_cv_ruby_path; then
    ruby_path=$cs_cv_ruby_path
  else
    for path in $ruby_search_path; do
      if test -x $path/bin/ruby; then
	ruby_path=$path/bin/ruby
	break
      fi
    done
  fi
  if test "x$ruby_path" = "xno"; then
    AC_MSG_RESULT(not found)
    RUBY=
  else
    AC_MSG_RESULT(found $ruby_path)
    RUBY="$ruby_path"
    BUILD_WRAPPERS="$BUILD_WRAPPERS ruby"
  fi
fi

dnl Check for Java library/includes
cs_cv_java=yes
AC_ARG_ENABLE(java, [  --disable-java		Disables building of java module],
  [if test $enableval = no; then
     cs_cv_java=no;
     AC_MSG_RESULT(Disabling java module)
   fi])
AC_ARG_WITH(java, [  --with-java=path		Set location of J2SDK], [cs_cv_java_path="$withval"], [cs_cv_java_path=no])

if test $cs_cv_java = yes; then
  AC_MSG_CHECKING(for j2sdk path)
  java_path=no
  if test $cs_cv_java_path != "no" -a -d $cs_cv_java_path; then
    java_path=$cs_cv_java_path
  else
    java_search_path="/neo/opt /usr/local /usr /usr/lib"
    for path in $java_search_path; do
      if test -d $path/java/j2sdk; then
	java_path=$path/java/j2sdk
	break
      fi
      if test -d $path/j2sdk; then
	java_path=$path/j2sdk
	break
      fi
      possible="$path/java/j2sdk*"
      for pos_path in $possible; do
	if test -d $pos_path; then
	  java_path=$pos_path
	  break 2
	fi
      done
      possible="$path/j2sdk*"
      for pos_path in $possible; do
	if test -d $pos_path; then
	  java_path=$pos_path
	  break 2
	fi
      done
    done
  fi
  if test "x$java_path" = "xno"; then
    AC_MSG_RESULT(not found)
    JAVA_PATH=
    JAVA_INCLUDE_PATH=
  else
    AC_MSG_RESULT(found $java_path)
    JAVA_PATH="$java_path"
    JAVAC="$java_path/bin/javac"
    _ACJNI_JAVAC=$JAVAC
    AC_JNI_INCLUDE_DIR
    for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
    do
	JAVA_INCLUDE_PATH="$JAVA_INCLUDE_PATH -I$JNI_INCLUDE_DIR"
    done
    BUILD_WRAPPERS="$BUILD_WRAPPERS java-jni"
  fi
fi

dnl Check for C# library/includes
cs_cv_csharp=yes
AC_ARG_ENABLE(csharp, [  --disable-csharp	Disables building of csharp module],
  [if test $enableval = no; then
     cs_cv_csharp=no;
     AC_MSG_RESULT(Disabling csharp module)
   fi])
AC_ARG_WITH(csharp, [  --with-csharp=path	Set location of csharp], [cs_cv_csharp_path="$withval"], [cs_cv_csharp_path=no])
if test $cs_cv_csharp = yes; then
  AC_MSG_CHECKING(for csharp path)
  csharp_path=no
  if test $cs_cv_csharp_path != "no" -a -d $cs_cv_csharp_path; then
    csharp_path=$cs_cv_csharp_path
  else
    csharp_search_path="/neo/opt /usr/local /usr"
    for path in $csharp_search_path; do
      if test -f $path/bin/mcs; then
	csharp_path=$path
	break
      fi
    done
  fi
  if test "x$csharp_path" = "xno"; then
    AC_MSG_RESULT(not found)
    CSHARP_PATH=
  else
    AC_MSG_RESULT(found $csharp_path/bin/mcs)
    CSHARP_PATH="$csharp_path"
    BUILD_WRAPPERS="$BUILD_WRAPPERS dso csharp"
  fi
fi

AC_ARG_ENABLE(gettext, [  --enable-gettext	Enables gettext message translation],
  [if test $enableval = yes; then
     dnl Check for gettext
     AC_CHECK_FUNC(gettext, [
       cs_cv_libintl=no
       AC_CHECK_HEADER(libintl.h, [cs_cv_libintl=yes])
       if test $cs_cv_libintl = yes; then
         AC_DEFINE(ENABLE_GETTEXT)
         AC_MSG_RESULT(Enabling gettext message translation)
       else
         AC_MSG_RESULT(not found)
       fi
     ])
   fi])


AC_SUBST(RANLIB)
AC_SUBST(AR)
AC_SUBST(USE_MINGW32)
AC_SUBST(APXS_PATH)
AC_SUBST(PERL)
AC_SUBST(RUBY)
AC_SUBST(BUILD_WRAPPERS)
AC_SUBST(JAVA_PATH)
AC_SUBST(JAVA_INCLUDE_PATH)
AC_SUBST(PYTHON)
AC_SUBST(PYTHON_INC)
AC_SUBST(PYTHON_LIB)
AC_SUBST(PYTHON_SITE)
AC_SUBST(EXTRA_UTL_SRC)
AC_SUBST(EXTRA_UTL_OBJS)
AC_SUBST(CSHARP_PATH)

AC_OUTPUT(rules.mk)