1AC_INIT([medusa], [2.2])
2AC_CONFIG_SRCDIR([src/medusa.c])
3AM_CONFIG_HEADER(config.h)
4
5dnl Detect the canonical host and target build environment
6AC_CANONICAL_HOST
7AC_CANONICAL_TARGET
8
9AM_INIT_AUTOMAKE([subdir-objects])
10
11AC_LANG([C])
12AC_PROG_CC
13
14AC_HEADER_STDC
15
16AC_CHECK_SIZEOF(int,cross)
17AC_CHECK_SIZEOF(long,cross)
18AC_CHECK_SIZEOF(long long,cross)
19AC_CHECK_SIZEOF(short,cross)
20
21CFLAGS="${CFLAGS=}"
22AC_MSG_CHECKING(whether to enable debugging)
23debug_default="yes"
24AC_ARG_ENABLE(debug, [  --enable-debug=[no/yes] turn on debugging (default=yes)],, enable_debug=$debug_default)
25if test "x$enable_debug" = "xyes"; then
26  CPPFLAGS="$CPPFLAGS -g -DDEBUG"
27  AC_MSG_RESULT(yes)
28else
29  AC_MSG_RESULT(no)
30fi
31
32AC_ARG_WITH(postgresql, AS_HELP_STRING([--with-postgresql=prefix],[Prefix for postgresql include directory (default = /usr)]), [postgresql_prefix="$withval"], [postgresql_prefix="/usr"])
33AC_ARG_WITH(afpfsng, AS_HELP_STRING([--with-afpfsng=prefix],[Prefix for afpfs-ng include directory (default = /usr)]), [afpfsng_prefix="$withval"], [afpfsng_prefix="/usr"])
34
35dnl FreeBSD was not looking in /usr/local...
36dnl AC_SEARCH_LIBS ?
37if test -d "/usr/local/lib"
38  then LDFLAGS="$LDFLAGS -L/usr/local/lib"
39fi
40
41CPPFLAGS="$CPPFLAGS -fPIC"
42CPPFLAGS="$CPPFLAGS -I/usr/include -I/usr/local/include -I${postgresql_prefix}/include/postgresql -I${postgresql_prefix}/include/pgsql -I${afpfsng_prefix}/include/afpfs-ng"
43
44AS_MESSAGE([checking for pthread support...])
45AC_CHECK_LIB(pthread, main, [], [AC_MSG_ERROR([ *** Application requires pthread support *** ])])
46
47AS_MESSAGE([checking for dlopen/dlclose...])
48AC_CHECK_LIB(dl, dlclose,
49  [],
50  [AC_CHECK_LIB(c, dlclose,
51    [],
52    [AC_MSG_ERROR([ *** Application requires dlopen/dlclose (e.g. libdl) *** ])])
53  ]
54)
55
56dnl MacPorts
57if test -d "/opt/local"; then
58  CPPFLAGS="$CPPFLAGS -I/opt/local/include"
59  LDFLAGS="$LDFLAGS -L/opt/local/lib"
60fi
61
62dnl Mac OS X doesn't have clock_gettime()
63AC_SEARCH_LIBS(clock_gettime, [rt])
64AC_CHECK_FUNCS(clock_gettime, [], [AC_MSG_WARN([ No clock_gettime(), using gettimeofday() instead ])])
65
66dnl ********** OpenSSL Checks **********
67check_libssl="false"
68
69AS_MESSAGE([checking for OpenSSL Library and Header files...])
70
71check_ssl_dir() { :
72  AC_MSG_CHECKING([$1/include/openssl/ssh.h])
73  if test -f "$1/include/openssl/ssl.h"
74  then
75    AC_MSG_RESULT([found])
76    CPPFLAGS="$CPPFLAGS -I$1/include"
77    LDFLAGS="$LDFLAGS -L$1/lib"
78    return 0
79  else
80    AC_MSG_RESULT([not found])
81    return 1
82  fi
83}
84
85AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl=prefix],[Prefix for OpenSSL libraries]),
86  [check_ssl_dir "$withval"],
87  [
88    for main_dir in /usr /usr/local /usr/lib /usr/pkg /opt/local /usr/local/opt /opt; do
89      for sub_dir in / /ssl /openssl; do
90        check_ssl_dir "$main_dir$sub_dir" && break 2
91      done
92    done
93  ]
94)
95
96AC_CHECK_LIB(crypto, CRYPTO_lock, [], [AC_MSG_WARN([ *** LibCrypto may be required for *BSD ***])])
97AC_CHECK_HEADER([openssl/ssl.h],
98  [AC_CHECK_LIB(ssl, main,
99    [AC_DEFINE(HAVE_LIBSSL, 1, [Found OpenSSL Library]) LIBS="$LIBS -lssl -lcrypto" check_libssl="true"],
100    [AC_MSG_WARN([ *** OpenSSL library required for SSL support. ***
101
102      Many of the Medusa modules depend on the OpenSSL library and header files. If
103      multiple modules are unexpectedly disabled, this is likely the cause. Make sure
104      to install libssl-dev, openssl-devel or whatever package your distribution uses
105      to distribute these files.
106
107      If the headers are installed in a non-standard location, specify the path with
108      "--with-ssl".
109
110    ])]
111  )],
112  [AC_MSG_WARN([ *** OpenSSL header files required for SSL support. ***
113
114    Many of the Medusa modules depend on the OpenSSL library and header files. If
115    multiple modules are unexpectedly disabled, this is likely the cause. Make sure
116    to install libssl-dev, openssl-devel or whatever package your distribution uses
117    to distribute these files.
118
119    If the headers are installed in a non-standard location, specify the path with
120    "--with-ssl".
121
122  ])]
123)
124
125AC_MSG_NOTICE([*** Checking module dependencies and enabling accordingly ***])
126
127dnl ********** AFP Medusa Module Option Checks **********
128check_module_afp="false"
129
130AS_MESSAGE([checking for AFPFS-NG Library and Header files...])
131AC_CHECK_HEADER([afpfs-ng/afp_protocol.h],
132  [AC_CHECK_LIB(afpclient, main,
133    [AC_DEFINE(HAVE_LIBAFPFS, 1, [Found AFPFS-NG Library]) MODULE_LIBS="$MODULE_LIBS -lafpclient" check_module_afp="true"],
134    [AC_MSG_WARN([ *** AFPFS-NG library required for AFP module. ***
135
136      The AFPFS-NG package must be installed for the AFP module to function. This includes
137      both the library and header files. AFPFS-NG is available at the following site:
138      http://alexthepuffin.googlepages.com/. The AFP module will NOT be built.
139
140    ])]
141  )],
142  [AC_MSG_WARN([ *** AFPFS-NG header files required for AFP module. ***
143
144    The AFPFS-NG package must be installed for the AFP module to function. This includes
145    both the library and header files. AFPFS-NG is available at the following site:
146    http://alexthepuffin.googlepages.com/. The AFP module will NOT be built.
147
148  ])]
149)
150
151AC_MSG_CHECKING(whether to enable AFP module)
152AC_ARG_ENABLE(module-afp,
153              [  --enable-module-afp=[no/yes]            Enable AFP module (default=no)],
154              [case "${enableval}" in
155                yes) enable_module_afp=true ;;
156                no)  enable_module_afp=false ;;
157                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-afp]) ;;
158              esac],
159              [enable_module_afp=$check_module_afp])
160
161AM_CONDITIONAL(BUILD_MODULE_AFP, test x"$enable_module_afp" = "xtrue")
162if test x"$enable_module_afp" = "xtrue"; then
163  AC_MSG_RESULT(yes)
164else
165  AC_MSG_RESULT(no)
166fi
167
168dnl ********** CVS Medusa Module Option Checks **********
169AC_MSG_CHECKING(whether to enable CVS module)
170AC_ARG_ENABLE(module-cvs,
171              [  --enable-module-cvs=[no/yes]            Enable CVS module (default=yes)],
172              [case "${enableval}" in
173                yes) enable_module_cvs=true ;;
174                no)  enable_module_cvs=false ;;
175                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-cvs]) ;;
176              esac],
177              [enable_module_cvs="true"])
178
179AM_CONDITIONAL(BUILD_MODULE_CVS, test x"$enable_module_cvs" = "xtrue")
180if test x"$enable_module_cvs" = "xtrue"; then
181  AC_MSG_RESULT(yes)
182else
183  AC_MSG_RESULT(no)
184fi
185
186dnl ********** FTP Medusa Module **********
187AC_MSG_CHECKING(whether to enable FTP module)
188AC_ARG_ENABLE(module-ftp,
189              [  --enable-module-ftp=[no/yes]            Enable FTP module (default=yes)],
190              [case "${enableval}" in
191                yes) enable_module_ftp=true ;;
192                no)  enable_module_ftp=false ;;
193                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-ftp]) ;;
194              esac],
195              [enable_module_ftp="true"])
196
197AM_CONDITIONAL(BUILD_MODULE_FTP, test x"$enable_module_ftp" = "xtrue")
198if test x"$enable_module_ftp" = "xtrue"; then
199  AC_MSG_RESULT(yes)
200else
201  AC_MSG_RESULT(no)
202fi
203
204dnl ********** HTTP Medusa Module **********
205check_module_http=$check_libssl
206
207AC_MSG_CHECKING(whether to enable HTTP module)
208AC_ARG_ENABLE(module-http,
209              [  --enable-module-http=[no/yes]           Enable HTTP module (default=yes)],
210              [case "${enableval}" in
211                yes) enable_module_http=true ;;
212                no)  enable_module_http=false ;;
213                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-http]) ;;
214              esac],
215              [enable_module_http=$check_module_http])
216
217AM_CONDITIONAL(BUILD_MODULE_HTTP, test x"$enable_module_http" = "xtrue")
218if test x"$enable_module_http" = "xtrue"; then
219  AC_MSG_RESULT(yes)
220else
221  AC_MSG_RESULT(no)
222fi
223
224dnl ********** IMAP Medusa Module **********
225AC_MSG_CHECKING(whether to enable IMAP module)
226AC_ARG_ENABLE(module-imap,
227              [  --enable-module-imap=[no/yes]           Enable IMAP module (default=yes)],
228              [case "${enableval}" in
229                yes) enable_module_imap=true ;;
230                no)  enable_module_imap=false ;;
231                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-imap]) ;;
232              esac],
233              [enable_module_imap="true"])
234
235AM_CONDITIONAL(BUILD_MODULE_IMAP, test x"$enable_module_imap" = "xtrue")
236if test x"$enable_module_imap" = "xtrue"; then
237  AC_MSG_RESULT(yes)
238else
239  AC_MSG_RESULT(no)
240fi
241
242dnl ********** MSSQL Medusa Module **********
243check_module_mssql=$check_libssl
244
245AC_MSG_CHECKING(whether to enable MSSQL module)
246AC_ARG_ENABLE(module-mssql,
247              [  --enable-module-mssql=[no/yes]          Enable MSSQL module (default=yes)],
248              [case "${enableval}" in
249                yes) enable_module_mssql=true ;;
250                no)  enable_module_mssql=false ;;
251                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-mssql]) ;;
252              esac],
253              [enable_module_mssql=$check_module_mssql])
254
255AM_CONDITIONAL(BUILD_MODULE_MSSQL, test x"$enable_module_mssql" = "xtrue")
256if test x"$enable_module_mssql" = "xtrue"; then
257  AC_MSG_RESULT(yes)
258else
259  AC_MSG_RESULT(no)
260fi
261
262dnl ********** MYSQL Medusa Module **********
263AC_MSG_CHECKING(whether to enable MYSQL module)
264AC_ARG_ENABLE(module-mysql,
265              [  --enable-module-mysql=[no/yes]          Enable MYSQL module (default=yes)],
266              [case "${enableval}" in
267                yes) enable_module_mysql=true ;;
268                no)  enable_module_mysql=false ;;
269                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-mysql]) ;;
270              esac],
271              [enable_module_mysql="true"])
272
273AM_CONDITIONAL(BUILD_MODULE_MYSQL, test x"$enable_module_mysql" = "xtrue")
274if test x"$enable_module_mysql" = "xtrue"; then
275  AC_MSG_RESULT(yes)
276else
277  AC_MSG_RESULT(no)
278fi
279
280dnl ********** NCP Medusa Module **********
281check_module_ncp="false"
282
283AS_MESSAGE([checking for NCPFS Library and Header files...])
284AC_CHECK_HEADER([ncp/nwcalls.h],
285  [AC_CHECK_LIB(ncp, main,
286    [AC_DEFINE(HAVE_LIBNCP, 1, [Found NCP Library]) MODULE_LIBS="$MODULE_LIBS -lncp" check_module_ncp="true"],
287    [AC_MSG_WARN([ *** NCPFS library required for NCP module. ***
288
289      The NCPFS package must be installed for the NCP module to function. This includes
290      both the library and header files. If your distribution does not include these
291      files or offer a ncpfs-devel package, the files can be manually installed using
292      "make install-dev" within the NCPFS source. The NCP module will NOT be built.
293
294    ])]
295  )],
296  [AC_MSG_WARN([ *** NCPFS header files required for NCP module. ***
297
298    The NCPFS package must be installed for the NCP module to function. This includes
299    both the library and header files. If your distribution does not include these
300    files or offer a ncpfs-devel package, the files can be manually installed using
301    "make install-dev" within the NCPFS source. The NCP module will NOT be built.
302
303  ])]
304)
305
306AC_MSG_CHECKING(whether to enable NCP module)
307AC_ARG_ENABLE(module-ncp,
308              [  --enable-module-ncp=[no/yes]            Enable NCP module (default=yes)],
309              [case "${enableval}" in
310                yes) enable_module_ncp=true ;;
311                no)  enable_module_ncp=false ;;
312                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-ncp]) ;;
313              esac],
314              [enable_module_ncp=$check_module_ncp])
315
316AM_CONDITIONAL(BUILD_MODULE_NCP, test x"$enable_module_ncp" = "xtrue")
317if test x"$enable_module_ncp" = "xtrue"; then
318  AC_MSG_RESULT(yes)
319else
320  AC_MSG_RESULT(no)
321fi
322
323dnl ********** NNTP Medusa Module **********
324AC_MSG_CHECKING(whether to enable NNTP module)
325AC_ARG_ENABLE(module-nntp,
326              [  --enable-module-nntp=[no/yes]           Enable NNTP module (default=yes)],
327              [case "${enableval}" in
328                yes) enable_module_nntp=true ;;
329                no)  enable_module_nntp=false ;;
330                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-nntp]) ;;
331              esac],
332              [enable_module_nntp="true"])
333
334AM_CONDITIONAL(BUILD_MODULE_NNTP, test x"$enable_module_nntp" = "xtrue")
335if test x"$enable_module_nntp" = "xtrue"; then
336  AC_MSG_RESULT(yes)
337else
338  AC_MSG_RESULT(no)
339fi
340
341dnl ********** PCANYWHERE Medusa Module **********
342AC_MSG_CHECKING(whether to enable PCANYWHERE module)
343AC_ARG_ENABLE(module-pcanywhere,
344              [  --enable-module-pcanywhere=[no/yes]     Enable PCANYWHERE module (default=yes)],
345              [case "${enableval}" in
346                yes) enable_module_pcanywhere=true ;;
347                no)  enable_module_pcanywhere=false ;;
348                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-pcanywhere]) ;;
349              esac],
350              [enable_module_pcanywhere="true"])
351
352AM_CONDITIONAL(BUILD_MODULE_PCANYWHERE, test x"$enable_module_pcanywhere" = "xtrue")
353if test x"$enable_module_pcanywhere" = "xtrue"; then
354  AC_MSG_RESULT(yes)
355else
356  AC_MSG_RESULT(no)
357fi
358
359dnl ********** POP3 Medusa Module **********
360AC_MSG_CHECKING(whether to enable POP3 module)
361AC_ARG_ENABLE(module-pop3,
362              [  --enable-module-pop3=[no/yes]           Enable POP3 module (default=yes)],
363              [case "${enableval}" in
364                yes) enable_module_pop3=true ;;
365                no)  enable_module_pop3=false ;;
366                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-pop3]) ;;
367              esac],
368              [enable_module_pop3="true"])
369
370AM_CONDITIONAL(BUILD_MODULE_POP3, test x"$enable_module_pop3" = "xtrue")
371if test x"$enable_module_pop3" = "xtrue"; then
372  AC_MSG_RESULT(yes)
373else
374  AC_MSG_RESULT(no)
375fi
376
377dnl ********** POSTGRES Medusa Module **********
378check_module_postgres="false"
379
380AS_MESSAGE([checking for PostgreSQL Library and Header files...])
381AC_CHECK_HEADER([libpq-fe.h],
382  [AC_CHECK_LIB(pq, main,
383    [AC_DEFINE(HAVE_LIBPQ, 1, [Found PostgreSQL Library]) MODULE_LIBS="$MODULE_LIBS -lpq" check_module_postgres="true"],
384    [AC_MSG_WARN([ *** LIBPQ library required for PostgreSQL module. ***
385
386      The PostgreSQL package must be installed for the PostgreSQL module to function. This
387      includes both the library and header files. Your distribution may offer a package
388      such as libpq-devel or postgresql-devel, which will provide these files.
389
390    ])]
391  )],
392  [AC_MSG_WARN([ *** LIBPQ header files required for PostgreSQL module. ***
393
394      The PostgreSQL package must be installed for PostgreSQL module to function. This
395      includes both the library and header files. Your distribution may offer a package
396      such as libpq-devel or postgresql-devel, which will provide these files.
397
398  ])]
399)
400
401AC_MSG_CHECKING(whether to enable POSTGRES module)
402AC_ARG_ENABLE(module-postgres,
403              [  --enable-module-postgres=[no/yes]       Enable POSTGRES module (default=yes)],
404              [case "${enableval}" in
405                yes) enable_module_postgres=true ;;
406                no)  enable_module_postgres=false ;;
407                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-postgres]) ;;
408              esac],
409              [enable_module_postgres=$check_module_postgres])
410
411AM_CONDITIONAL(BUILD_MODULE_POSTGRES, test x"$enable_module_postgres" = "xtrue")
412if test x"$enable_module_postgres" = "xtrue"; then
413  AC_MSG_RESULT(yes)
414else
415  AC_MSG_RESULT(no)
416fi
417
418dnl ********** RDP Medusa Module **********
419check_module_rdp="false"
420module_rdp_headers="false"
421
422dnl https://ci.freerdp.com - Nightly FreeRDP master builds
423if test -d "/opt/freerdp-nightly"; then
424  CPPFLAGS="$CPPFLAGS -I/opt/freerdp-nightly/include"
425  LDFLAGS="$LDFLAGS -L/opt/freerdp-nightly/lib"
426fi
427
428case "$target" in
429  *apple-darwin*)
430    LDFLAGS="$LDFLAGS -L/usr/local/lib/freerdp"
431    RDP_LIBS="-lfreerdp -lwinpr -lfreerdp-client -laudin-client -ldisp-client -lecho-client -lrdpei-client -lrdpgfx-client -ltsmf-client -lcliprdr-client -ldrdynvc-client -lencomsp-client -lrail-client -lrdpdr-client -lrdpsnd-client -lremdesk-client -ldrive-client -lparallel-client -lserial-client -lsmartcard-client"
432    ;;
433  *)
434    ;;
435esac
436MODULE_LIBS="$MODULE_LIBS $RDP_LIBS"
437
438AS_MESSAGE([checking for FreeRDP Library and Header files...])
439module_rdp_headers="false"
440
441AC_CHECK_HEADER([freerdp/freerdp.h], [module_rdp_headers="true"],
442  [
443    AC_MSG_WARN([ *** FreeRDP header files required for RDP module. ***
444
445        The FreeRDP package must be installed for RDP module to function. This
446        includes both the library and header files. Your distribution may offer
447        packages such as freerdp and libfreerdp-dev, which will provide these files.
448
449    ])
450  ]
451)
452
453if test x"$module_rdp_headers" = "xtrue"; then
454  AC_MSG_NOTICE([ *** Checking for FreeRDP libraries. *** ])
455  AC_CHECK_LIB(winpr, main, [], [])
456  AC_CHECK_LIB(freerdp, main, [], [])
457  AC_CHECK_LIB(freerdp-channels, main, [], [])
458  AC_CHECK_LIB(freerdp-client, main, [], [])
459  AC_CHECK_LIB(freerdp-core, main, [], [])
460  AC_CHECK_LIB(freerdp-gdi, main, [], [])
461
462  AS_MESSAGE([checking for FreeRDP library version 1.2...])
463  AC_SEARCH_LIBS(WLog_CallbackAppender_SetCallbacks, winpr,
464    [
465      AC_DEFINE(HAVE_LIBFREERDP12, 1, [Found FreeRDP Library (version >= 1.2)])
466      AC_MSG_NOTICE([ *** Detected FreeRDP library version 1.2. *** ])
467      check_module_rdp="true"
468    ],
469    [],
470    [$MODULE_LIBS $RDP_LIBS]
471  )
472
473  if test x"$check_module_rdp" = "xfalse"; then
474    AS_MESSAGE([checking for FreeRDP library version 1.1 (with pass-the-hash)...])
475    AC_SEARCH_LIBS(nego_set_restricted_admin_mode_required, freerdp-client,
476      [
477        AC_DEFINE(HAVE_LIBFREERDP11PTH, 1, [Found FreeRDP Library (version 1.1 PTH)])
478        AC_MSG_NOTICE([ *** Detected FreeRDP library version 1.1 (with pass-the-hash). *** ])
479        check_module_rdp="true"
480      ],
481      [],
482      [$MODULE_LIBS $RDP_LIBS]
483    )
484  fi
485
486  if test x"$check_module_rdp" = "xfalse"; then
487    AS_MESSAGE([checking for FreeRDP library version 1.1...])
488    AC_CHECK_LIB(freerdp-client, main,
489      [
490        AC_DEFINE(HAVE_LIBFREERDP11, 1, [Found FreeRDP Library (version 1.1)])
491        AC_MSG_WARN([ *** Detected FreeRDP library version 1.1. ***
492
493            FreeRDP introduced pass-the-hash support with version 1.2. The version
494            detected on this system is prior to that release. The RDP module will
495            function, but the pass-the-hash option will be disabled.
496
497        ])
498        check_module_rdp="true"
499      ],
500      []
501    )
502  fi
503
504  if test x"$check_module_rdp" = "xfalse"; then
505    AS_MESSAGE([checking for FreeRDP library version 1.0...])
506    AC_CHECK_LIB(freerdp-core, main,
507      [
508        AC_DEFINE(HAVE_LIBFREERDP10, 1, [Found FreeRDP Library (version 1.0)])
509        AC_MSG_WARN([ *** Detected FreeRDP library version 1.0. ***
510
511            FreeRDP introduced pass-the-hash support with version 1.2. The version
512            detected on this system is prior to that release. The RDP module will
513            function, but the pass-the-hash option will be disabled.
514
515            It should also be noted that FreeRDP 1.0 prints all error messages
516            to stdout. Medusa is unable to suppress these, which can lead to
517            extraneous information being displayed.
518
519        ])
520        check_module_rdp="true"
521      ],
522      [
523        AC_MSG_WARN([ *** FreeRDP library required for RDP module. ***
524
525            The FreeRDP package must be installed for the RDP module to function. This
526            includes both the library and header files. Your distribution may offer
527            packages such as freerdp and libfreerdp-dev, which will provide these files.
528
529        ])
530      ]
531    )
532  fi
533fi
534
535case "$target" in
536  *apple-darwin*)
537    AS_MESSAGE([RDP module is currently broken on OS X and disabled by default.])
538    check_module_rdp="false"
539    ;;
540esac
541
542AC_MSG_CHECKING(whether to enable RDP module)
543AC_ARG_ENABLE(module-rdp,
544              [  --enable-module-rdp=[no/yes]            Enable RDP module (default=yes)],
545              [case "${enableval}" in
546                yes) enable_module_rdp=true ;;
547                no)  enable_module_rdp=false ;;
548                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-rdp]) ;;
549              esac],
550              [enable_module_rdp=$check_module_rdp])
551
552AM_CONDITIONAL(BUILD_MODULE_RDP, test x"$enable_module_rdp" = "xtrue")
553if test x"$enable_module_rdp" = "xtrue"; then
554  AC_MSG_RESULT(yes)
555else
556  AC_MSG_RESULT(no)
557fi
558
559dnl ********** REXEC Medusa Module **********
560AC_MSG_CHECKING(whether to enable REXEC module)
561AC_ARG_ENABLE(module-rexec,
562              [  --enable-module-rexec=[no/yes]          Enable REXEC module (default=yes)],
563              [case "${enableval}" in
564                yes) enable_module_rexec=true ;;
565                no)  enable_module_rexec=false ;;
566                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-rexec]) ;;
567              esac],
568              [enable_module_rexec="true"])
569
570AM_CONDITIONAL(BUILD_MODULE_REXEC, test x"$enable_module_rexec" = "xtrue")
571if test x"$enable_module_rexec" = "xtrue"; then
572  AC_MSG_RESULT(yes)
573else
574  AC_MSG_RESULT(no)
575fi
576
577dnl ********** RLOGIN Medusa Module **********
578AC_MSG_CHECKING(whether to enable RLOGIN module)
579AC_ARG_ENABLE(module-rlogin,
580              [  --enable-module-rlogin=[no/yes]         Enable RLOGIN module (default=yes)],
581              [case "${enableval}" in
582                yes) enable_module_rlogin=true ;;
583                no)  enable_module_rlogin=false ;;
584                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-rlogin]) ;;
585              esac],
586              [enable_module_rlogin="true"])
587
588AM_CONDITIONAL(BUILD_MODULE_RLOGIN, test x"$enable_module_rlogin" = "xtrue")
589if test x"$enable_module_rlogin" = "xtrue"; then
590  AC_MSG_RESULT(yes)
591else
592  AC_MSG_RESULT(no)
593fi
594
595dnl ********** RSH Medusa Module **********
596AC_MSG_CHECKING(whether to enable RSH module)
597AC_ARG_ENABLE(module-rsh,
598              [  --enable-module-rsh=[no/yes]            Enable RSH module (default=yes)],
599              [case "${enableval}" in
600                yes) enable_module_rsh=true ;;
601                no)  enable_module_rsh=false ;;
602                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-rsh]) ;;
603              esac],
604              [enable_module_rsh="true"])
605
606AM_CONDITIONAL(BUILD_MODULE_RSH, test x"$enable_module_rsh" = "xtrue")
607if test x"$enable_module_rsh" = "xtrue"; then
608  AC_MSG_RESULT(yes)
609else
610  AC_MSG_RESULT(no)
611fi
612
613dnl ********** SMBNT Medusa Module **********
614check_module_smbnt=$check_libssl
615
616AC_MSG_CHECKING(whether to enable SMBNT module)
617AC_ARG_ENABLE(module-smbnt,
618              [  --enable-module-smbnt=[no/yes]          Enable SMBNT module (default=yes)],
619              [case "${enableval}" in
620                yes) enable_module_smbnt=true ;;
621                no)  enable_module_smbnt=false ;;
622                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-smbnt]) ;;
623              esac],
624              [enable_module_smbnt=$check_module_smbnt])
625
626AM_CONDITIONAL(BUILD_MODULE_SMBNT, test x"$enable_module_smbnt" = "xtrue")
627if test x"$enable_module_smbnt" = "xtrue"; then
628  AC_MSG_RESULT(yes)
629else
630  AC_MSG_RESULT(no)
631fi
632
633dnl ********** SMTP Medusa Module **********
634AC_MSG_CHECKING(whether to enable SMTP module)
635AC_ARG_ENABLE(module-smtp,
636              [  --enable-module-smtp=[no/yes]           Enable SMTP module (default=yes)],
637              [case "${enableval}" in
638                yes) enable_module_smtp=true ;;
639                no)  enable_module_smtp=false ;;
640                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-smtp]) ;;
641              esac],
642              [enable_module_smtp="true"])
643
644AM_CONDITIONAL(BUILD_MODULE_SMTP, test x"$enable_module_smtp" = "xtrue")
645if test x"$enable_module_smtp" = "xtrue"; then
646  AC_MSG_RESULT(yes)
647else
648  AC_MSG_RESULT(no)
649fi
650
651dnl ********** SMTP-VRFY Medusa Module **********
652AC_MSG_CHECKING(whether to enable SMTP-VRFY module)
653AC_ARG_ENABLE(module-smtp-vrfy,
654              [  --enable-module-smtp-vrfy=[no/yes]      Enable SMTP-VRFY module (default=yes)],
655              [case "${enableval}" in
656                yes) enable_module_smtp_vrfy=true ;;
657                no)  enable_module_smtp_vrfy=false ;;
658                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-smtp-vrfy]) ;;
659              esac],
660              [enable_module_smtp_vrfy="true"])
661
662AM_CONDITIONAL(BUILD_MODULE_SMTP_VRFY, test x"$enable_module_smtp_vrfy" = "xtrue")
663if test x"$enable_module_smtp_vrfy" = "xtrue"; then
664  AC_MSG_RESULT(yes)
665else
666  AC_MSG_RESULT(no)
667fi
668
669dnl ********** SNMP Medusa Module **********
670AC_MSG_CHECKING(whether to enable SNMP module)
671AC_ARG_ENABLE(module-snmp,
672              [  --enable-module-snmp=[no/yes]           Enable SNMP module (default=yes)],
673              [case "${enableval}" in
674                yes) enable_module_snmp=true ;;
675                no)  enable_module_snmp=false ;;
676                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-snmp]) ;;
677              esac],
678              [enable_module_snmp="true"])
679
680AM_CONDITIONAL(BUILD_MODULE_SNMP, test x"$enable_module_snmp" = "xtrue")
681if test x"$enable_module_snmp" = "xtrue"; then
682  AC_MSG_RESULT(yes)
683else
684  AC_MSG_RESULT(no)
685fi
686
687dnl ********** SSH Medusa Module **********
688check_module_ssh="false"
689
690AS_MESSAGE([checking for Libssh2 Library files...])
691AC_CHECK_LIB(ssh2, main,
692             [AC_DEFINE(HAVE_LIBSSH2, 1, [Found SSH2 Library]) MODULE_LIBS="$MODULE_LIBS -lssh2" check_module_ssh="true"],
693             [AC_MSG_WARN([ *** Libssh2 required for SSH2 module. ***
694
695  Libssh2 (http://www.libssh2.org) is not the same as libssh (http://0xbadc0de.be).
696  Make sure you have the correct library. The SSH2 module will NOT be built.
697
698  ])]
699)
700
701dnl Test whether libssh2 was built with libgcrypt
702if test x"$check_module_ssh" = "xtrue"; then
703  check_libgcrypt="false"
704
705  if test -f "/usr/lib/libssh2.so"; then
706    LIBSSH2_PATH="/usr/lib/libssh2.so"
707  elif test -f "/usr/local/lib/libssh2.so"; then
708    LIBSSH2_PATH="/usr/local/lib/libssh2.so"
709  elif test -f "/usr/lib/x86_64-linux-gnu/libssh2.so"; then
710    LIBSSH2_PATH="/usr/lib/x86_64-linux-gnu/libssh2.so"
711  elif test -f "/opt/local/lib/libssh2.dylib"; then
712    LIBSSH2_PATH="/opt/local/lib/libssh2.dylib"
713  elif test -f "/usr/local/lib/libssh2.dylib"; then
714    LIBSSH2_PATH="/usr/local/lib/libssh2.dylib"
715  else
716    AC_MSG_WARN([ LIBSSH2 path not found. Assuming it was... ])
717  fi
718
719  dnl Use otool on Mac OS X
720  if test -f "`which ldd`"; then
721    LDD="ldd"
722  elif test -f "`which otool`"; then
723    LDD="otool -L"
724  else
725    AC_MSG_WARN([ No ldd detected. Unable to test whether Libssh2 was compiled to use libgcrypt. Assuming it was... ])
726    check_libgcrypt="true"
727  fi
728
729  if test ! -z "`$LDD $LIBSSH2_PATH |grep libgcrypt`"; then
730    AC_MSG_WARN([ Libssh2 compiled using libgcrypt. Checking additional dependencies. ])
731    check_libgcrypt="true"
732  fi
733
734 if test x"$check_libgcrypt" = "xtrue"; then
735    AS_MESSAGE([checking for Libgrcypt Library files...])
736    AC_CHECK_LIB(gcrypt, gcry_control,
737                 [AC_DEFINE(HAVE_LIBGCRYPT, 1, [Found Libgcrypt Library]) LIBS="$LIBS -lgcrypt"],
738                 [AC_MSG_WARN([ *** Libgcrypt required for installed version of Libssh2 ***
739
740        The default build of Libssh2 is to use OpenSSL for crypto. Several Linux
741        distributions (e.g. Debian, Ubuntu) build it to use Libgcrypt. In order to
742        use libssh2 in a thread-safe manner, we need to link to Libgcrypt and
743        properly initialize it.
744
745        Make sure you have the Libgcrypt/GnuTLS libraries and headers (e.g. libgcrypt11-dev).
746        The SSH2 module will NOT be built.
747
748      ])
749      check_module_ssh="false"
750    ])
751
752    AS_MESSAGE([checking for GnuTLS Library files...])
753    AC_CHECK_LIB(gnutls, gnutls_handshake,
754                 [AC_DEFINE(HAVE_GNUTLS, 1, [Found GnuTLS Library]) LIBS="$LIBS -lgnutls"],
755                 [AC_MSG_WARN([ *** GnuTLS required for installed version of Libssh2 ***
756
757        The default build of Libssh2 is to use OpenSSL for crypto. Several Linux
758        distributions (e.g. Debian, Ubuntu) build it to use Libgcrypt. In order to
759        use libssh2 in a thread-safe manner, we need to link to Libgcrypt and
760        properly initialize it.
761
762        Make sure you have the Libgcrypt/GnuTLS libraries and headers (e.g. libgnutls-dev).
763        The SSH2 module will NOT be built.
764
765      ])
766      check_module_ssh="false"
767    ])
768  fi
769fi
770
771AC_MSG_CHECKING(whether to enable SSH module)
772AC_ARG_ENABLE(module-ssh,
773              [  --enable-module-ssh=[no/yes]            Enable SSH module (default=yes)],
774              [case "${enableval}" in
775                yes) enable_module_ssh=true ;;
776                no)  enable_module_ssh=false ;;
777                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-ssh]) ;;
778              esac],
779              [enable_module_ssh=$check_module_ssh])
780
781AM_CONDITIONAL(BUILD_MODULE_SSH, test x"$enable_module_ssh" = "xtrue")
782if test x"$enable_module_ssh" = "xtrue"; then
783  AC_MSG_RESULT(yes)
784else
785  AC_MSG_RESULT(no)
786fi
787
788dnl ********** SVN Medusa Module **********
789check_module_svn="false"
790
791AS_MESSAGE([checking for Subversion Library and Header files...])
792AC_PATH_PROG(APR_CONFIG, apr-1-config)
793if test -z "$APR_CONFIG"; then
794  AC_PATH_PROG(APR_CONFIG, apr-config)
795  if test -z "$APR_CONFIG"; then
796    AC_MSG_WARN([ *** apr-config/apr-1-config not found and required for SVN module ***
797
798      Make sure to install libapr1-dev or whatever package your distribution uses
799      to distribute this file.
800
801    ])
802  fi
803fi
804
805if test -n "$APR_CONFIG"; then
806
807  if test x`$APR_CONFIG --cc` = "xcc"; then
808    AC_MSG_WARN([ *** Apache (apr) was compiled using Sun C compiler and not GNU gcc. ***
809
810    "$APR_CONFIG --cc" responded with "cc", which usually means that your build of Apache
811    was compiled with Sun C compiler and not with gcc. This means that the version of libtool
812    embedded within Apache installation is also configured for Sun C compiler and not gcc.
813    The Sun C compiler setup is incompatible because the options to each compiler are
814    different for building shared objects and libraries. Specifically, the Sun compiler
815    supports the "-mt" flag, whereas gcc does not. In order to build the SVN Medusa
816    module, rebuild $APR_CONFIG using gcc, or remove the "-mt" CPPFLAGS flag from the
817    autogenerated Medusa configuration files.
818
819    ])
820  else
821    APR_INCLUDE_DIR=`$APR_CONFIG --includedir`
822    AC_SUBST(APR_INCLUDE_DIR)
823    CPPFLAGS="$CPPFLAGS `$APR_CONFIG --includes --cppflags`"
824
825    AC_CHECK_HEADER([$APR_INCLUDE_DIR/apr_tables.h],
826      [AC_CHECK_HEADER([subversion-1/svn_client.h],
827        [AC_CHECK_LIB(svn_client-1, main,
828          [AC_DEFINE(HAVE_LIBSVN_CLIENT_1, 1, [Found SVN Library]) MODULE_LIBS="$MODULE_LIBS -lsvn_client-1" check_module_svn="true"],
829          [AC_MSG_WARN([ *** Subversion libsvn library required for SVN module. *** ])]
830        )],
831        [AC_MSG_WARN([ *** Subversion header files required for SVN module. (e.g., libsvn-dev) *** ])])],
832      [AC_MSG_WARN([ *** APR header files required for SVN module. (e.g., libapr1-dev) *** ])]
833    )
834  fi
835else
836  check_module_svn="false"
837fi
838
839if test x"$check_module_svn" = "xtrue"; then
840  AC_CHECK_LIB(svn_client-1, svn_client_list3,
841    [AC_DEFINE(HAVE_SVN_CLIENT_LIST3, 1, [Found SVN Library version 1.8 or greater])],
842    [AC_MSG_WARN([Found SVN Library older than version 1.8])]
843  )
844fi
845
846
847AC_MSG_CHECKING(whether to enable SVN module)
848AC_ARG_ENABLE(module-svn,
849              [  --enable-module-svn=[no/yes]            Enable SVN module (default=yes)],
850              [case "${enableval}" in
851                yes) enable_module_svn=true ;;
852                no)  enable_module_svn=false ;;
853                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-svn]) ;;
854              esac],
855              [enable_module_svn=$check_module_svn])
856
857AM_CONDITIONAL(BUILD_MODULE_SVN, test x"$enable_module_svn" = "xtrue")
858if test x"$enable_module_svn" = "xtrue"; then
859  AC_MSG_RESULT(yes)
860else
861  AC_MSG_RESULT(no)
862fi
863
864dnl ********** TELNET Medusa Module **********
865AC_MSG_CHECKING(whether to enable TELNET module)
866AC_ARG_ENABLE(module-telnet,
867              [  --enable-module-telnet=[no/yes]         Enable TELNET module (default=yes)],
868              [case "${enableval}" in
869                yes) enable_module_telnet=true ;;
870                no)  enable_module_telnet=false ;;
871                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-telnet]) ;;
872              esac],
873              [enable_module_telnet="true"])
874
875AM_CONDITIONAL(BUILD_MODULE_TELNET, test x"$enable_module_telnet" = "xtrue")
876if test x"$enable_module_telnet" = "xtrue"; then
877  AC_MSG_RESULT(yes)
878else
879  AC_MSG_RESULT(no)
880fi
881
882dnl ********** VMAUTHD Medusa Module **********
883AC_MSG_CHECKING(whether to enable VMAUTHD module)
884AC_ARG_ENABLE(module-vmauthd,
885              [  --enable-module-vmauthd=[no/yes]        Enable VMAUTHD module (default=yes)],
886              [case "${enableval}" in
887                yes) enable_module_vmauthd=true ;;
888                no)  enable_module_vmauthd=false ;;
889                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-vmauthd]) ;;
890              esac],
891              [enable_module_vmauthd="true"])
892
893AM_CONDITIONAL(BUILD_MODULE_VMAUTHD, test x"$enable_module_vmauthd" = "xtrue")
894if test x"$enable_module_vmauthd" = "xtrue"; then
895  AC_MSG_RESULT(yes)
896else
897  AC_MSG_RESULT(no)
898fi
899
900dnl ********** VNC Medusa Module **********
901check_module_vnc=$check_libssl
902
903AC_MSG_CHECKING(whether to enable VNC module)
904AC_ARG_ENABLE(module-vnc,
905              [  --enable-module-vnc=[no/yes]            Enable VNC module (default=yes)],
906              [case "${enableval}" in
907                yes) enable_module_vnc=true ;;
908                no)  enable_module_vnc=false ;;
909                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-vnc]) ;;
910              esac],
911              [enable_module_vnc=$check_module_vnc])
912
913AM_CONDITIONAL(BUILD_MODULE_VNC, test x"$enable_module_vnc" = "xtrue")
914if test x"$enable_module_vnc" = "xtrue"; then
915  AC_MSG_RESULT(yes)
916else
917  AC_MSG_RESULT(no)
918fi
919
920dnl ********** WRAPPER Medusa Module **********
921AC_MSG_CHECKING(whether to enable WRAPPER module)
922AC_ARG_ENABLE(module-wrapper,
923              [  --enable-module-wrapper=[no/yes]        Enable WRAPPER module (default=yes)],
924              [case "${enableval}" in
925                yes) enable_module_wrapper=true ;;
926                no)  enable_module_wrapper=false ;;
927                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-wrapper]) ;;
928              esac],
929              [enable_module_wrapper="true"])
930
931AM_CONDITIONAL(BUILD_MODULE_WRAPPER, test x"$enable_module_wrapper" = "xtrue")
932if test x"$enable_module_wrapper" = "xtrue"; then
933  AC_MSG_RESULT(yes)
934else
935  AC_MSG_RESULT(no)
936fi
937
938dnl ********** Web Form Medusa Module **********
939check_module_web_form=$check_libssl
940
941AC_MSG_CHECKING(whether to enable WEB-FORM module)
942AC_ARG_ENABLE(module-web-form,
943              [  --enable-module-web-form=[no/yes]       Enable WEB-FORM module (default=yes)],
944              [case "${enableval}" in
945                yes) enable_module_web_form=true ;;
946                no)  enable_module_web_form=false ;;
947                *)   AC_MSG_ERROR([bad value ${enableval} for --enable-module-web-form]) ;;
948              esac],
949              [enable_module_web_form=$check_module_web_form])
950
951AM_CONDITIONAL(BUILD_MODULE_WEB_FORM, test x"$enable_module_web_form" = "xtrue")
952if test x"$enable_module_web_form" = "xtrue"; then
953  AC_MSG_RESULT(yes)
954else
955  AC_MSG_RESULT(no)
956fi
957
958AC_MSG_NOTICE([])
959AC_MSG_NOTICE([*******************************************************])
960AC_MSG_NOTICE([    Medusa Module Build Summary])
961AC_MSG_NOTICE([])
962
963show_build_status()
964{
965  if test "$1" = "true" ; then
966    AC_MSG_NOTICE([$2 Enabled])
967  else
968    AC_MSG_NOTICE([$2 ** Disabled **])
969  fi
970}
971
972show_build_status "${enable_module_afp}"        "    AFP            "
973show_build_status "${enable_module_cvs}"        "    CVS            "
974show_build_status "${enable_module_ftp}"        "    FTP            "
975show_build_status "${enable_module_http}"       "    HTTP           "
976show_build_status "${enable_module_imap}"       "    IMAP           "
977show_build_status "${enable_module_mssql}"      "    MSSQL          "
978show_build_status "${enable_module_mysql}"      "    MYSQL          "
979show_build_status "${enable_module_ncp}"        "    NCP            "
980show_build_status "${enable_module_nntp}"       "    NNTP           "
981show_build_status "${enable_module_pcanywhere}" "    PCANYWHERE     "
982show_build_status "${enable_module_pop3}"       "    POP3           "
983show_build_status "${enable_module_postgres}"   "    POSTGRES       "
984show_build_status "${enable_module_rdp}"        "    RDP            "
985show_build_status "${enable_module_rexec}"      "    REXEC          "
986show_build_status "${enable_module_rlogin}"     "    RLOGIN         "
987show_build_status "${enable_module_rsh}"        "    RSH            "
988show_build_status "${enable_module_smbnt}"      "    SMBNT          "
989show_build_status "${enable_module_smtp}"       "    SMTP           "
990show_build_status "${enable_module_smtp_vrfy}"  "    SMTP-VRFY      "
991show_build_status "${enable_module_snmp}"       "    SNMP           "
992show_build_status "${enable_module_ssh}"        "    SSH            "
993show_build_status "${enable_module_svn}"        "    SVN            "
994show_build_status "${enable_module_telnet}"     "    TELNET         "
995show_build_status "${enable_module_vmauthd}"    "    VMAUTHD        "
996show_build_status "${enable_module_vnc}"        "    VNC            "
997show_build_status "${enable_module_wrapper}"    "    WRAPPER        "
998show_build_status "${enable_module_web_form}"   "    WEB-FORM       "
999
1000AC_MSG_NOTICE([])
1001AC_MSG_NOTICE([ If a module is unexpectedly marked as disabled, check ])
1002AC_MSG_NOTICE([ above output and verify dependancies were satisfied. ])
1003AC_MSG_NOTICE([])
1004AC_MSG_NOTICE([ It should also be noted that, by default, not all of ])
1005AC_MSG_NOTICE([ the modules are built. Incomplete modules or modules ])
1006AC_MSG_NOTICE([ which have not been sufficiently tested may be ])
1007AC_MSG_NOTICE([ disabled. To enable non-default modules, use the ])
1008AC_MSG_NOTICE([ "--enable-module-MODULE_NAME" configure option.])
1009AC_MSG_NOTICE([*******************************************************])
1010AC_MSG_NOTICE([])
1011
1012AC_CHECK_FUNCS(strcasestr)
1013AC_CHECK_FUNCS(asprintf)
1014AC_CHECK_FUNCS(vasprintf)
1015
1016dnl -lm --> mysql/floor(), http/log()
1017dnl -lrt --> clock_gettime()
1018
1019case "$target" in
1020  *linux*)
1021    LIBDL="-ldl -lrt -lm"
1022    RDYNAMIC="-rdynamic"
1023    MODULE_LIBS="$MODULE_LIBS -shared"
1024    EXTRA_LDFLAGS=""
1025    ;;
1026  *freebsd*)
1027    LIBDL="-lm"
1028    RDYNAMIC="-rdynamic"
1029    MODULE_LIBS="$MODULE_LIBS -shared"
1030    EXTRA_LDFLAGS=""
1031    ;;
1032  *netbsd*)
1033    LIBDL="-lm"
1034    RDYNAMIC="-rdynamic"
1035    MODULE_LIBS="$MODULE_LIBS -shared"
1036    EXTRA_LDFLAGS=""
1037    ;;
1038  *openbsd*)
1039    LIBDL="-lm"
1040    RDYNAMIC="-rdynamic"
1041    MODULE_LIBS="$MODULE_LIBS -shared"
1042    EXTRA_LDFLAGS="-g -Wl,-E"
1043    ;;
1044  *apple-darwin*)
1045    # Modules will segfault when executed (show usage works) if medusa core
1046    # is not linked to CoreFoundation (starting with 10.6). This is believed to
1047    # be due to libsvn linking to CoreFoundation and our modules linked via
1048    # "-lsvn_client-1". See http://www.openradar.me/7209349 for more info.
1049    LIBDL="-ldl -framework CoreFoundation"
1050    # OS X Lion marked OpenSSL as deprecated. We're disabling these warnings
1051    # for now. We'll need to figure out if it's worth supporting Common Crypto
1052    # or simply requiring users to install their own OpenSSL in the future.
1053    CFLAGS="$CFLAGS -Wno-deprecated-declarations"
1054    RDYNAMIC=""
1055    MODULE_LIBS="$MODULE_LIBS -bundle -flat_namespace -undefined suppress"
1056    EXTRA_LDFLAGS=""
1057    ;;
1058  *solaris*)
1059    CPPFLAGS="$CPPFLAGS -D_REENTRANT"
1060    LDFLAGS="$LDFLAGS -R/usr/local/lib -R/usr/local/ssl/lib -L/usr/local/ssl/lib"
1061    LIBDL="-ldl -lm -lrt -lnsl -lsocket"
1062    RDYNAMIC="-Rdynamic"
1063    EXTRA_LDFLAGS=""
1064    MODULE_LIBS="$MODULE_LIBS -G"
1065    ;;
1066  *cygwin*)
1067    CPPFLAGS="$CPPFLAGS -DCYGWIN"
1068    LIBDL="-ldl"
1069    RDYNAMIC=""
1070    MODULE_LIBS="$MODULE_LIBS -shared"
1071    ;;
1072  *)
1073    LIBDL="-ldl -lm"
1074    RDYNAMIC="-rdynamic"
1075    MODULE_LIBS="$MODULE_LIBS -shared"
1076    EXTRA_LDFLAGS=""
1077    ;;
1078esac
1079
1080AC_SUBST([MODULE_LIBS])
1081LDFLAGS="$LDFLAGS $RDYNAMIC $EXTRA_LDFLAGS"
1082LIBS="$LIBS $LIBDL"
1083
1084test "$prefix" = NONE && prefix=${ac_default_prefix}
1085_default_mod_path="${prefix}/lib/medusa/modules"
1086AC_ARG_WITH(default-mod-path, AS_HELP_STRING([--with-default-mod-path=path],[Location of medusa module files (default = /usr/local/lib/medusa/modules)]),[_default_mod_path="$withval"])
1087AC_DEFINE_UNQUOTED(DEFAULT_MOD_PATH, "$_default_mod_path", [Location of medusa module files])
1088AC_SUBST(DEFAULT_MOD_PATH)
1089
1090AC_CONFIG_FILES([Makefile src/Makefile src/modsrc/Makefile])
1091AC_OUTPUT
1092