aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 63ce360e9ac55c64eefc5a5fe1ccc3a1fdaa5d57 (plain) (blame)
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
# ---------------------------------------------------------------------
# Initialisation
# ---------------------------------------------------------------------
AC_INIT(sword, 1.5.4, sword-bugs@crosswire.org)
AC_CONFIG_SRCDIR(sword.bmp)
AC_PREREQ(2.52)
AC_REVISION($Revision: 1.13 $)

AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(sword,1.5.4)

AM_CONFIG_HEADER(config.h)


# ---------------------------------------------------------------------
# Check Programs
# ---------------------------------------------------------------------
AC_LANG(C++)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL

AC_C_BIGENDIAN
# ---------------------------------------------------------------------
# Check libraries
# ---------------------------------------------------------------------
AC_CHECK_LIB(z, compress)
#AC_CHECK_LIB(stdc++, cerr)

# ---------------------------------------------------------------------
# With options
# ---------------------------------------------------------------------
AC_ARG_WITH(zlib,[  --with-zlib             allow zlib compressed modules [default=yes]],,with_zlib=yes)
AC_ARG_WITH(icu,[  --with-icu              use ICU for unicode [default=no]],,with_icu=no)
AC_ARG_WITH(conf,[  --with-conf             install a new sword.conf [default=yes]],,with_conf=yes)


# ---------------------------------------------------------------------
# Enable options
# ---------------------------------------------------------------------
AC_ARG_ENABLE(installmgr,[  --enable-installmgr     build install manager suport [default=yes]],,enable_installmgr=yes)
AC_ARG_ENABLE(debug,[  --enable-debug          build debug library [default=no]],,enable_debug=no)
AC_ARG_ENABLE(profile,[  --enable-profile        allow profiling [default=no]],,enable_profile=no)
AC_ARG_ENABLE(profilefn,[  --enable-profilefn      allow functioncheck profiling [default=no]],,enable_profilefn=no)
AM_MAINTAINER_MODE


# ---------------------------------------------------------------------
# Find ICU tools
# ---------------------------------------------------------------------
if test x$with_icu = xyes; then
	AC_PATH_PROG([PKGDATA], [pkgdata],[/usr/sbin/pkgdata],[$PATH:/usr/sbin:.])
	AC_PATH_PROG([GENCCODE], [genccode], [/usr/sbin/genccode], [$PATH:/usr/sbin:.])
	AC_PATH_PROG([GENCMN], [gencmn], [/usr/sbin/gencmn], [$PATH:/usr/sbin:.])
	AC_PATH_PROG([GENRB], [genrb], [/usr/sbin/genrb], [$PATH:/usr/sbin:.])
fi

# ---------------------------------------------------------------------
# Check for curl for installmgr suport
# ---------------------------------------------------------------------

CURL_CFLAGS=
CURL_LIBS=
if test x$enable_installmgr = xyes; then
	AC_PATH_PROG(CURL_CONFIG, curl-config, no)
	if test "$CURL_CONFIG" = "no" ; then
		echo "*** The curl-config script installed by curl could not be found"
		echo "*** compiling without install manager support"
		enable_installmgr=no
	else
		echo "curl found - install manager support ok"
		CURL_CFLAGS=`$CURL_CONFIG --cflags`
		CURL_LIBS=`$CURL_CONFIG --libs`
	fi
fi

# ---------------------------------------------------------------------
# Debug and profile
# ---------------------------------------------------------------------

CXXFLAGS="$CXXFLAGS -ftemplate-depth-25"

if test x$enable_debug = xyes; then
  if test x$ac_cv_prog_cc_g = xyes; then
    CFLAGS="-g -O0"
  else
    CFLAGS="-O0"
  fi
  if test x$ac_cv_prog_cxx_g = xyes; then
    CXXFLAGS="-g -O0"
  else
    CXXFLAGS="-O0"
  fi
  CFLAGS="$CFLAGS -Werror"
  CXXFLAGS="$CXXFLAGS -Werror"
fi
#  AC_DEFINE(DEBUG)
#else
#  AC_DEFINE(NDEBUG)
#fi

if test x$enable_profile = xyes; then
  CFLAGS="$CFLAGS -pg"
  CXXFLAGS="$CXXFLAGS -pg"
fi
if test x$enable_profilefn = xyes; then
  CFLAGS="$CFLAGS -g -finstrument-functions"
  CXXFLAGS="$CXXFLAGS -g -finstrument-functions"
  LIBS="$LIBS -g -finstrument-functions -lfnccheck"
fi

# ---------------------------------------------------------------------
# Alter global conf directory only if not /etc
# ---------------------------------------------------------------------

if test "x$sysconfdir" = "x/etc"; then
  dir_confdef="no"
else
  dir_confdef="yes"
fi


# ---------------------------------------------------------------------
# Determine target system (obsolete?)
# ---------------------------------------------------------------------
case "$target_cpu" in
  i?86)
    target_system="intel"
    ;;
  sparc)
	case "$target_os" in
  	solaris*)
    	target_system="sparc_solaris"
    	;;
  	*)
    	target_system="gnu_bigendian"
    	;;
	esac
    ;;
  *)
    target_system="$target_cpu"
    ;;
esac

case "$target_os" in
  beos)
    target_system="beos"
    ;;
  *)
    target_system="$target_system"
    ;;
esac

case "$target_os" in
  mingw*)
    target_mingw32="yes"
    ;;
  *)
    target_mingw32="no"
    ;;
esac

# ---------------------------------------------------------------------
# Substitute variables into makefiles
# ---------------------------------------------------------------------
AC_SUBST(with_zlib)
AC_SUBST(with_icu)
AC_SUBST(with_conf)
AC_SUBST(dir_confdef)
AC_SUBST(CC)
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LIBS)
AC_SUBST(enable_debug)
AC_SUBST(enable_profile)

AC_SUBST(target_cpu)
AC_SUBST(target_vendor)
AC_SUBST(target_os)

AC_SUBST(target_system)
AC_SUBST(target_mingw32)



# ---------------------------------------------------------------------
# Conditional variables
# ---------------------------------------------------------------------
AM_CONDITIONAL(MINGW, test x$target_mingw32 = xyes)
AM_CONDITIONAL(ICU, test x$with_icu = xyes)
AM_CONDITIONAL(ICUSWORD, test x$with_icu = xsword)
AM_CONDITIONAL(ZLIB, test x$with_zlib = xyes)
AM_CONDITIONAL(INSTCONF, test x$with_conf = xyes)
AM_CONDITIONAL(INSTALLMGR, test x$enable_installmgr = xyes)
AM_CONDITIONAL(CONFDEF, test x$dir_confdef = xyes)
#AM_CONDITIONAL(DEBUG, test x$with_debug = xyes)
#AM_CONDITIONAL(PROFILE, test x$with_profile = xyes)


# ---------------------------------------------------------------------
# Final output
# ---------------------------------------------------------------------
AC_CONFIG_FILES(Makefile lib/Makefile tests/Makefile utilities/Makefile examples/Makefile \
	examples/cmdline/Makefile apps/Makefile apps/console/Makefile \
	apps/console/diatheke/Makefile icu/Makefile)
AC_OUTPUT