Le 21/08/2010 09:25, Tatsuo Ishii a écrit :
>> Le 20/08/2010 15:04, Guillaume Lelarge a écrit :
>>> Le 20/08/2010 01:49, Tatsuo Ishii a écrit :
>>>>> hi!  i tried to compile pgpool-II 3.0 beta1 on SCO 5.0.7 , but    i 
>>>>> can't find  getopt.h file ,  i just  have an getopt_.h from gnulib but  
>>>>> is not enough to compile it.
>>>>>
>>>>> There is a  way to disable long options?
>>>>> or
>>>>> where can  i find a getopt.h file (and getopt.c to  compile. ;-) ) ??
>>>>
>>>> I have looked into PostgreSQL code, and found that it spends lots of
>>>> efforts to make long options portable.
>>>>
>>>> Guillaume, should we do the same thing?
>>>
>>> Seems a good idea. Working on it.
>>>
>>
>> Well, it shouldn't be a hard work for someone who knows how to write the
>> configure file, but it happens that I don't. I tried a few things, but
>> it didn't work out well.
>>
>> In the source file, there's only one thing to do. Instead of
>>
>> #include <getopt.h>
>>
>> we should have a
>>
>> #include "getopt_long.h"
>>
>> Of course, we also need to copy the getopt_long.c and getopt_lon.h
>> source files.
>>
>> And it's enough if the configure script is in good shape. Can you take
>> care of the configure script? or at least tell me the files that need
>> some updates.
>>
>> The only place where I found pgpool's licence is on the pgfoundry
>> website. We certainly need to mention it in the docs too.
> 
> We already have:
> 
> /* Define to 1 if you have the <getopt.h> header file. */
> #define HAVE_GETOPT_H 1
> 
> So probably in main.c and etc. we should do:
> 
> #ifdef HAVE_GETOPT_H
> #include <getopt.h>
> #else
> #include "getopt_long.h"
> :
> :
> 
> What else do you need?

Nothing. It's great :)

See patch attached.
> --
> Tatsuo Ishii
> SRA OSS, Inc. Japan
> English: http://www.sraoss.co.jp/index_en.php
> Japanese: http://www.sraoss.co.jp
> 


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
Index: Makefile.am
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/Makefile.am,v
retrieving revision 1.43
diff -c -p -r1.43 Makefile.am
*** Makefile.am	12 Aug 2010 06:36:17 -0000	1.43
--- Makefile.am	21 Aug 2010 16:07:20 -0000
*************** pgpool_SOURCES = pool.h pool_type.h vers
*** 21,27 ****
  	pool_worker_child.c \
  	pool_passwd.c pool_passwd.h \
  	pool_globals.c \
! 	pool_select_walker.c pool_select_walker.h
  
  pg_md5_SOURCES = pg_md5.c md5.c md5.h \
  	pool.h \
--- 21,28 ----
  	pool_worker_child.c \
  	pool_passwd.c pool_passwd.h \
  	pool_globals.c \
! 	pool_select_walker.c pool_select_walker.h \
!     getopt_long.c getopt_long.h
  
  pg_md5_SOURCES = pg_md5.c md5.c md5.h \
  	pool.h \
Index: Makefile.in
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/Makefile.in,v
retrieving revision 1.46
diff -c -p -r1.46 Makefile.in
*** Makefile.in	12 Aug 2010 06:36:17 -0000	1.46
--- Makefile.in	21 Aug 2010 16:07:20 -0000
*************** am_pgpool_OBJECTS = main.$(OBJEXT) child
*** 82,88 ****
  	pool_process_context.$(OBJEXT) pool_session_context.$(OBJEXT) \
  	pool_query_context.$(OBJEXT) pool_worker_child.$(OBJEXT) \
  	pool_passwd.$(OBJEXT) pool_globals.$(OBJEXT) \
! 	pool_select_walker.$(OBJEXT)
  pgpool_OBJECTS = $(am_pgpool_OBJECTS)
  pgpool_DEPENDENCIES = parser/libsql-parser.a pcp/libpcp.la \
  	parser/nodes.o
--- 82,88 ----
  	pool_process_context.$(OBJEXT) pool_session_context.$(OBJEXT) \
  	pool_query_context.$(OBJEXT) pool_worker_child.$(OBJEXT) \
  	pool_passwd.$(OBJEXT) pool_globals.$(OBJEXT) \
! 	pool_select_walker.$(OBJEXT) getopt_long.$(OBJEXT)
  pgpool_OBJECTS = $(am_pgpool_OBJECTS)
  pgpool_DEPENDENCIES = parser/libsql-parser.a pcp/libpcp.la \
  	parser/nodes.o
*************** pgpool_SOURCES = pool.h pool_type.h vers
*** 261,267 ****
  	pool_worker_child.c \
  	pool_passwd.c pool_passwd.h \
  	pool_globals.c \
! 	pool_select_walker.c pool_select_walker.h
  
  pg_md5_SOURCES = pg_md5.c md5.c md5.h \
  	pool.h \
--- 261,268 ----
  	pool_worker_child.c \
  	pool_passwd.c pool_passwd.h \
  	pool_globals.c \
! 	pool_select_walker.c pool_select_walker.h \
!     getopt_long.c getopt_long.h
  
  pg_md5_SOURCES = pg_md5.c md5.c md5.h \
  	pool.h \
*************** distclean-compile:
*** 457,462 ****
--- 458,464 ----
  @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/ps_status...@am__quote@
  @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/recovery...@am__quote@
  @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/strlcpy...@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/getopt_long...@am__quote@
  
  .c.o:
  @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
Index: main.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/main.c,v
retrieving revision 1.82
diff -c -p -r1.82 main.c
*** main.c	10 Aug 2010 15:08:32 -0000	1.82
--- main.c	21 Aug 2010 16:07:21 -0000
***************
*** 49,55 ****
--- 49,58 ----
  
  #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
  #endif
+ 
  #include <libgen.h>
  
  #include "version.h"
Index: pg_md5.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pg_md5.c,v
retrieving revision 1.7
diff -c -p -r1.7 pg_md5.c
*** pg_md5.c	27 Jun 2010 23:18:11 -0000	1.7
--- pg_md5.c	21 Aug 2010 16:07:21 -0000
***************
*** 34,39 ****
--- 34,41 ----
  #include <termios.h>
  #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
  #endif
  #include <pwd.h>
  #include <libgen.h>
Index: pcp/pcp_attach_node.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_attach_node.c,v
retrieving revision 1.6
diff -c -p -r1.6 pcp_attach_node.c
*** pcp/pcp_attach_node.c	13 Aug 2010 16:48:14 -0000	1.6
--- pcp/pcp_attach_node.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  
  #include "pcp.h"
  
Index: pcp/pcp_detach_node.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_detach_node.c,v
retrieving revision 1.7
diff -c -p -r1.7 pcp_detach_node.c
*** pcp/pcp_detach_node.c	13 Aug 2010 16:48:14 -0000	1.7
--- pcp/pcp_detach_node.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  
  #include "pcp.h"
  
Index: pcp/pcp_node_count.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_node_count.c,v
retrieving revision 1.6
diff -c -p -r1.6 pcp_node_count.c
*** pcp/pcp_node_count.c	13 Aug 2010 16:48:14 -0000	1.6
--- pcp/pcp_node_count.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  
  #include "pcp.h"
  
Index: pcp/pcp_node_info.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_node_info.c,v
retrieving revision 1.8
diff -c -p -r1.8 pcp_node_info.c
*** pcp/pcp_node_info.c	14 Aug 2010 18:01:09 -0000	1.8
--- pcp/pcp_node_info.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  
  #include "pcp.h"
  
Index: pcp/pcp_proc_count.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_proc_count.c,v
retrieving revision 1.7
diff -c -p -r1.7 pcp_proc_count.c
*** pcp/pcp_proc_count.c	13 Aug 2010 16:48:14 -0000	1.7
--- pcp/pcp_proc_count.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  
  #include "pcp.h"
  
Index: pcp/pcp_proc_info.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_proc_info.c,v
retrieving revision 1.11
diff -c -p -r1.11 pcp_proc_info.c
*** pcp/pcp_proc_info.c	14 Aug 2010 18:01:09 -0000	1.11
--- pcp/pcp_proc_info.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  #include <time.h>
  
  #include "pcp.h"
Index: pcp/pcp_recovery_node.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_recovery_node.c,v
retrieving revision 1.7
diff -c -p -r1.7 pcp_recovery_node.c
*** pcp/pcp_recovery_node.c	13 Aug 2010 16:48:14 -0000	1.7
--- pcp/pcp_recovery_node.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  
  #include "pcp.h"
  
Index: pcp/pcp_stop_pgpool.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_stop_pgpool.c,v
retrieving revision 1.6
diff -c -p -r1.6 pcp_stop_pgpool.c
*** pcp/pcp_stop_pgpool.c	13 Aug 2010 16:48:14 -0000	1.6
--- pcp/pcp_stop_pgpool.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  
  #include "pcp.h"
  
Index: pcp/pcp_systemdb_info.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_systemdb_info.c,v
retrieving revision 1.6
diff -c -p -r1.6 pcp_systemdb_info.c
*** pcp/pcp_systemdb_info.c	13 Aug 2010 16:48:14 -0000	1.6
--- pcp/pcp_systemdb_info.c	21 Aug 2010 16:07:21 -0000
***************
*** 24,30 ****
--- 24,34 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #else
+ #include "getopt_long.h"
+ #endif
  
  #include "pcp.h"
  
_______________________________________________
Pgpool-general mailing list
[email protected]
http://pgfoundry.org/mailman/listinfo/pgpool-general

Reply via email to