File: configure.in

package info (click to toggle)
kazehakase 0.4.2-1etch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 7,260 kB
  • ctags: 7,377
  • sloc: ansic: 62,697; cpp: 13,422; sh: 9,083; ruby: 1,588; makefile: 1,026; xml: 372
file content (696 lines) | stat: -rw-r--r-- 22,701 bytes parent folder | download | duplicates (2)
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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)

AC_INIT(kazehakase, 0.4.2)
AM_INIT_AUTOMAKE(1.6)
AM_CONFIG_HEADER(config.h)

AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL
 
AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])

AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_AWK

dnl disable RTTI by default
AC_ARG_ENABLE(cpp-rtti,
        [  --enable-cpp-rtti       Enable C++ RTTI (for cvs gcc)],,
        enable_cpp_rtti=no)

if test "x$enable_cpp_rtti" = "xno"; then
  AM_CXXFLAGS="-fno-rtti $AM_CXXFLAGS"
fi

dnl **************************************************************
dnl Check for GtkMozEmbed.
dnl **************************************************************
GECKO=
AC_ARG_WITH([gecko_engine],
	AS_HELP_STRING([--with-gecko-engine@<:@=mozilla|firefox|thunderbird|seamonkey|xulrunner@:>@],
		       [Whether to use mozilla, firefox or thunderbird or seamonkey xpcom (default: mozilla)]),
	[GECKO="$withval"])

dnl try to autodetect: if mozilla exists, use it, else try firefox, then thunderbird
if test "x$GECKO" = "x"; then
  if $PKG_CONFIG --exists firefox-xpcom; then
    GECKO=firefox
  elif $PKG_CONFIG --exists mozilla-firefox-xpcom; then
    GECKO=mozilla-firefox
  elif $PKG_CONFIG --exists mozilla-xpcom; then
    GECKO=mozilla
  elif $PKG_CONFIG --exists seamonkey-xpcom; then
    GECKO=seamonkey
  elif $PKG_CONFIG --exists thunderbird-xpcom; then
    GECKO=thunderbird
  elif $PKG_CONFIG --exists xulrunner-xpcom; then
    GECKO=xulrunner
  else
    AC_MSG_ERROR([no mozilla installation found])
  fi
elif test "x$with_gecko_engine" != "xmozilla" -a "x$with_gecko_engine" != "xfirefox" -a "x$with_gecko_engine" != "xthunderbird" -a "x$with_gecko_engine" != "xseamonkey" -a "x$with_gecko_engine" != "xmozilla-firefox" -a "x$with_gecko_engine" != "xxulrunner"; then
  AC_MSG_ERROR([unknown gecko engine name ($GECKO)])
fi
AC_SUBST(GECKO)

AC_MSG_RESULT([$GECKO])

case "$GECKO" in
mozilla) min_version=1.7 flavour=mozilla ;;
seamonkey) min_version=1.0 flavour=mozilla ;;
firefox) min_version=1.0 flavour=toolkit ;;
mozilla-firefox) min_version=1.0 flavour=toolkit ;;
thunderbird) min_version=0.8 flavour=toolkit ;;
xulrunner) min_version=1.8 flavour=toolkit ;;
esac

GECKO_FLAVOUR=$flavour
AC_SUBST(GECKO_FLAVOUR)

dnl **************************************************************
dnl Check for including gtkmozembed.
dnl **************************************************************
AC_ARG_ENABLE(gtkmozembed, [  --enable-gtkmozembed
			  Enable including GtkMozEmbed module],,
		enable_gtkmozembed=yes)
if test x"$enable_gtkmozembed" = "xyes"; then
  AC_DEFINE(ENABLE_GTKMOZEMBED, 1, [Define including GtkMozEmbed])
  GECKO_MODULE=$GECKO-xpcom
else
  GECKO_MODULE=$GECKO-gtkmozembed
fi
AM_CONDITIONAL(ENABLE_GTKMOZEMBED, test x"$enable_gtkmozembed" = "xyes")

PKG_CHECK_MODULES(MOZILLA_COMPONENT, $GECKO_MODULE >= $min_version)

AC_SUBST(MOZILLA_COMPONENT_CFLAGS)
AC_SUBST(MOZILLA_COMPONENT_LIBS)

MOZILLA_COMPONENT_VERSION="`$PKG_CONFIG --modversion $GECKO_MODULE`"
AC_SUBST(MOZILLA_COMPONENT_VERSION)

MOZILLA_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir $GECKO-xpcom`"
AC_SUBST(MOZILLA_INCLUDE_ROOT)

MOZILLA_HOME="`$PKG_CONFIG --variable=libdir $GECKO-xpcom`"
AC_SUBST(MOZILLA_HOME)

MOZILLA_PREFIX="`$PKG_CONFIG --variable=prefix $GECKO-xpcom`"
AC_SUBST(MOZILLA_PREFIX)

dnl **************************************************************
dnl Check for history searching engine.
dnl **************************************************************
ENGINE=
AC_ARG_WITH([search_engine],
	AS_HELP_STRING([--with-search-engine@<:@=hyperestraier|rast@:>@],
		       [Whether to use HyperEstraier or Rast (default: hyperestraier)]),
	[ENGINE="$withval"])

	if test "x$ENGINE" = "xrast"; then
		AC_DEFINE(USE_RAST, 1, [Define using Rast])
	else
		AC_DEFINE(USE_HYPERESTRAIER, 1, [Define using HyperEstraier])
	fi


dnl *************************************************************************
dnl This is from Mozilla's configure.in. They set almost all the config stuff
dnl they need in mozilla-config.h Except for this compiler flag, which can't
dnl go in mozilla-config.h So we check the flag too and now we can include
dnl mozilla-config.h without breaking epiphany.
dnl This is really gcc-only
dnl Do this test using CXX only since some versions of gcc
dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
dnl only have short-wchar support for c++.
AC_LANG_PUSH(C++)
_SAVE_CPPFLAGS=$CPPFLAGS
_SAVE_CXXFLAGS=$CXXFLAGS
_SAVE_AM_CXXFLAGS=$AM_CXXFLAGS
AM_CXXFLAGS="$AM_CXXFLAGS -fshort-wchar"
CXXFLAGS="$CXXFLAGS $AM_CXXFLAGS"

AC_CACHE_CHECK(for compiler -fshort-wchar option,
    ac_cv_have_usable_wchar_option,
    [AC_TRY_RUN([#include <stddef.h>
                 int main () {
                   return (sizeof(wchar_t) != 2) ||
                          (wchar_t)-1 < (wchar_t) 0 ; } ],
                ac_cv_have_usable_wchar_option="yes",
                ac_cv_have_usable_wchar_option="no",
                ac_cv_have_usable_wchar_option="maybe")])

if test "$ac_cv_have_usable_wchar_option" != "yes"; then
    AM_CXXFLAGS=$_SAVE_AM_CXXFLAGS
fi


CPPFLAGS="-I$MOZILLA_INCLUDE_ROOT -I$MOZILLA_INCLUDE_ROOT/widget -I$MOZILLA_INCLUDE_ROOT/layout -I$MOZILLA_INCLUDE_ROOT/helperAppDlg -I$MOZILLA_INCLUDE_ROOT/dom -I$MOZILLA_INCLUDE_ROOT/exthandler -I$MOZILLA_INCLUDE_ROOT/pipnss -I$MOZILLA_INCLUDE_ROOT/necko -I$MOZILLA_INCLUDE_ROOT/gfx -I$MOZILLA_INCLUDE_ROOT/content -I$MOZILLA_INCLUDE_ROOT/locale -I$MOZILLA_INCLUDE_ROOT/docshell `$PKG_CONFIG --cflags-only-I $GECKO-xpcom` -Wconversion -Wsign-compare -Werror"
CXXFLAGS="$_SAVE_CXXFLAGS $AM_CXXFLAGS `$PKG_CONFIG --cflags-only-other $GECKO-xpcom`"

AC_MSG_RESULT([$CXXFLAGS])
dnl **************************************************************
dnl Check Mozilla API .
dnl This code picked from Epiphany-1.7.0.
dnl **************************************************************

dnl Changed from PRUnichar* to nsAString& in 1.8a1 and on aviary branch

dnl Determine gecko version
dnl We don't use the version from the .pc file, since that's the app version
dnl and not the Gecko version

AC_MSG_CHECKING([[for gecko version]])

gecko_version=`cat $MOZILLA_INCLUDE_ROOT/mozilla-config.h | grep MOZILLA_VERSION_U | awk '{ print $[3]; }' | tr ".ab+" " "`
if test -z "$gecko_version"; then
	gecko_version="1 7"
fi

gecko_version_major=`echo $gecko_version | awk '{ print $[1]; }'`
gecko_version_minor=`echo $gecko_version | awk '{ print $[2]; }'`

AC_MSG_RESULT([$gecko_version_major.$gecko_version_minor])

if test "$gecko_version_major" != "1" -o "$gecko_version_minor" -lt "7" -o "$gecko_version_minor" -gt "9"; then
	AC_MSG_ERROR([Unsupported Gecko version $gecko_version_major.$gecko_version_minor])
fi

if test "$gecko_version_major" = "1" -a "$gecko_version_minor" -ge "8"; then
	AC_DEFINE([HAVE_GECKO_1_8],[1],[Define if we have gecko 1.8])
fi
if test "$gecko_version_major" = "1" -a "$gecko_version_minor" -ge "9"; then
	AC_DEFINE([HAVE_GECKO_1_9],[1],[Define if we have gecko 1.9])
fi

AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$gecko_version_major" = "1" -a "$gecko_version_minor" -ge "8"])
AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$gecko_version_major" = "1" -a "$gecko_version_minor" -ge "9"])

AC_MSG_CHECKING([whether nsPIDOMWindow methods return nsPIDOMWindow*])

AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[[#include <nsPIDOMWindow.h>]],
		[[nsPIDOMWindow *w;
		  w->GetPrivateRoot ();]]
	)],
	[AC_DEFINE([MOZ_NSPIDOMWINDOW_RETURNNSPIDOMWINDOW_],[1],[Define if nsPIDOMWindow returns nsPIDOMWindow*]) result=yes],
	[result=no])

AC_MSG_RESULT([$result])

AC_MSG_CHECKING([whether nsIFilePicker methods expect nsAString&])

AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[[#include <nsEmbedString.h>
		  #include <widget/nsIFilePicker.h>]],
		[[nsIFilePicker *p;
		  p->SetDefaultString (nsEmbedString());]]
	)],
	[AC_DEFINE([MOZ_NSIFILEPICKER_NSASTRING_],[1],[Define if nsIFilePicker uses nsAString&]) result=yes],
	[result=no])

AC_MSG_RESULT([$result])

dnl Changed from char* to nsAString& in 1.8a1

AC_MSG_CHECKING([whether nsIMIMEInfo methods expect nsAString&])

AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[[#include <nsEmbedString.h>
		  #include <mimetype/nsIMIMEInfo.h>]],
		[[nsIMIMEInfo *p;
		  p->SetDescription (nsEmbedString());]]
	)],
	[AC_DEFINE([MOZ_NSIMIMEINFO_NSACSTRING_],[1],[Define if nsIMIMEInfo uses nsAString&]) result=yes],
	[result=no])

AC_MSG_RESULT([$result])

AC_MSG_CHECKING([whether nsICacheSession methods expect nsAString&])

AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[[#include <nsEmbedString.h>
		  #include <nkcache/nsICacheSession.h>]],
		[[nsICacheSession *p;
		  p->OpenCacheEntry (nsEmbedCString(),0, PR_FALSE, nsnull);]]
	)],
	[AC_DEFINE([MOZ_NSICACHESESSION_NSACSTRING_],[1],[Define if nsICacheSession uses nsAString&]) result=yes],
	[result=no])

AC_MSG_RESULT([$result])

AC_MSG_CHECKING([whether nsIHelperAppLauncherDialog methods expect PRBool])

AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[[#include <nsIHelperAppLauncherDialog.h>]],
		[[nsIHelperAppLauncherDialog *p;
		  p->Show (nsnull, nsnull, -1);]]
	)],
	[AC_DEFINE([MOZ_NSIHELPERAPPLAUNCHERDIALOG_NSPRBOOL_],[1],[Define if nsIHelperAppLauncharDialog uses PRBool]) result=yes],
	[result=no])

AC_MSG_RESULT([$result])

AC_MSG_CHECKING([whether NS_InitXPCOM3 exists])

AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[[#include <nsXPCOM.h>]],
		[[NS_InitXPCOM3(nsnull, nsnull, nsnull, nsnull, 0);]]
	)],
	[AC_DEFINE([MOZ_HAVE_NSINITXPCOM3_],[1],[Define if Gecko has NS_InitXPCOM3]) result=yes],
	[result=no])

AC_MSG_RESULT([$result])

AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[[#define MOZILLA_INTERNAL_API
		  #include <nsICanvasRenderingContextInternal.h>
		  #include <nsEmbedString.h>
		  #undef MOZILLA_INTERNAL_API]],
		[[nsICanvasRenderingContextInternal *p;
		  p->GetInputStream (nsEmbedCString(), nsEmbedString(), nsnull);]]
	)],
	[AC_DEFINE([MOZ_NSICANVASRENDERINGCONTEXTINTERNAL_HAVE_GETINPUTSTREAM_],[1],[Define if nsICanvasRenderingContextInternal has GetInputStream]) result=yes],
	[result=no])

AM_CONDITIONAL([MOZ_NO_NSICANVASRENDERINGCONTEXTINTERNAL_HAVE_GETINPUTSTREAM_], [test "$result" = "no"])
AC_MSG_RESULT([$result])

AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/content/nsICanvasRenderingContextInternal.h],
	[AC_DEFINE([HAVE_NSICANVASRENDERINGCONTEXTINTERNAL_H],[1],[Define if nsICanvasRenderingContextInternal.h exists])])

AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/nsIWebProgressListener2.h],
	[AC_DEFINE([HAVE_NSIWEBPROGRESSLISTENER2_H],[1],[Define if nsIWebProgressListener2.h exists])],
	[AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/uriloader/nsIWebProgressListener2.h],
		[AC_DEFINE([HAVE_NSIWEBPROGRESSLISTENER2_H],[1],[Define if nsIWebProgressListener2.h exists])])])

AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/nsITransfer.h],
	[AC_DEFINE([HAVE_NSITRANSFER_H],[1],[Define if nsITransfer.h exists])],
	[AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/uriloader/nsITransfer.h],
		[AC_DEFINE([HAVE_NSITRANSFER_H],[1],[Define if nsITransfer.h exists])])])

AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/nsIPresContext.h],
	[AC_DEFINE([HAVE_NSIPRESCONTEXT_H],[1],[Define if nsIPresContext.h exists])],
	[AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/layout/nsIPresContext.h],
		[AC_DEFINE([HAVE_NSIPRESCONTEXT_H],[1],[Define if nsIPresContext.h exists])])])

dnl Not a simple file check due to the header being in the SDK since 1.8a6
dnl https://bugzilla.mozilla.org/show_bug.cgi?id=271068

AC_CHECK_FILES([$MOZILLA_INCLUDE_ROOT/nsIPassword.h
		$MOZILLA_INCLUDE_ROOT/wallet/nsIPassword.h
		$MOZILLA_INCLUDE_ROOT/passwordmgr/nsIPassword.h],
	[AC_DEFINE([HAVE_NSIPASSWORD_H],[1],
	[Define if mozilla nsIPassword header is available])])

dnl Check for nsIDocShell::GetSecurityUI
dnl This code is picked from galeon-1.3.21.
dnl nsIDocShell::GetSecurityUI was added in 1.8b2 as part of the fastback
dnl patch
dnl https://bugzilla.mozilla.org/show_bug.cgi?id=274784

AC_MSG_CHECKING([whether nsIDocShell::GetSecureUI exists])
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[[#include <nsIDocShell.h>]],
		[[ nsIDocShell *p;
		   p->GetSecurityUI( nsnull ); ]]
	)],
	[AC_DEFINE([HAVE_NSIDOCSHELL_GETSECUREUI], [1],
		   [Define if nsIDocShell::GetSecureUI exists]) result=yes],
	[result=no])
AC_MSG_RESULT([$result])

dnl restore flags
CPPFLAGS=$_SAVE_CPPFLAGS
CXXFLAGS=$_SAVE_CXXFLAGS

AC_LANG_POP([C++])

dnl **************************************************************
dnl Check for Gtk+2.
dnl **************************************************************
dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, 
dnl pass to pkg-config
AM_PATH_GTK_2_0(2.6.0)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)

dnl **************************************************************
dnl Check for gtk-webcore.
dnl **************************************************************
AC_ARG_ENABLE(gtk_webcore, [  --enable-gtk-webcore
			  Enable GTK-Webcore module for HTML rendering])
if test x"$enable_gtk_webcore" = "xyes"; then
  PKG_CHECK_MODULES(NRCIT, osb-nrcit)
  AC_SUBST(NRCIT_CFLAGS)
  AC_SUBST(NRCIT_LIBS)
  AC_DEFINE(ENABLE_GTK_WEBCORE, 1, [Define using GTK-Webcore support])
fi
AM_CONDITIONAL(ENABLE_GTK_WEBCORE, test x"$enable_gtk_webcore" = "xyes")

dnl **************************************************************
dnl Check for openssl 
dnl **************************************************************
dnl AC_ARG_ENABLE(ssl, [  --disable-ssl
dnl 			  Disable OpenSSL suport],,
dnl			  disable_ssl=no)
dnl if test x"$disable_ssl" = "xno"; then
dnl   PKG_CHECK_MODULES(SSL, openssl)
dnl   AC_SUBST(SSL_CFLAGS)
dnl   AC_SUBST(SSL_LIBS)
dnl   AC_DEFINE(USE_SSL, 1, [Define using openssl])
dnl fi
dnl AM_CONDITIONAL(ENABLE_SSL, test x"$disable_ssl" = "xno")

dnl **************************************************************
dnl Check for GNU TLS
dnl **************************************************************
AC_ARG_ENABLE(ssl, [  --disable-ssl
 			  Disable GNU TLS suport],,
			  disable_ssl=no)
if test x"$disable_ssl" = "xno"; then
   AM_PATH_LIBGNUTLS(1.2.0,
	AC_DEFINE(USE_SSL, 1, [Define using GNU TLS]),
	AC_MSG_WARN([[libgnutls was not found.]]))
fi
AM_CONDITIONAL(ENABLE_SSL, test x"$disable_ssl" = "xno")

dnl **************************************************************
dnl Check for gettext.
dnl **************************************************************
ALL_LINGUAS="cs fr ja ru"
GETTEXT_PACKAGE=kazehakase
AC_SUBST(GETTEXT_PACKAGE)
AM_GLIB_GNU_GETTEXT
localedir="${datadir}/locale"
AC_SUBST(localedir)

dnl
dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
dnl
dnl kz_save_LIBS=$LIBS
dnl LIBS="$LIBS $GTK_LIBS"
dnl AC_CHECK_FUNCS(bind_textdomain_codeset)
dnl LIBS=$kz_save_LIBS


dnl **************************************************************
dnl Checks for programs.
dnl **************************************************************

AC_ARG_ENABLE(Werror, [  --enable-Werror         Enable -Werror option for GCC])

if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wmissing-prototypes[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wpointer-arith[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wcast-align[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wcast-align" ;;
  esac

  if test "x$enable_Werror" = "xyes"; then
    case " $CFLAGS " in
    *[\ \	]-Werror[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -Werror" ;;
    esac
  fi

  if test "x$enable_ansi" = "xyes"; then
    case " $CFLAGS " in
    *[\ \	]-ansi[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -ansi" ;;
    esac

    case " $CFLAGS " in
    *[\ \	]-pedantic[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -pedantic" ;;
    esac
  fi
fi

dnl **************************************************************
dnl Checks for libraries.
dnl **************************************************************
# FIXME: Replace `main' with a function in `-le':
AC_CHECK_LIB([e], [main])
# FIXME: Replace `main' with a function in `-links':
AC_CHECK_LIB([inks], [main])

dnl chekc zlib
AC_CHECK_HEADER(zlib.h,
    [
    dnl zlib.h was found
    HAVE_ZLIB_H="1"
    dnl if the lib wasn't found already, try again with the new paths
    if test "$HAVE_LIBZ" != "1"; then
      AC_CHECK_LIB(z, gzread,
                   [
                   dnl the lib was found!
                   HAVE_LIBZ="1"
                   ],
                   [ CPPFLAGS=$_cppflags
                   LDFLAGS=$_ldflags])
    fi
    ],
    [
      dnl zlib.h was not found, restore the flags
      CPPFLAGS=$_cppflags
      LDFLAGS=$_ldflags]
    )
if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
    then
    AC_MSG_WARN([configure found only the libz lib, not the header file!])
elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
    then
    AC_MSG_WARN([configure found only the libz header file, not the lib!])
elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
    then
    ZLIB_LIBS=-lz
    AC_SUBST(ZLIB_LIBS)
fi

dnl **************************************************************
dnl Checks for header files.
dnl **************************************************************
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h libintl.h stdlib.h string.h unistd.h])


dnl **************************************************************
dnl Checks for typedefs, structures, and compiler characteristics.
dnl **************************************************************
AC_C_CONST


dnl **************************************************************
dnl Checks for library functions.
dnl **************************************************************
AC_CHECK_FUNCS([setlocale strchr strtol uname memmove strerror])

dnl **************************************************************
dnl Migemo 
dnl **************************************************************
AC_ARG_ENABLE(migemo, [  --enable-migemo
			  Enable Migemo (Japanese incremental search)])
if test x"$enable_migemo" = "xyes"; then
   AC_DEFINE(USE_MIGEMO, 1, [Define using Migemo support])
fi

dnl **************************************************************
dnl Configure for extentions.
dnl **************************************************************
extdir="${libdir}/\$(PACKAGE)/ext"
AC_SUBST(extdir)

dnl **************************************************************
dnl Extention: Check for Ruby.
dnl **************************************************************
ruby_available="no"
AC_ARG_WITH([ruby],
            AS_HELP_STRING([--with-ruby=PATH],
                           [Ruby interpreter path (default: auto-detect)]),
            [RUBY="$withval"])

if test "$RUBY" = "no"; then
  : # ignore
elif test "$RUBY" = ""; then
  AC_PATH_PROG(RUBY, ruby, none)
  if test "$RUBY" != "none"; then
    ruby_available="yes"
  fi
else
  AC_CHECK_FILE([$RUBY],
                [ruby_available="yes"],
                [AC_MSG_WARN([$RUBY is not found. Disable Ruby extension.])])
fi

if test "$ruby_available" = "yes"; then
  rbconfig="$RUBY -rrbconfig -e "

  changequote(<<, >>)
  for var_name in archdir sitearchdir CFLAGS LIBRUBYARG libdir; do
    rbconfig_tmp=`$rbconfig "print Config::CONFIG['$var_name']"`
    eval "rbconfig_$var_name=\"$rbconfig_tmp\""
  done
  changequote([, ])

  RUBY_CFLAGS="$RUBY_CFLAGS -I$rbconfig_archdir "
  RUBY_CFLAGS="$RUBY_CFLAGS -I$rbconfig_sitearchdir "
  RUBY_CFLAGS="$RUBY_CFLAGS $rbconfig_CFLAGS "
  RUBY_LIBS="$rbconfig_LIBRUBYARG"
  RUBY_LDFLAGS="-L$rbconfig_libdir"

  AC_SUBST(RUBY_CFLAGS)
  AC_SUBST(RUBY_LIBS)
  AC_SUBST(RUBY_LDFLAGS)

  _SAVE_CFLAGS=$CFLAGS
  ruby_undef_package_macros="
#undef PACKAGE_NAME
#undef PACKAGE_TARNAME
#undef PACKAGE_STRING
#undef PACKAGE_VERSION
"
  ruby_disable_message="Disable Ruby extension."
  CFLAGS="$CFLAGS $RUBY_CFLAGS"
  AC_CHECK_HEADERS(ruby.h, [],
                   [ruby_available="no"
                    AC_MSG_WARN([$ruby_disable_message])],
                   [$ruby_undef_package_macros])
  if test "x$ruby_available" = "xyes"; then
    CFLAGS="$CFLAGS $GTK_CFLAGS"
    AC_CHECK_HEADERS(rbgtk.h, [],
		     [ruby_available="no"
		      AC_MSG_WARN([Disable Ruby extension.])],
		     [$ruby_undef_package_macros])
  fi
  CFLAGS=$_SAVE_CFLAGS
fi

AM_CONDITIONAL([WITH_RUBY], [test "$ruby_available" = "yes"])


dnl **************************************************************
dnl Configure for gettext from Ruby scripts
dnl **************************************************************
AC_ARG_WITH([rgettext],
	    AS_HELP_STRING([--with-rgettext=PATH],
			   [rgettext path (default: auto-detect)]),
	    [RGETTEXT="$withval"])

if test "$RGETTEXT" = "no"; then
  RGETTEXT=""
elif test "$RGETTEXT" = ""; then
  AC_PATH_PROG(RGETTEXT, rgettext, none)
  if test "$RGETTEXT" = "none"; then
    RGETTEXT=""
  fi
else
  rgettext_message="$RGETTEXT is not found. Disable gettext from Ruby scripts."
  AC_CHECK_FILE([$RGETTEXT], [],
		[RGETTEXT=""
		 AC_MSG_WARN([$rgettext_message])])
fi

RGETTEXT_TARGETS=""
if test "$RGETTEXT" != ""; then
  changequote(<<, >>)
  for dir in data/ext/ruby; do
    tmp_targets="`find $dir -name '*.rb' -exec echo \$\(top_srcdir\)/\{\} \;`"
    RGETTEXT_TARGETS="$RGETTEXT_TARGETS `echo $tmp_targets | xargs echo`"
  done
  changequote([, ])
fi
AC_SUBST(RGETTEXT_TARGETS)

dnl **************************************************************
dnl Configure for UI XML
dnl **************************************************************
if test "$ruby_available" = "yes" ; then
  UI_XML_RUBY_START=""
  UI_XML_RUBY_END=""
else
  UI_XML_RUBY_START="<!--"
  UI_XML_RUBY_END="-->"
fi

AC_SUBST([UI_XML_RUBY_START])
AC_SUBST([UI_XML_RUBY_END])

KZ_BACKENDS="\$(GECKO)-\$(MOZILLA_COMPONENT_VERSION)"
AC_SUBST([KZ_BACKENDS])

AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_LDFLAGS])

AC_CONFIG_FILES([
Makefile
po/Makefile.in
src/Makefile
src/utils/Makefile
src/net/Makefile
src/mozilla/Makefile
src/khtml/Makefile
src/actions/Makefile
src/bookmarks/Makefile
src/dialogs/Makefile
src/prefs_ui/Makefile
src/sidebar/Makefile
src/widget/Makefile
src/libegg/Makefile
src/libegg/md5/Makefile
src/libegg/pixbufthumbnail/Makefile
src/libegg/regex/Makefile
src/libegg/regex/pcre/Makefile
etc/Makefile
etc/kz-ui-beginner.xml
etc/kz-ui-medium.xml
etc/kz-ui-expert.xml
etc/mozilla/Makefile
ext/Makefile
ext/ruby/Makefile
data/Makefile
data/icons/Makefile
data/ext/Makefile
data/ext/ruby/Makefile
data/ext/ruby/kz/Makefile
data/ext/ruby/kz/actions/Makefile
doc/Makefile
kazehakase.spec
])

AC_OUTPUT