File: configure.in

package info (click to toggle)
webdruid 0.5.4-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,224 kB
  • ctags: 806
  • sloc: ansic: 10,823; sh: 2,752; makefile: 162
file content (228 lines) | stat: -rw-r--r-- 7,503 bytes parent folder | download | duplicates (8)
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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT
AC_CONFIG_SRCDIR([webdruid.c])
AC_CONFIG_HEADER([config.h])

#dnl default language (don't change!)
#DEFAULT_LANG="english"
#AC_SUBST(DEFAULT_LANG)
OPTS=${DEFS}
AC_SUBST(OPTS)

dnl Checks for programs.
IN_CFLAGS=${CFLAGS}
AC_PROG_CC
AC_PROG_LN_S
AC_PROG_INSTALL
AC_C_CHAR_UNSIGNED

dnl force our own CFLAGS defaults
if test "$GCC" = "yes"; then

  AC_ARG_ENABLE(static,--enable-static           Build as static executable,
  LDFLAGS="--static ${LDFLAGS}")

  if test "$IN_CFLAGS" = ""; then
     CFLAGS="-Wall -O2"
  fi
  if test "$ac_cv_c_char_unsigned" = "yes"; then
     CFLAGS="-fsigned-char ${CFLAGS}"
  fi

  AC_ARG_ENABLE(debug,--enable-debug            Compile with debugging code,
  CFLAGS="-g ${CFLAGS}")

else
  if test "$IN_CFLAGS" = ""; then
     CFLAGS="-g"
  fi
fi

AC_ARG_WITH(gdlib,--with-gdlib=DIR          Where to additionally look for libgd.a,
EXTRA_GDLIB="${withval}", EXTRA_GDLIB="")
AC_ARG_WITH(gd,--with-gd=DIR             Where to additionally look for gd headers,
EXTRA_GD="${withval}"; CFLAGS="-I${withval} ${CFLAGS}", EXTRA_GD="")

AC_ARG_WITH(z-inc,--with-z-inc=DIR          Alternate location for libz headers,
CFLAGS="-I${withval} ${CFLAGS}")

AC_ARG_WITH(zlib,--with-zlib=DIR           Alternate location for libz library,
LDFLAGS="-L${withval} ${LDFLAGS}")

AC_ARG_WITH(png-inc,--with-png-inc=DIR        Alternate location of png header files, CFLAGS="-I${withval} ${CFLAGS}")

AC_ARG_WITH(png,--with-png=DIR            Alternate location for libpng library,
LDFLAGS="-L${withval} ${LDFLAGS}")

AC_ARG_WITH(freetype,--with-freetype=DIR       Alternate location for Freetype 2 library,
LDFLAGS="-L${withval} ${LDFLAGS}")

AC_ARG_WITH(db,--with-db=DIR             Alternate location for db headers,
CFLAGS="-I${withval} ${CFLAGS}")

AC_ARG_WITH(dblib,--with-dblib=DIR          Alternate location for db library,
LDFLAGS="-L${withval} ${LDFLAGS}"; HAVE_DB="yes", HAVE_DB="")

dnl enable-dns forces use of DNS code
AC_ARG_ENABLE(dns,--enable-dns              Enable DNS lookup code,
USE_DNS="yes")

dnl enable-ipv6 tries to use IPv6
AC_ARG_ENABLE(ipv6-dns,--enable-ipv6-dns         Tries to use IPv6 for dns loolups,
USE_IPV6="yes")

dnl DNS library check
if test "$USE_DNS" = "yes"; then
  if test "$HAVE_DB" = ""; then    # No path to db3 library given, we need to search for it ourself
    if test "$USE_IPV6" = "yes"; then
      AC_CHECK_FUNCS(getaddrinfo)
      if test "$ac_cv_func_getaddrinfo" = no; then
        AC_MSG_WARN(Your C library doesn't support IPv6!)
        AC_MSG_WARN(DNS lookup code will fall back to IPv4...)
      else
        OPTS="-DUSE_IPV6 ${OPTS}"
      fi
    fi
    AC_CHECK_FUNCS(__db185_open)
    if test "$ac_cv_func___db185_open" = no; then
      AC_SEARCH_LIBS(__db185_open, db3 db db1) # If found -l{db, db1, db3} is appended to our LIBS
      if test "$ac_cv_search___db185_open" != no; then
        OPTS="-DUSE_DNS ${OPTS}"; HAVE_DB="yes";
      else
        AC_MSG_WARN(You must have a V1.85 compatible DB library!)
        AC_MSG_WARN(DNS lookup code will be disabled...)
      fi
    else
      OPTS="-DUSE_DNS ${OPTS}"; HAVE_DB="yes"
    fi
  else
    OPTS="-DUSE_DNS ${OPTS}"; LIBS="-ldb ${LIBS}"; HAVE_DB="yes"
  fi
  if test "$HAVE_DB" = "yes"; then
    dnl Checking for db_185.h, then db.h
    AC_CHECK_HEADERS(db_185.h db3.1/db_185.h db.h, break)
    if test "$ac_cv_header_db_185_h" = no &&  test "$ac_cv_header_db3.1_db_185_h" = no &&  test "$ac_cv_header_db_h" = no; then
      AC_MSG_WARN(Could not find Berkeley DB 1.85 compatibility headers!);
      AC_MSG_WARN(DNS lookup code will be disabled...);
      HAVE_DB="";
    fi
    AC_CHECK_HEADERS(errno.h)
  fi
  dnl Some systems need these at link time (not Linux)
  AC_CHECK_FUNCS(socket)
  if test "$ac_cv_func_socket" = no; then
    AC_CHECK_LIB(socket, main, LIBS="-lsocket ${LIBS}";)
  fi
  AC_CHECK_HEADERS(sys/socket.h)
  #On my Debian sarge system it just compiles without this. I really don't know what its use is.
  #AC_CHECK_LIB(nsl, main, LIBS="-lnsl ${LIBS}")
fi

dnl Check for bsd 4.4 library -l44bsd:
AC_CHECK_LIB(44bsd, main, LIBS="-l44bsd ${LIBS}")

dnl Check for math library -lm
AC_CHECK_LIB(m, main, HAVE_LIBM="1"; LIBS="-lm ${LIBS}")

dnl Check for z library -lz
AC_CHECK_LIB(z, main,LIBZ="yes",LIBZ="no")
if test "$LIBZ" = "no"; then
  AC_MSG_ERROR(z library not found... please install zlib.)
else
 AC_CHECK_LIB(z, gzrewind,LIBS="-lz ${LIBS}",LIBZ="no")
  if test "$LIBZ" = "no"; then
   AC_MSG_ERROR(Old version of zlib found, please upgrade!)
  fi
fi

dnl Checking for iconv support
found="no"
AC_CHECK_HEADERS(iconv.h)
if test "$ac_cv_header_iconv_h" = yes; then
  AC_CHECK_FUNCS(iconv_open)
  if test "$ac_cv_func_iconv_open" = no; then
    # We assume it is in -liconv
    LIBS="-liconv ${LIBS}"; found="yes";
  else
    found="yes";
  fi
fi
if test "$found" = "no"; then
  AC_MSG_ERROR(Your system doesn't support UNIX98 iconv. Aborting!)
fi

dnl Checking for gettext support
found="no"
AC_CHECK_HEADERS(libintl.h)
if test "$ac_cv_header_libintl_h" = yes; then
  AC_CHECK_FUNCS(gettext)
  if test "$ac_cv_func_gettext" = no; then
    AC_CHECK_LIB(intl, gettext, LIBS="-lintl ${LIBS}"; found="yes";)
  else
    found="yes";
  fi
fi
if test "$found" = "no"; then
  AC_MSG_ERROR(Your system doesn't support gettext. Aborting!)
fi

dnl check for pthread library, we don't need it directly but it may be required if linking statically to gd
AC_CHECK_LIB(pthread, pthread_mutex_unlock)

dnl Check for png library -lpng
AC_CHECK_LIB(png, main, LIBS="-lpng ${LIBS}", LIBPNG="no")
if test "$LIBPNG" = "no"; then
  AC_MSG_ERROR(png library not found... please install png.)
fi

dnl checkin for freetype 2
AC_CHECK_LIB(freetype, FT_Init_FreeType, LIBS="-lfreetype ${LIBS}", LIBFT="no")
if test "$LIBFT" = "no"; then
  AC_MSG_ERROR(Freetype 2 library not found... please install it!)
fi

dnl check for gd graphics library -lgd
if test "$EXTRA_GD" = ""; then
  if test "$EXTRA_GDLIB" = ""; then
   AC_CHECK_LIB(gd, gdImageString,LIBS="-lgd ${LIBS}"; HAVE_LIBGD="yes", HAVE_LIBGD="")
  fi
fi

if test "$HAVE_LIBGD" = ""; then
 AC_FIND_PATH(GDLOC,libgd.a,"", ${PREFIX}/lib ${PREFIX}/lib/gd /usr/local/lib /usr/local/lib/gd /usr/local/gd /usr/local/include /usr/local/include/gd /usr/lib/gd /usr/lib /lib ./ ./gd ../gd ${EXTRA_GDLIB} ${EXTRA_GD})
 if test "$GDLOC" = ""; then
   AC_FIND_PATH(GDLOC,libgd.so,"", ${PREFIX}/lib ${PREFIX}/lib/gd /usr/local/lib /usr/local/lib/gd /usr/local/gd /usr/local/include /usr/local/include/gd /usr/lib/gd /usr/lib /lib ./ ./gd ../gd ${EXTRA_GDLIB} ${EXTRA_GD})
 fi
 if test "$GDLOC" = ""; then
  AC_MSG_ERROR(gd library not found... please install gd.)
 else
  LIBS="-lgd ${LIBS}"
  LDFLAGS="-L${GDLOC} ${LDFLAGS}"
 fi
fi

dnl Checking for gd >= 1.8.4
AC_CHECK_FUNC(gdImageStringFT, ,AC_MSG_ERROR(The Webdruid requires gd >= 1.8.4))


dnl find path to GD library headers
AC_FIND_PATH(GDLIB,gd.h,"", ${PREFIX}/include ${PREFIX}/include/gd /usr/local/include/gd /usr/local/include /usr/include/gd /usr/include /include/gd /include ./ ./gd ../gd ${EXTRA_GD} ${EXTRA_GDLIB})
dnl Abort if GD headers not found
if test "$GDLIB" = ""; then
 AC_MSG_ERROR(gd headers not found... please install gd.)
fi

dnl additonal platform specific checks
AC_CHECK_HEADERS(getopt.h)
if test "$HAVE_LIBM" = "1"; then
 AC_CHECK_HEADERS(math.h)
fi

#AM_GNU_GETTEXT

localedir=${datadir}/locale
AC_SUBST(localedir)

AC_CONFIG_FILES([Makefile])
AC_OUTPUT