summaryrefslogtreecommitdiff
path: root/0.8/src/configure.ac
blob: 1a11ae8ff73b27bc2a915d3ffe57e88b89b6b2e3 (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
dnl configure.ac Cypyright (2005, 2006, 2007) by the yChat Project

AC_INIT(main.cpp, [], [ychat at dev dot buetow dot org])
AC_CONFIG_HEADER(config.h)
AC_PROG_CXX
AC_PREFIX_DEFAULT(/usr/local)

AC_ARG_ENABLE(readline, AC_HELP_STRING([--disable-readline], [Disables readline support (default=yes)]), [], enable_readline=yes)
AC_ARG_ENABLE(readline, AC_HELP_STRING([--disable-readline], [Disables readline support (default=yes)]))
AC_ARG_ENABLE(ssl, AC_HELP_STRING([--enable-ssl], [Enable OpenSSL support (default=no)]))
AC_ARG_ENABLE(mysqlclient, AC_HELP_STRING([--enable-mysql], [Enable MySQL support (default=no)]))

header_error() AC_MSG_ERROR([Could not find required header, please check the installation of the required header])
lib_error() AC_MSG_ERROR([Library test failed, please check the installation of the required library])

echo "===> Checking for dependencies"

AC_CHECK_HEADERS(dlfcn.h netinet/in.h time.h pthread.h event.h, [], [header_error])
AC_CHECK_LIB(pthread, pthread_create, [], [lib_error])
AC_CHECK_LIB(event, event_init, [], [lib_error])

echo -n "===> Configuring with SSL "
if test -z $enable_ssl || test $enable_ssl != "yes"; then
  echo disabled
else
  echo enabled
  AC_CHECK_HEADERS(openssl/ssl.h, [], [header_error])
  AC_CHECK_LIB(ssl, SSL_write, [], [lib_error])
fi

echo -n "===> Configuring with MySQL "
if test -z $enable_mysql || test $enable_mysql != "yes"; then
  echo disabled
else
  echo enabled
  AC_CHECK_HEADERS(mysql/mysql.h, [], [header_error])
  AC_CHECK_LIB(mysqlclient, mysql_init, [], [lib_error])
fi

echo -n "===> Configuring with readline "
if test -z $enable_readline || test $enable_readline != "yes"; then
  echo disabled
else
  echo enabled
  AC_CHECK_HEADERS(readline/readline.h, [], [header_error])
  AC_CHECK_LIB(readline, readline, [], [lib_error])
fi

echo "===> Checking for find with extended regexp "

AC_SUBST([efind])
if find -E ./configure >/dev/null; then
 efind='find -E'
else
 efind='find -regextype posix-extended'
fi

if test `uname` = "Linux"; then 
  echo "===> Configuring with -ldl (Linux)"
  AC_CHECK_LIB(dl, dlopen, [], [lib_error])
fi


AC_OUTPUT(Makefile)
AC_OUTPUT(../Makefile)

echo "===> Posttasking Makefile"

SRCS=`find ./ -type f -name '*.cpp' | grep -v ./mods`
OBJS=''

echo > .Makefile || exit 1
echo > .Makefile.deps || exit 1

for src in $SRCS; do
  obj=`echo $src | sed 's/\(.*\)\.cpp/\.\.\/obj\/\1\.o/'`
  OBJS="$OBJS $obj"
  echo "$obj: $src" >> .Makefile.deps
done 
  
echo SRCS=$SRCS >> .Makefile.tmp
echo OBJS=$OBJS >> .Makefile.tmp
cat Makefile >> .Makefile.tmp
cat .Makefile.deps >> .Makefile.tmp
mv -f .Makefile.tmp Makefile || exit 1
rm -f .Makefile.deps

echo "===> Posttasking config.h"
cat << END >> config.h

/* Posttasking has been done by ./src/configure.
   Please edit ./src/configure.ac and run autoconf if you
   want to modify all values below this comment!
 */

/* Program prefix. */
#define PREFIX "$prefix"
END 

echo You are ready to run GNU Make now!