Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 139 lines (120 sloc) 3.841 kb
6c72275 @sekimura initial commit with autoconf
authored
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
bc04f05 @sekimura added --with-perl option to select different libperl for embedding
authored
4 AC_PREREQ(2.52)
6c72275 @sekimura initial commit with autoconf
authored
5 m4_include([version.m4])
3493e27 @sekimura added usage() and -h option
authored
6 AC_INIT([evpsgi], [1.0.0], [sekimura@gmail.com])
6c72275 @sekimura initial commit with autoconf
authored
7 AC_CONFIG_SRCDIR([evpsgi.c])
8 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
9 AC_CONFIG_HEADER([config.h])
10
11 # Checks for programs.
12 AC_PROG_CC
13 AM_PROG_CC_C_O
6204d1b @sekimura copied some files from autoconf-1.11
authored
14 AC_PROG_INSTALL
6c72275 @sekimura initial commit with autoconf
authored
15
16 # Detect target build environment
17 # Checks for libraries.
18
19 # Checks for header files.
20 AC_HEADER_STDC
21 AC_CHECK_HEADERS([netdb.h stdlib.h sys/time.h])
22
23 # Checks for typedefs, structures, and compiler characteristics.
24 AC_HEADER_STDBOOL
25 AC_C_CONST
26 AC_TYPE_SIZE_T
27
28 # Checks for library functions.
29 AC_CHECK_FUNCS([strchr strcspn])
30
31
32 trylibeventdir=""
33 AC_ARG_WITH(libevent,
34 [ --with-libevent=PATH Specify path to libevent installation ],
35 [
36 if test "x$withval" != "xno" ; then
37 trylibeventdir=$withval
38 fi
39 ]
40 )
41
42 dnl ------------------------------------------------------
43 dnl libevent detection. swiped from Tor. modified a bit.
44
45 LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
46
47 AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
48 saved_LIBS="$LIBS"
49 saved_LDFLAGS="$LDFLAGS"
50 saved_CFLAGS="$CFLAGS"
51 le_found=no
52 for ledir in $trylibeventdir "" $prefix /usr/local ; do
53 LDFLAGS="$saved_LDFLAGS"
54 LIBS="$saved_LIBS -levent"
55
56 # Skip the directory if it isn't there.
57 if test ! -z "$ledir" -a ! -d "$ledir" ; then
58 continue;
59 fi
60 if test ! -z "$ledir" ; then
61 if test -d "$ledir/lib" ; then
62 LDFLAGS="-L$ledir/lib $LDFLAGS"
63 else
64 LDFLAGS="-L$ledir $LDFLAGS"
65 fi
66 if test -d "$ledir/include" ; then
67 CFLAGS="-I$ledir/include $CFLAGS"
68 else
69 CFLAGS="-I$ledir $CFLAGS"
70 fi
71 fi
72 # Can I compile and link it?
73 AC_TRY_LINK([#include <sys/time.h>
74 #include <sys/types.h>
75 #include <event.h>], [ event_init(); ],
76 [ libevent_linked=yes ], [ libevent_linked=no ])
77 if test $libevent_linked = yes; then
78 if test ! -z "$ledir" ; then
79 ac_cv_libevent_dir=$ledir
80 else
81 ac_cv_libevent_dir="(system)"
82 fi
83 le_found=yes
84 break
85 fi
86 done
87 LIBS="$saved_LIBS"
88 LDFLAGS="$saved_LDFLAGS"
89 CFLAGS="$saved_CFLAGS"
90 if test $le_found = no ; then
91 AC_MSG_ERROR([libevent is required. You can get it from $LIBEVENT_URL
92
93 If it's already installed, specify its path using --with-libevent=/dir/
94 ])
95 fi
96 ])
97 LIBS="$LIBS -levent"
98 if test $ac_cv_libevent_dir != "(system)"; then
99 if test -d "$ac_cv_libevent_dir/lib" ; then
100 LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
101 le_libdir="$ac_cv_libevent_dir/lib"
102 else
103 LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
104 le_libdir="$ac_cv_libevent_dir"
105 fi
106 if test -d "$ac_cv_libevent_dir/include" ; then
107 CFLAGS="-I$ac_cv_libevent_dir/include $CFLAGS"
108 else
109 CFLAGS="-I$ac_cv_libevent_dir $CFLAGS"
110 fi
111 fi
112
bc04f05 @sekimura added --with-perl option to select different libperl for embedding
authored
113 dnl ------------------------------------------------------
114 dnl -- perl detection to embed
115 tryperlpath=`which perl`
116 AC_ARG_WITH(perl,
117 [ --with-perl=PATH Specify path to perl installation ],
118 [
119 if test "x$withval" != "x" ; then
120 tryperlpath=$withval
121 fi
122 ]
123 )
124
22d680d @sekimura use embed_util.pl to get perl_LIBS and perl_LDFLAGS so that LDFLAGS w…
authored
125 perl_LIBS=`$tryperlpath ./embed_util.pl --libs`
126 perl_LDFLAGS=`$tryperlpath ./embed_util.pl --ldflags`
127 LIBS="$LIBS $perl_LIBS"
128 LDFLAGS="$LDFLAGS $perl_LDFLAGS"
bc04f05 @sekimura added --with-perl option to select different libperl for embedding
authored
129 CFLAGS="$CFLAGS `$tryperlpath -MExtUtils::Embed -e ccopts`"
6c72275 @sekimura initial commit with autoconf
authored
130
131 dnl -- hmm it depends on MacPorts actually. I'll find out a better way later
132 LDFLAGS=`echo $LDFLAGS | sed -e 's/-arch ppc//'`
133 CFLAGS=`echo $CFLAGS | sed -e 's/-arch ppc//'`
134
135 dnl ----------------------------------------------------------------------------
136
137 AC_CONFIG_FILES([Makefile])
138 AC_OUTPUT
Something went wrong with that request. Please try again.